Author:ptrace Comitter:ptrace Date:2026-05-11 13:28:42 UTC

removed halfway hypertree implementation. Postponing it since more important stuff is imminent

diff --git a/src/cells.jai b/src/cells.jai index 3cba949..8862606 100644 --- a/src/cells.jai +++ b/src/cells.jai @@ -295,7 +295,7 @@ draw_hover_cells :: (         using it;         if CheckCollisionPointRec(mouse_world, rect) && label {             parent_idx := (it_index - 1) / 2;             parent_idx := cast(int)floor((it_index - 1) / 2.0);             left_idx   := 2 * it_index + 1;             right_idx  := 2 * it_index + 2; diff --git a/src/htree.jai b/src/htree.jai index 9cb7195..778d38d 100644 --- a/src/htree.jai +++ b/src/htree.jai @@ -1,27 +1,34 @@ // Continue: hyper hyper! htree_init :: (tree_copy: []int, stat: *Statistics) {} htree_fit_zoom :: () -> Camera2D {     cam := camera;     cam.zoom   = 1.0;     cam.offset = CENTER;     cam.target = CENTER; htree_init :: (tree_copy: []int, stat: *Statistics) { } htree_fit_zoom :: () {     camera = cam;     return cam; } htree_draw_2d :: () { } htree_draw_2d :: () {} htree_draw_screen :: (stat: *Statistics) {     // Can't afford to be sidetracked by this :(     label := "Not Implemented";     tw := MeasureText(to_c_string(label), 40);     DrawText(to_c_string(label),         cast(s32, CENTER.x - (tw / 2.0)),         cast(s32, CENTER.y - 100.0),         40, WHITE     ); } #scope_file CENTER :: Vector2.{ SCREEN_WIDTH / 2.0, SCREEN_HEIGHT / 2.0 }; diff --git a/src/input.jai b/src/input.jai index 340178e..5c7ba37 100644 --- a/src/input.jai +++ b/src/input.jai @@ -68,8 +68,8 @@ input :: () {         // TODO: Maybe lerp?         // t := 1.0 - exp(-8.0 * frame_time);         // camera.zoom *= lerp(thing1, thing2, t);         //! t := 1.0 - exp(-8.0 * frame_time);         //! camera.zoom *= lerp(thing1, thing2, t);         camera.zoom  = clamp(camera.zoom, 0.1, 5.0);         camera.target.x = before.x - (mouse_screen.x - camera.offset.x) / camera.zoom; @@ -91,7 +91,7 @@ input :: () {     }     else if IsKeyPressed(.F2) {         if mode == .HYPER_TREE {             // htree_fit_zoom();             htree_fit_zoom();         } else {             mode = .HYPER_TREE;             state_switch(mode); diff --git a/src/main.jai b/src/main.jai index a901f5f..a075bb7 100644 --- a/src/main.jai +++ b/src/main.jai @@ -59,6 +59,9 @@ color_choice := Color.[     BLUE, ]; NODES_MAX :: 256; NODE_ROOT     :: -9; NODE_INTERNAL :: -7; NODE_EMPTY    :: -1; @@ -77,7 +80,6 @@ COLOR_CELLS_BORDER_HIGHLIGHT :: #run COLOR_CELLS_BORDER + COLOR_HIGHLIGHT1; DRAW_BV :: true; SCREEN_WIDTH  :: 1920; SCREEN_HEIGHT :: 1080; @@ -129,18 +131,19 @@ Statistics :: struct {         // Insert         tree_split_node(id, i);         // log_vars(tree);         //! log_vars(tree);         // Refit     }     tree_copy := array_copy(tree);     log_vars(tree_copy);     state_vtree: State;     state_htree: State;     state_cells: State;     stats_vtree: Statistics;     stats_htree: Statistics;     stats_cells: Statistics; @@ -158,7 +161,7 @@ Statistics :: struct {     {         using state_htree;         id = .HYPER_TREE;         // camera = htree_fit_zoom();         camera = htree_fit_zoom();     }     { @@ -249,7 +252,7 @@ Statistics :: struct {     log("-------------------");     log_vars(tree);     // tree_debug_view();     //! tree_debug_view(); } find_best_sibling :: (id: int) -> id: int { @@ -312,7 +315,7 @@ tree_get_ids :: (index: int) -> (left: int, right: int, parent: int) { } tree_get_parent_from_id :: (id: int) -> int {     // even == right; odd == left     //! even == right; odd == left     lr := ifx (id % 2 == 0) then 2 else 1;     index := (id - lr) / 2;     return index; @@ -320,29 +323,29 @@ tree_get_parent_from_id :: (id: int) -> int { /* TODO: check this! */ // tree_refit :: (tree: *Tree, index: int) { //     while index > 0 { //         i_left   := 2 * index + 1; //         i_right  := 2 * index + 2; //         i_parent := cast(int)floor((index - 1.0) / 2.0); //! tree_refit :: (tree: *Tree, index: int) { //!     while index > 0 { //!         i_left   := 2 * index + 1; //!         i_right  := 2 * index + 2; //!         i_parent := cast(int)floor((index - 1.0) / 2.0); //         // Refit this node to enclose both children //         tree.data[index] = aabb_bv_union( //             tree.data[i_left], //             tree.data[i_right] //         ); //!         // Refit this node to enclose both children //!         tree.data[index] = aabb_bv_union( //!             tree.data[i_left], //!             tree.data[i_right] //!         ); //         index = i_parent; //     } //!         index = i_parent; //!     } //     // Refit the root (index 0) separately, since the while loop stops before it //     i_left  := 1; //     i_right := 2; //     tree.data[0] = aabb_bv_union( //         tree.data[i_left], //         tree.data[i_right] //     ); // } //!     // Refit the root (index 0) separately, since the while loop stops before it //!     i_left  := 1; //!     i_right := 2; //!     tree.data[0] = aabb_bv_union( //!         tree.data[i_left], //!         tree.data[i_right] //!     ); //! } tree_debug_view :: () { @@ -350,7 +353,7 @@ tree_debug_view :: () {         node := tree_access_node(it_index);         if (node.parent == NODE_EMPTY) then continue;         log_vars(it_index, node.parent, node.left, node.right);         // log_vars(it, node.parent, bvs[node.left], bvs[node.right]);         //! log_vars(it, node.parent, bvs[node.left], bvs[node.right]);     } } diff --git a/src/state.jai b/src/state.jai index 9d73a38..1dc6ebe 100644 --- a/src/state.jai +++ b/src/state.jai @@ -37,7 +37,6 @@ state_find :: (id: Mode) -> idx: int { } find_by_id :: (a: State, b: State) -> bool {     if a.id == b.id return true;     return false;     return a.id == b.id; } diff --git a/src/vtree.jai b/src/vtree.jai index 2cb5d1f..12369c6 100644 --- a/src/vtree.jai +++ b/src/vtree.jai @@ -1,12 +1,22 @@ NODES_MAX :: 256; VTree_Node :: struct {     index: int;     value: int;     depth: int;     // Euclidian     x, y: float; } vtree_init :: (tree_copy: []int, stat: *Statistics) { vtree_init :: (tree_copy: []int, stat: *Statistics) -> []VTree_Node {     tree = tree_copy;     assign_positions(0, -(SCREEN_WIDTH / 2), SCREEN_WIDTH - (SCREEN_WIDTH / 2), 0);     create_stats(stat);     copy := array_copy(nodes);     copy.count = node_count;     return copy; } vtree_fit_zoom :: () -> Camera2D { @@ -174,13 +184,6 @@ DEPTH_SCALE_NODE :: 0.8; DEPTH_SCALE_FONT :: 0.75; VTree_Node :: struct {     index: int;     value: int;     x, y: float;     depth: int; } Range :: struct {     left: float;     right: float;