mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-17 18:54:48 +00:00
rug mouseover:: fix incorrect points in perspective; fix points behind eye in perspective; fix reverse Z in non-perspective (VR presumed fine)
This commit is contained in:
parent
6ef4a8a5e9
commit
68a3d20d83
8
rug.cpp
8
rug.cpp
@ -1468,10 +1468,14 @@ EX shiftpoint gethyper(ld x, ld y) {
|
||||
double tx = dxm * dy2 - dym * dx2;
|
||||
double ty = -(dxm * dy1 - dym * dx1);
|
||||
tx /= det; ty /= det;
|
||||
|
||||
if(in_perspective() && (p0[2] < 0 || p1[2] < 0 || p2[2] < 0) && (p0[2] > 0 || p1[2] > 0 || p2[2] > 0)) continue;
|
||||
|
||||
if(tx >= 0 && ty >= 0 && tx+ty <= 1) {
|
||||
double rz1 = p0[2] * (1-tx-ty) + p1[2] * tx + p2[2] * ty;
|
||||
rz1 = -rz1;
|
||||
if(vr && rz1 < 0) { /* behind the controller, ignore */ }
|
||||
if(vr) rz1 = -rz1;
|
||||
if(in_perspective() && !vr && rz1 < 0) { /* behind the eye, ignore */ }
|
||||
else if(vr && rz1 < 0) { /* behind the controller, ignore */ }
|
||||
else if(rz1 < radar_distance) {
|
||||
radar_distance = rz1;
|
||||
rx1 = r0->x1 + (r1->x1 - r0->x1) * tx + (r2->x1 - r0->x1) * ty;
|
||||
|
Loading…
Reference in New Issue
Block a user