From c42211215ff7a070102b59b352275e48f954ab9e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 21 May 2026 11:20:40 +0200 Subject: [PATCH] some more hooks, to add extra models --- drawing.cpp | 11 +++++++++++ hypgraph.cpp | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drawing.cpp b/drawing.cpp index 60ad8b74..98683b06 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -310,12 +310,15 @@ bool knowgood; hyperpoint goodpoint; vector> tofix; +EX hookset hooks_two_sided_model; + EX bool two_sided_model() { #if CAP_VR bool in_vr = vrhr::rendering(); #else constexpr bool in_vr = false; #endif + auto i = callhandlers(0, hooks_two_sided_model); if(i) return i > 0; if(GDIM == 3) return false; if(in_vr_sphere) return true; if(pmodel == mdHemisphere || pmodel == mdHyperboloid) return !in_vr; @@ -328,7 +331,11 @@ EX bool two_sided_model() { return false; } +EX hookset hooks_get_side; + EX int get_side(const hyperpoint& H) { + int i = callhandlers(0, hooks_get_side, H); + if(i) return i; #if CAP_VR if(in_vr_sphere) { hyperpoint Hscr; @@ -2462,8 +2469,12 @@ EX void set_vr_sphere() { EX int hemi_side = 0; +EX hookset hooks_draw_main; + EX void draw_main() { DEBBI(debug_graph, ("draw_main")); + + if(callhandlers(false, hooks_draw_main)) return; if(pconf.back_and_front == 1 && vid.consider_shader_projection) { dynamicval pa(pconf.back_and_front); diff --git a/hypgraph.cpp b/hypgraph.cpp index 0ca70037..82de0cef 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -2874,15 +2874,17 @@ void queuestraight(hyperpoint X, int style, color_t lc, color_t fc, PPR p) { } */ } +#if HDR /** ball is written as cspin(0, 1, alpha) * cspin(2, 1, beta) * cspin(0, 2, gamma) */ struct ball_deconstruct { ld alpha, beta, gamma; transmatrix talpha, tbeta, tgamma, igamma; ld cos_beta, sin_beta; }; +#endif /** create a ball_deconstruct object */ -ball_deconstruct deconstruct_ball() { +EX ball_deconstruct deconstruct_ball() { // (0,1,0) -> (0, cos beta, sin beta) -> (sin alpha, cos beta * cos alpha, sin beta) hyperpoint h = pconf.ball() * point3(0, 1, 0); ball_deconstruct d; @@ -2901,8 +2903,12 @@ ball_deconstruct deconstruct_ball() { return d; } +EX hookset hooks_draw_boundary; + EX void draw_boundary(int w) { + if(callhandlers(false, hooks_draw_boundary, w)) return; + if((nonisotropic || gproduct) && pmodel == mdDisk) { queuecircle(current_display->xcenter, current_display->ycenter, current_display->radius, ringcolor, PPR::OUTCIRCLE, modelcolor); return;