From d1bf6fef5e29a730c56ceb2b6af8768baf137bca Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 12 Sep 2019 14:24:02 +0200 Subject: [PATCH] replaced product::product_sphere() --- basegraph.cpp | 4 ++-- bigstuff.cpp | 8 ++++---- cell.cpp | 2 +- drawing.cpp | 2 +- geom-exp.cpp | 2 +- graph.cpp | 2 +- hypgraph.cpp | 4 ++-- landgen.cpp | 4 ++-- nonisotropic.cpp | 7 +++++-- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/basegraph.cpp b/basegraph.cpp index 92e37344..d6fc5a40 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -300,9 +300,9 @@ void display_data::set_projection(int ed) { shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardH3, pers3 = true; if(GDIM == 3 && translatable && apply_models && pmodel == mdPerspective) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true; - if(GDIM == 3 && apply_models && pmodel == mdPerspective && prod && product::product_sphere()) + if(GDIM == 3 && apply_models && pmodel == mdPerspective && in_s2xe()) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true; - if(GDIM == 3 && apply_models && pmodel == mdPerspective && prod && !product::product_sphere()) + if(GDIM == 3 && apply_models && pmodel == mdPerspective && in_h2xe()) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardEH2, pers3 = true; if(GDIM == 3 && apply_models && pmodel == mdGeodesic && sol) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardSolv, pers3 = true; diff --git a/bigstuff.cpp b/bigstuff.cpp index 6aa88db9..d081153a 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -185,7 +185,7 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) { if(hybri) { - if(product::product_sphere()) return NULL; + if(hybrid::over_sphere()) return NULL; c = hybrid::get_where(c).first; heptagon *res; hybrid::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); }); @@ -981,7 +981,7 @@ EX void setLandSol(cell *c) { } EX void setLandHybrid(cell *c) { - if(prod && product::product_sphere() && !among(specialland, laElementalWall)) { + if(in_s2xe() && !among(specialland, laElementalWall)) { auto w = hybrid::get_where(c); auto d = w.second; @@ -1676,7 +1676,7 @@ EX void moreBigStuff(cell *c) { } else if((c->land == laRlyeh && !euclid) || c->land == laTemple) if(!(binarytiling && specialland != laTemple && c->land == laRlyeh)) { - if(eubinary || (prod && product::product_sphere()) || (c->master->alt && (tactic::on || masterAlt(c) <= 2))) { + if(eubinary || in_s2xe() || (c->master->alt && (tactic::on || masterAlt(c) <= 2))) { if(!eubinary && !chaosmode) currentmap->generateAlts(c->master); preventbarriers(c); int d = celldistAlt(c); @@ -1700,7 +1700,7 @@ EX void moreBigStuff(cell *c) { else if(geometry == gKiteDart3) { if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn; } - else if(prod && product::product_sphere()) { + else if(in_s2xe()) { auto d = hybrid::get_where(c); if(!PIU(pseudohept(d.first))) c->wall = waColumn; } diff --git a/cell.cpp b/cell.cpp index f3d31c1a..d940e3d2 100644 --- a/cell.cpp +++ b/cell.cpp @@ -462,7 +462,7 @@ static const int ALTDIST_ERROR = 90000; EX int celldistAlt(cell *c) { if(experimental) return 0; if(hybri) { - if(prod && product::product_sphere()) return hybrid::get_where(c).second; + if(in_s2xe()) return hybrid::get_where(c).second; auto w = hybrid::get_where(c); int d = c->master->alt && c->master->alt->alt ? c->master->alt->alt->fieldval : 0; d = sl2 ? 0 : abs(w.second - d); diff --git a/drawing.cpp b/drawing.cpp index 0f6c6919..85ee02db 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -1241,7 +1241,7 @@ EX } void dqi_poly::draw() { if(flags & POLY_DEBUG) debug_this(); - if(prod && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), shaderside_projection) && product::product_sphere()) { + if(in_s2xe() && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), shaderside_projection)) { s2xe::draw_s2xe(this); return; } diff --git a/geom-exp.cpp b/geom-exp.cpp index 91ccd3b1..301ba282 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -732,7 +732,7 @@ EX void showEuclideanMenu() { }); } - if(prod && product::product_sphere()) { + if(in_s2xe()) { dialog::addSelItem(XLAT("precision of S2xE rings"), its(s2xe::qrings), '4'); dialog::add_action([] { dialog::editNumber(s2xe::qrings, 1, 256, 4, 32, XLAT("precision of S2xE rings"), diff --git a/graph.cpp b/graph.cpp index bd7506d0..cb522b6d 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5108,7 +5108,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { } if(just_gmatrix) return; #if MAXMDIM >= 4 - if(WDIM == 3 && pmodel == mdPerspective && !nonisotropic && !(prod && product::product_sphere())) { + if(WDIM == 3 && pmodel == mdPerspective && !nonisotropic && !in_s2xe()) { hyperpoint H = tC0(V); if(prod) H = product::inverse_exp(H); for(hyperpoint& cpoint: clipping_planes) if((H|cpoint) < -sin_auto(cgi.corner_bonus)) { diff --git a/hypgraph.cpp b/hypgraph.cpp index 7ccbfc09..a1a34c24 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -1411,9 +1411,9 @@ EX void optimizeview() { if(prod) { ld z = zlevel(tC0(View)); View = mscale(View, -z); - if(product::product_sphere()) View = centralsym * View; + if(in_s2xe()) View = centralsym * View; hybrid::in_underlying_map(optimizeview); - if(product::product_sphere()) View = centralsym * View; + if(in_s2xe()) View = centralsym * View; if(z > cgi.plevel / 2) { hybrid::current_view_level--; z -= cgi.plevel; } if(z < -cgi.plevel / 2) { hybrid::current_view_level++; z += cgi.plevel; } View = mscale(View, z); diff --git a/landgen.cpp b/landgen.cpp index 1922f47d..0980726c 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -288,7 +288,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->wall = waPalace; } - if(d == 8 && (sphere || (hybri && product::product_sphere()))) { + if(d == 8 && (sphere || (hybri && hybrid::over_sphere()))) { int gs = getHemisphere(c,0); if(NONSTDVAR) { int v = 1; @@ -2705,7 +2705,7 @@ EX void setdist(cell *c, int d, cell *from) { buildEquidistant(c); } - if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !(hybri && product::product_sphere())) { + if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !(hybri && hybrid::over_sphere())) { c->land = (c->landparam >= 1 && c->landparam <= HAUNTED_RADIUS) ? laHauntedBorder : laGraveyard; } diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 373821cd..44a18cd2 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -566,11 +566,16 @@ EX namespace nilv { } EX } +EX bool in_s2xe() { return prod && hybrid::over_sphere(); } +EX bool in_h2xe() { return prod && !hybrid::over_sphere(); } + EX namespace hybrid { EX int current_view_level; EX eGeometry underlying; EX geometry_information *underlying_cgip; + + EX bool over_sphere() { return ginf[hybrid::underlying].cclass == gcSphere; } EX void configure(eGeometry g) { if(WDIM == 3) return; @@ -816,8 +821,6 @@ EX namespace product { }); } - EX bool product_sphere() { return ginf[hybrid::underlying].cclass == gcSphere; } - EX hyperpoint inverse_exp(hyperpoint h) { hyperpoint res; res[2] = zlevel(h);