DebugDraw
Easy3D / Data & Batching / DebugDraw
Easy3D::DebugDraw queues debug primitives — line segments and axis-aligned boxes — for development overlays. Line()/Box() store one DebugLine/DebugBox per call; Lines()/Boxes() expose them so a future CPU-side vertex builder / CNA draw path can consume them. This class does no GPU work itself.
#include <Easy3D/DebugDraw.hpp>
namespace Easy3D
{
struct DebugLine;
struct DebugBox;
class DebugDraw;
}
Queueing is pure data storage, but constructing the CNA
Vector3 values you pass in calls CNA's compiled constructors — so executables using this class link CNA in practice. See Building & CMake.The primitive types
DebugLine
| Field | Type | Meaning |
|---|---|---|
From | Vector3 | Segment start, world space. |
To | Vector3 | Segment end, world space. |
DebugBox
| Field | Type | Meaning |
|---|---|---|
Center | Vector3 | World-space center of the box. |
Size | Vector3 | Full extents along X/Y/Z; the box is axis-aligned. |
Type aliases
| Alias | Refers to |
|---|---|
DebugDraw::Vector3 | Microsoft::Xna::Framework::Vector3 |
API
void Clear() noexcept
Drop all queued primitives (both lines and boxes). Typically called once per frame before re-queueing.
void Line(const Vector3& from, const Vector3& to)
Queue a line segment.
void Box(const Vector3& center, const Vector3& size)
Queue an axis-aligned box.
[[nodiscard]] std::size_t LineCount() const noexcept
[[nodiscard]] std::size_t BoxCount() const noexcept
[[nodiscard]] std::size_t PrimitiveCount() const noexcept
[[nodiscard]] std::size_t BoxCount() const noexcept
[[nodiscard]] std::size_t PrimitiveCount() const noexcept
Number of queued lines / boxes / both together (
PrimitiveCount() == LineCount() + BoxCount()).[[nodiscard]] const std::vector<DebugLine>& Lines() const noexcept
[[nodiscard]] const std::vector<DebugBox>& Boxes() const noexcept
[[nodiscard]] const std::vector<DebugBox>& Boxes() const noexcept
The queued primitives, in call order — the hand-off point for a future vertex builder or your own overlay renderer.
Unlike the batches,
DebugDraw has no Begin()/End() pair — debug primitives are not a "batch you flush" but a bag you Clear() whenever it suits your debugging flow (per frame, or accumulated across frames while paused).Example — visualizing collision data
#include <Easy3D/DebugDraw.hpp>
using Vector3 = Easy3D::DebugDraw::Vector3;
Easy3D::DebugDraw debug;
// Each frame:
debug.Clear();
// Mark the player's bounding box.
debug.Box(player.Position, Vector3(0.8f, 1.6f, 0.8f));
// Draw the velocity vector.
debug.Line(player.Position, player.Position + player.Velocity);
// A little world-origin axis cross.
debug.Line(Vector3::Zero, Vector3(1, 0, 0));
debug.Line(Vector3::Zero, Vector3(0, 1, 0));
debug.Line(Vector3::Zero, Vector3(0, 0, 1));
// Later: iterate debug.Lines() / debug.Boxes() in your overlay renderer.
Scope
Deliberately minimal: no colors, no durations/timers, no spheres or text. Those may or may not arrive later — only if Galaxy Eggbert needs them (see Design Principles). Rendering the queued primitives is Roadmap Phase 3/4 work, same as the other batches.