1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-19 07:57:39 +00:00

added some missing CAP_VR guards, more work on 2D in VR

This commit is contained in:
Zeno Rogue
2020-12-27 17:37:39 +01:00
parent 85ab111abb
commit f9d65a2e37
4 changed files with 56 additions and 12 deletions

View File

@@ -298,13 +298,18 @@ hyperpoint goodpoint;
vector<pair<int, hyperpoint>> tofix;
EX bool two_sided_model() {
#if CAP_VR
bool in_vr = vrhr::state == 2;
#else
constexpr bool in_vr = false;
#endif
if(GDIM == 3) return false;
if(pmodel == mdHyperboloid) return !euclid && vrhr::state != 2;
if(pmodel == mdHyperboloid) return !euclid && !in_vr;
// if(pmodel == mdHemisphere) return true;
if(pmodel == mdDisk) return sphere;
if(pmodel == mdRetroLittrow) return sphere;
if(pmodel == mdRetroHammer) return sphere;
if(pmodel == mdHemisphere) return vrhr::state != 2;
if(pmodel == mdHemisphere) return !in_vr;
if(pmodel == mdRotatedHyperboles) return true;
if(pmodel == mdSpiral && pconf.spiral_cone < 360) return true;
return false;
@@ -357,9 +362,11 @@ void fixpoint(glvertex& hscr, hyperpoint H) {
}
hyperpoint Hscr;
applymodel(shiftless(good), Hscr);
#if CAP_VR
if(vrhr::state == 2)
hscr = glhr::makevertex(Hscr[0], Hscr[1]*pconf.stretch, Hscr[2]);
else
#endif
hscr = glhr::makevertex(Hscr[0]*current_display->radius, Hscr[1]*current_display->radius*pconf.stretch, Hscr[2]*current_display->radius);
}
@@ -368,7 +375,9 @@ void addpoint(const shiftpoint& H) {
ld z = current_display->radius;
// if(pconf.alpha + H[2] <= BEHIND_LIMIT && pmodel == mdDisk) poly_flags |= POLY_BEHIND;
#if CAP_VR
if(vrhr::state == 2) z = 1;
#endif
if(spherespecial) {
auto H0 = H.h;
@@ -410,10 +419,13 @@ void addpoint(const shiftpoint& H) {
}
Hlast = Hscr;
}
#if CAP_VR
if(vrhr::state == 2) {
for(int i=0; i<3; i++) Hscr[i] *= z;
}
else if(GDIM == 2) {
else
#endif
if(GDIM == 2) {
for(int i=0; i<3; i++) Hscr[i] *= z;
Hscr[1] *= pconf.stretch;
}