class DebugDraw

Inherits: Module<DebugDraw>

Provides an easy access to draw basic 2D and 3D shapes, primarily meant for debugging purposes.

Public

Constructors

DebugDraw

DebugDraw()

Methods

~DebugDraw

~DebugDraw() noexcept

SetColor

void SetColor(const Color &color)

Changes the color of any further draw calls.

SetTransform

void SetTransform(const Matrix4 &transform)

Changes the transform that will be applied to meshes of any further draw calls.

DrawCube

void DrawCube(const Vector3 &position, const Vector3 &extents)

Draws an axis aligned cuboid.

position
Center of the cuboid.
extents
Radius of the cuboid in each axis.

DrawSphere

void DrawSphere(const Vector3 &position, float radius)

Draws a sphere.

DrawCone

void DrawCone(const Vector3 &base, const Vector3 &normal, float height, float radius, const Vector2 &scale = Vector2::kOne)

Draws a solid cone.

base
Position of the center of the base of the cone.
normal
Orientation of the cone, pointing from center base to the tip of the cone.
height
Height of the cone (along the normal).
radius
Radius of the base of the cone.
scale
Scale applied to cone's disc width & height. Allows you to create elliptical cones.

DrawDisc

void DrawDisc(const Vector3 &position, const Vector3 &normal, float radius)

Draws a solid disc.

position
Center of the disc.
normal
Orientation of the disc, pointing in the direction the disc is visible in.
radius
Radius of the disc.

DrawWireCube

void DrawWireCube(const Vector3 &position, const Vector3 &extents)

Draws a wireframe axis aligned cuboid.

position
Center of the cuboid.
extents
Radius of the cuboid in each axis.

DrawWireSphere

void DrawWireSphere(const Vector3 &position, float radius)

Draws a wireframe sphere represented by three discs.

DrawWireCone

void DrawWireCone(const Vector3 &base, const Vector3 &normal, float height, float radius, const Vector2 &scale = Vector2::kOne)

Draws a wireframe cone.

base
Position of the center of the base of the cone.
normal
Orientation of the cone, pointing from center base to the tip of the cone.
height
Height of the cone (along the normal).
radius
Radius of the base of the cone.
scale
Scale applied to cone's disc width & height. Allows you to create elliptical cones.

DrawLine

void DrawLine(const Vector3 &start, const Vector3 &end)

Draws a line between two points.

DrawLineList

void DrawLineList(const Vector<Vector3> &linePoints)

Draws a list of lines.

Provided array must contain pairs of the line start point followed by an end point.

DrawWireDisc

void DrawWireDisc(const Vector3 &position, const Vector3 &normal, float radius)

Draws a wireframe disc.

position
Center of the disc.
normal
Orientation of the disc, pointing in the direction the disc is visible in.
radius
Radius of the disc.

DrawWireArc

void DrawWireArc(const Vector3 &position, const Vector3 &normal, float radius, Degree startAngle, Degree amountAngle)

Draws a wireframe arc.

position
Center of the arc.
normal
Orientation of the arc, pointing in the direction the arc is visible in.
radius
Radius of the arc.
startAngle
Angle at which to start the arc.
amountAngle
Length of the arc.

DrawWireMesh

void DrawWireMesh(const SPtr<MeshData> &meshData)

Draws a wireframe mesh.

meshData
Object containing mesh vertices and indices. Vertices must be Vertex3 and indices 32-bit.

DrawFrustum

void DrawFrustum(const Vector3 &position, float aspect, Degree FOV, float near, float far)

Draws a wireframe frustum.

position
Origin of the frustum, or the eye point.
aspect
Ratio of frustum width over frustum height.
FOV
Horizontal field of view in degrees.
near
Distance to the near frustum plane.
far
Distance to the far frustum plane.

Clear

void Clear()

Clears any objects that are currently drawing.

All objects must be re-queued.

UpdateInternal

void UpdateInternal()

Performs per-frame operations.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

CreateMeshProxyData

Vector<MeshRenderData> CreateMeshProxyData(const Vector<DrawHelper::ShapeMeshData> &meshData)

Converts mesh data from DrawHelper into mesh data usable by the debug draw renderer.

Fields

mDrawHelper

DrawHelper * mDrawHelper

mActiveMeshes

Vector<DrawHelper::ShapeMeshData> mActiveMeshes

mRenderer