From 8139e65c8e323a41596efb1d7ae455be6f885180 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 23 Aug 2025 13:38:07 +0200 Subject: [PATCH] rogueviz:: fixed notknot --- geometry.cpp | 31 ++++++++++++++++++++----------- rogueviz/notknot.cpp | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index 3d027b11..f792ed4b 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -481,6 +481,7 @@ hpcshape void prepare_compute3(); void prepare_shapes(); void prepare_usershapes(); + void generate_faces(); void hpcpush(hyperpoint h); void hpc_connect_ideal(hyperpoint a, hyperpoint b); @@ -626,6 +627,23 @@ EX bool special_fake() { return fake::in() && (BITRUNCATED || (GOLDBERG && S3 == 4 && gp::param.first == 1 && gp::param.second == 1) || (UNRECTIFIED && gp::param.first == 1 && gp::param.second == 1)); } +EX hookset hooks_generate_faces; + +void geometry_information::generate_faces() { + if(callhandlers(false, hooks_generate_faces, this)) return; + #if MAXMDIM >= 4 + else if(reg3::in()) reg3::generate(); + else if(euc::in(3)) euc::generate(); + #if CAP_SOLV + else if(sn::in()) sn::create_faces(); + #endif + #if CAP_BT + else if(bt::in()) bt::create_faces(); + #endif + else if(nil && !mtwisted) nilv::create_faces(); + #endif + } + void geometry_information::prepare_basics() { DEBBI(DF_INIT | DF_POLY | DF_GEOM, ("prepare_basics")); @@ -800,17 +818,8 @@ void geometry_information::prepare_basics() { if(geometry == gHoroRec || kite::in() || sol || nil || nih) hexvdist = rhexf = .5, tessf = .5, scalefactor = .5, crossf = hcrossf7/2; if(bt::in()) scalefactor *= min(vid.binary_width, 1), crossf *= min(vid.binary_width, 1); #endif - #if MAXMDIM >= 4 - if(reg3::in()) reg3::generate(); - if(euc::in(3)) euc::generate(); - #if CAP_SOLV - else if(sn::in()) sn::create_faces(); - #endif - #if CAP_BT - else if(bt::in()) bt::create_faces(); - #endif - else if(nil && !mtwisted) nilv::create_faces(); - #endif + + generate_faces(); scalefactor = crossf / hcrossf7; orbsize = crossf; diff --git a/rogueviz/notknot.cpp b/rogueviz/notknot.cpp index b8618821..6240443d 100644 --- a/rogueviz/notknot.cpp +++ b/rogueviz/notknot.cpp @@ -1113,6 +1113,18 @@ struct hrmap_notknot : hrmap { return adj(c->master, i); } + int shvid(cell *c) override { + dynamicval g(geometry, base); + dynamicval m(currentmap, euc); + return currentmap->shvid(all[indices[c->master]]->where->c7); + } + + subcellshape& get_cellshape(cell* c) override { + dynamicval g(geometry, base); + dynamicval m(currentmap, euc); + return currentmap->get_cellshape(all[indices[c->master]]->where->c7); + } + ~hrmap_notknot() { for(auto uc: all) { if(uc && uc->result) { @@ -1587,6 +1599,12 @@ auto shot_hooks = addHook(hooks_initialize, 100, create_notknot) ->set_reaction(regenerate); param_i(loop_any, "nk_loopany"); }) + + addHook(hooks_generate_faces, 100, [] (geometry_information *gi) { + if(geometry != gNotKnot) return false; + dynamicval b(geometry, base); + gi->generate_faces(); + return true; + }) #ifndef NOTKNOT + addHook_slideshows(20, portal_slideshow) #endif