Skip to main content

Module quadtree_debug

Module quadtree_debug 

Source
Expand description

Phase 1 debug visualization of the CPU chunked-quadtree selection: turn a Vec<Chunk> into a per-LOD-coloured ArrayMesh (throwaway CPU mesh — Phase 2 replaces this with GPU realize through the nodes pipeline). The pure helpers (lod_color, build_debug_mesh) return plain Rust data so they unit-test without a running Godot engine; the Godot node converts them to engine-backed Packed*Array/Color and wires them to a MeshInstance3D each frame.

Structs§

CelestialQuadtreeDebug
Phase 1 debug node: each frame, select the chunked-quadtree cut on the CPU and draw it as a per-LOD-coloured mesh. Additive — does not touch the clipmap.
DebugMeshData
CPU vertex arrays for one debug frame. Plain Vecs so the builder is headlessly testable; the node converts to Packed*.

Functions§

build_debug_mesh
Realize the selected chunks into a per-LOD-coloured triangle soup. Each chunk becomes chunk_res×chunk_res triangles all carrying the chunk’s LOD colour.
lod_color
Distinct linear-RGB colour per LOD level. Same hue spin (level * 0.137) and HSV→RGB construction as the existing terrain_surface layer_color, so the debug palette matches the rest of the project. Returns plain [f32;3] (no engine-backed Color) so it is testable headlessly.