1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

fixed CAP_VR guards

This commit is contained in:
Zeno Rogue 2020-12-31 18:36:03 +01:00
parent 79bf71ce78
commit f5ac66513c
3 changed files with 12 additions and 1 deletions

View File

@ -321,6 +321,7 @@ EX bool two_sided_model() {
}
EX int get_side(const hyperpoint& H) {
#if CAP_VR
if(in_vr_sphere) {
hyperpoint Hscr;
applymodel(shiftless(H), Hscr);
@ -331,6 +332,7 @@ EX int get_side(const hyperpoint& H) {
for(int i=0; i<3; i++) val += (vr_sphere_center[i] - actual[i]) * actual[i];
return val > 0 ? -1 : 1;
}
#endif
if(pmodel == mdDisk && sphere) {
double curnorm = H[0]*H[0]+H[1]*H[1]+H[2]*H[2];
double horizon = curnorm / pconf.alpha;

View File

@ -1333,19 +1333,22 @@ EX shiftpoint gethyper(ld x, ld y) {
double my = (y - current_display->ycenter)/current_display->radius/pconf.stretch;
bool vr = vrhr::active() && which_pointer;
transmatrix T = Id, U;
transmatrix U;
if(1) {
USING_NATIVE_GEOMETRY;
U = ortho_inverse(NLP) * rugView;
}
#if CAP_VR
transmatrix T = Id;
if(vr) {
mx = my = 0;
E4;
vrhr::gen_mv();
T = vrhr::model_to_controller(which_pointer);
}
#endif
calcparam();
@ -1380,6 +1383,7 @@ EX shiftpoint gethyper(ld x, ld y) {
if(!vr) {
applymodel(shiftless(U * native), res);
}
#if CAP_VR
else {
dynamicval<int> vi(vrhr::state, 2);
bool bad;
@ -1387,6 +1391,7 @@ EX shiftpoint gethyper(ld x, ld y) {
if(bad) error = true;
E4; res[3] = 1; res = T * res;
}
#endif
};
find(r0->native, p0);
@ -1417,7 +1422,9 @@ EX shiftpoint gethyper(ld x, ld y) {
radar_distance = rz1;
rx1 = r0->x1 + (r1->x1 - r0->x1) * tx + (r2->x1 - r0->x1) * ty;
ry1 = r0->y1 + (r1->y1 - r0->y1) * tx + (r2->y1 - r0->y1) * ty;
#if CAP_VR
if(vr) vrhr::pointer_distance = radar_distance;
#endif
}
found = true;
}

2
vr.cpp
View File

@ -11,10 +11,12 @@ namespace hr {
EX namespace vrhr {
#if !CAP_VR
#if HDR
inline bool active() { return false; }
inline bool rendering() { return false; }
inline bool rendering_eye() { return false; }
#endif
#endif
#if CAP_VR