diff --git a/drawing.cpp b/drawing.cpp index 0c631e9e..17bf79e8 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -161,7 +161,7 @@ EX unsigned char& part(color_t& col, int i) { #endif } -bool in_vr_sphere; +EX bool in_vr_sphere; hyperpoint vr_sphere_center; bool fatborder; @@ -2251,9 +2251,7 @@ EX void reverse_transparent_walls() { reverse(&ptds[qp0[pt]], &ptds[qp[pt]]); } -EX void draw_main() { - DEBBI(DF_GRAPH, ("draw_main")); - +EX void set_vr_sphere() { in_vr_sphere = false; #if CAP_VR in_vr_sphere = vrhr::rendering() && among(pmodel, mdDisk, mdBall, mdHyperboloid, mdHalfplane, mdHemisphere); @@ -2267,6 +2265,12 @@ EX void draw_main() { vr_sphere_center = vrhr::hmd_mv * vr_sphere_center; } #endif + } + +EX void draw_main() { + DEBBI(DF_GRAPH, ("draw_main")); + + set_vr_sphere(); if(sphere && GDIM == 3 && pmodel == mdPerspective && !stretch::in() && !ray::in_use) { diff --git a/vr.cpp b/vr.cpp index e5f54215..00bdb90a 100644 --- a/vr.cpp +++ b/vr.cpp @@ -470,6 +470,8 @@ ld vr_distance(shiftpoint h, int id, ld& dist) { h.h = hmd_pre_for[2] * h.h; eModel md = pmodel_3d_version(); apply_other_model(h, hscr, md); + if(in_vr_sphere && get_side(hscr) == (sphereflipped() ? -1 : 1)) return 1e5; + E4; hscr[3] = 1; hyperpoint hc = inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv * hscr; if(hc[2] > 0.1) return 1e6; /* behind */ @@ -493,6 +495,7 @@ EX void compute_point(int id, shiftpoint& res, cell*& c, ld& dist) { } gen_mv(); + set_vr_sphere(); c = nullptr; ld best = 1e9;