summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/VISUAL_DEBUG.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/doc/VISUAL_DEBUG.md b/doc/VISUAL_DEBUG.md
new file mode 100644
index 0000000..f0adcba
--- /dev/null
+++ b/doc/VISUAL_DEBUG.md
@@ -0,0 +1,48 @@
+# 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<vec3> 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);
+```