diff --git a/basegraph.cpp b/basegraph.cpp index 0faef2f4..f9512844 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -334,7 +334,7 @@ void display_data::set_projection(int ed) { if(pers3) { glhr::projection_multiply(glhr::frustum(current_display->tanfov, current_display->tanfov * cd->ysize / cd->xsize)); glhr::projection_multiply(glhr::scale(1, -1, -1)); - if(glhr::new_shader_projection == glhr::shader_projection::standardSolv) + if(solv::local_perspective_used()) glhr::projection_multiply(glhr::tmtogl_transpose(solv::local_perspective)); } else if(DIM == 3) { diff --git a/control.cpp b/control.cpp index 8c7201dc..f2d58a8e 100644 --- a/control.cpp +++ b/control.cpp @@ -64,7 +64,7 @@ movedir vectodir(const hyperpoint& P) { transmatrix U = ggmatrix(cwt.at); if(GDIM == 3 && WDIM == 2) U = radar_transform * U; - if(pmodel == mdSolPerspective) U = solv::local_perspective * U; + if(solv::local_perspective_used()) U = solv::local_perspective * U; hyperpoint H = sphereflip * tC0(U); transmatrix Centered = sphereflip * rgpushxto0(H); diff --git a/graph.cpp b/graph.cpp index 6dfd41c0..71b23ab4 100644 --- a/graph.cpp +++ b/graph.cpp @@ -4497,6 +4497,7 @@ void make_clipping_planes() { hyperpoint sx = point3(y1 * z2 - y2 * z1, z1 * x2 - z2 * x1, x1 * y2 - x2 * y1); sx /= hypot_d(3, sx); sx[3] = 0; + if(solv::local_perspective_used()) sx = inverse(solv::local_perspective) * sx; clipping_planes.push_back(sx); }; ld tx = current_display->tanfov; @@ -5009,8 +5010,6 @@ void drawcell_in_radar(cell *c, transmatrix V) { } #endif -transmatrix ilocal_perspective; - void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { PROD( if(product::pmap) { product::drawcell_stack(c, V, spinv, mirrored); return; } ) @@ -5055,7 +5054,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { hyperpoint H = tC0(V); if(abs(H[0]) <= 1 && abs(H[1]) <= 1 && abs(H[2]) <= 1) ; else { - hyperpoint H2 = solv::local_perspective * solv::inverse_exp(H, true); + hyperpoint H2 = solv::inverse_exp(H, true); for(hyperpoint& cpoint: clipping_planes) if((H2|cpoint) < -.2) return; } noclipped++; @@ -5978,8 +5977,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { int d = (wcol & 0xF0F0F0) >> 4; - hyperpoint h; if(sol) { if(pmodel == mdSolPerspective) h = tC0(V); else h = ilocal_perspective * tC0(V); } - for(int a=0; atype; a++) if(c->move(a) && !isWall3(c->move(a), dummy)) { if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !sol) { @@ -5991,12 +5988,12 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { ld b = vid.binary_width * log(2) / 2; const ld l = log(2) / 2; switch(a) { - case 0: if(h[0] >= b) continue; break; - case 1: if(h[1] >= b) continue; break; - case 2: case 3: if (pmodel == mdPerspective && h[2] >= l) continue; break; - case 4: if(h[0] <= -b) continue; break; - case 5: if(h[1] <= -b) continue; break; - case 6: case 7: if (pmodel == mdPerspective && h[2] <= -l) continue; break; + case 0: if(V[0][GDIM] >= b) continue; break; + case 1: if(V[1][GDIM] >= b) continue; break; + case 2: case 3: if (pmodel == mdPerspective && V[2][GDIM] >= l) continue; break; + case 4: if(V[0][GDIM] <= -b) continue; break; + case 5: if(V[1][GDIM] <= -b) continue; break; + case 6: case 7: if (pmodel == mdPerspective && V[2][GDIM] <= -l) continue; break; } } if(qfi.fshape && wmescher) { @@ -7130,11 +7127,8 @@ void make_actual_view() { if(sol) { transmatrix T = eupush( tC0(inverse(View)) ); solv::local_perspective = View * T; - if(pmodel == mdSolPerspective) { - actual_view_transform = inverse(solv::local_perspective) * actual_view_transform; - return; - } - else ilocal_perspective = inverse(solv::local_perspective); + actual_view_transform = inverse(solv::local_perspective) * actual_view_transform; + return; } if(GDIM == 3) { ld max = WDIM == 2 ? vid.camera : vid.yshift;