# Visual Debugging System The `VisualDebug` class provides immediate-mode style 3D wireframe rendering for debugging purposes. It is stripped from the final binary when `STRIP_ALL` is defined. ## Features - **Wireframe Primitives**: Boxes, AABBs, Spheres, Cones, Crosses, Lines. - **Trajectories**: Visualize paths with `add_trajectory`. - **Mesh Normals**: Visualize vertex normals. - **Zero Overhead**: Code is compiled out in release builds. ## Usage Access the instance via `Renderer3D::GetVisualDebug()` (only available if `!STRIP_ALL`). ```cpp #if !defined(STRIP_ALL) VisualDebug& dbg = renderer.GetVisualDebug(); // Draw a red box at origin dbg.add_box(mat4::identity(), vec3(1,1,1), vec3(1,0,0)); // Draw a trajectory std::vector path = { ... }; dbg.add_trajectory(path, vec3(0,1,0)); // Draw a light cone dbg.add_cone(light_pos, light_dir, range, radius, vec3(1,1,0)); #endif ``` ## Primitives - `add_line(start, end, color)`: Basic line segment. - `add_cross(center, size, color)`: 3D cross (useful for points). - `add_sphere(center, radius, color)`: Wireframe sphere (3 axis circles). - `add_cone(apex, dir, height, radius, color)`: Wireframe cone (useful for spotlights). - `add_box(transform, half_extent, color)`: OBB. - `add_aabb(min, max, color)`: Axis-aligned box. - `add_trajectory(points, color)`: Polyline. ## Integration The `VisualDebug::render` method is called automatically by `Renderer3D::draw` if `s_debug_enabled_` is true. To enable globally: ```cpp Renderer3D::SetDebugEnabled(true); ```