DebugDraw class final

Accumulates debug line segments into one reusable interleaved buffer.

Everything the engine wants to visualise — bounds, normals, gizmos, frusta — is line segments, so all of it goes into a single buffer drawn with one PrimitiveType.line call. That keeps the debug overlay off the frame's critical path: one draw and one buffer upload regardless of how much is shown.

The buffer is grown by doubling and never released, so a steady overlay allocates nothing after the first few frames. This class knows nothing about the graphics backend, which keeps it testable without a device.

Available extensions

Constructors

DebugDraw({int reserveLines = 256})

Properties

hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
no setter
lineCount → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vertexBytes → ByteData
The used portion of the buffer, ready to upload.
no setter
vertexCount → int
no setter

Methods

addAxes(Matrix4 transform, {double size = 1.0}) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A right-handed axis tripod at the transform's origin: X red, Y green, Z blue.
addBoneOctahedron(Vector3 from, Vector3 to, double width, Vector4 color) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A bone: an octahedron stretched from from toward to, the standard rig-viewport shape — the twelve edges of a real octahedron, one waist ring a tenth of the way along rather than in the middle, which is what makes the shape read as pointing from a joint toward its child instead of as a bulge sitting between two unrelated points.
addBox(Aabb3 box, Vector4 color) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

The twelve edges of an axis-aligned box.
addFrustum(Matrix4 viewProjection, Vector4 color) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

The view volume of the camera that produced viewProjection.
addJointCross(Vector3 center, double size, Vector4 color) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A three-line crosshair at center — what a joint with no child to stretch a bone toward (addBoneOctahedron needs two ends) is drawn as instead, the same way a light with no cone still needs a marker.
addLightGizmo(LightNode light, {double size = 0.25}) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A gizmo showing where a light is and where it aims.
addLine(Vector3 a, Vector3 b, Vector4 color) → void
addLineXyz(double ax, double ay, double az, double bx, double by, double bz, Vector4 color) → void
addNormals(MeshData mesh, Matrix4 worldMatrix, Matrix4 normalMatrix, {required double length, Vector4? color}) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

One segment per vertex, from the vertex along its normal.
addSkeletonOverlay(List<Vector3> worldPositions, List<int> parents, {Vector4? color, double boneWidth = 0.02, double crossSize = 0.03, Set<int> problem = const <int>{}}) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A skeleton, drawn one addBoneOctahedron per parent/child pair and one addJointCross at every joint parents gives no child — anim-08's own row.
addSphere(Vector3 centre, double radius, Vector4 color, {int segments = 24}) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A wire sphere as three orthogonal rings.
addTransformedBox(Aabb3 local, Matrix4 transform, Vector4 color) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

A box in local space, drawn as the transformed parallelepiped.
buildForScene(Scene scene, DebugDrawOptions options, {CameraNode? activeCamera, double aspect = 1.0, Iterable<SceneNode> highlighted = const <SceneNode>[]}) → void

Available on DebugDraw, provided by the DebugDrawGizmos extension

Fills the buffer with the overlays options asks for.
clear() → void
clipToNearPlane(Matrix4 viewProjection, {double epsilon = 1e-4}) → void
Trims every line to the part of it the camera can actually see.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

floatsPerLine → const int
floatsPerVertex → const int
position.xyz + colour.rgba, matching VertexLayout.positionColor.
maxNormalsPerMesh → const int
Upper bound on the normals drawn for one mesh.