Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CSceneDebug Class Reference

A helper class that allows you to draw lines, circles, text... etc., for debugging. More...

#include <Debug/CSceneDebug.h>

Public Member Functions

 CSceneDebug ()
 Constructor. Initializes internal arrays.
virtual ~CSceneDebug ()
 Destructor. Cleans up all debug primitives and the noZDebug instance.
CSceneDebuggetNoZDebug ()
 Returns the singleton instance dedicated for "No Z Debug" visualization.
void addCircle (const core::vector3df &pos, float radius, const core::vector3df &normal, const SColor &color)
 Adds a debug circle to the scene.
void addEclipse (const core::vector3df &pos, float radiusZ, float radiusX, const core::vector3df &normal, const SColor &color)
 Adds a debug ellipse to the scene.
void addTri (const core::triangle3df &tri, const SColor &color)
 Adds a debug triangle to the scene.
void addLine (const core::line3df &line, const SColor &color)
 Adds a debug line to the scene.
void addLine (const core::vector3df &v1, const core::vector3df &v2, const SColor &color)
 Adds a debug line to the scene.
void addLinestrip (const core::array< core::vector3df > &point, const SColor &color)
 Adds a debug linestrip (connected line segments) to the scene.
void addLinestrip (const std::vector< core::vector3df > &point, const SColor &color)
 Adds a debug linestrip to the scene.
void addBoudingBox (const core::aabbox3df &box, const SColor &color)
 Adds a debug axis-aligned bounding box to the scene.
void addTransformBBox (const core::aabbox3df &box, const SColor &color, const core::matrix4 &mat)
 Adds a debug bounding box with a transformation applied. The box is drawn with its edges transformed by the given matrix.
void addSphere (const core::vector3df &pos, float radius, const SColor &color)
 Adds a debug sphere (as two circles) to the scene.
void addPosition (const core::vector3df &pos, float length, const SColor &color)
 Adds debug axis lines to visualize a position and orientation.
void addTransform (const core::matrix4 &mat, float vectorLength)
 Adds debug axis lines at a transformed position (visualizes transform matrix axes). X (red), Y (green), Z (blue).
void addText (const core::vector3df &pos, const char *string, const SColor &color)
 Adds a 3D debug text billboard at the given scene position.
void addText2D (const core::vector2df &pos, const char *string, const SColor &color)
 Adds a 2D debug text billboard at the given screen position.
void clearText ()
 Clears all debug text billboards.
void clear ()
void clearLines ()
 Clears all debug lines.
void clearLineStrip ()
 Clears all debug linestrips.
void clearBoxs ()
 Clears all debug bounding boxes.
void clearTri ()
 Clears all debug triangles.
u32 getLinesCount ()
 Get the number of debug lines currently stored.
u32 getLineStripCount ()
 Get the number of debug linestrips currently stored.
u32 getBoxCount ()
 Get the number of debug boxes currently stored.
u32 getTriCount ()
 Get the number of debug triangles currently stored.
const SLineDebuggetLine (int i)
 Get a reference to the debug line at the specified index.
const SLineStripDebuggetLineStrip (int i)
 Get a reference to the debug linestrip at the specified index.
const SBoxDebuggetBox (int i)
 Get a reference to the debug box at the specified index.
const STriDebuggetTri (int i)
 Get a reference to the debug triangle at the specified index.

Protected Attributes

core::array< SLineDebug * > m_lines
 Array of debug lines.
core::array< SLineStripDebug * > m_linestrip
 Array of debug linestrips.
core::array< SBoxDebug * > m_boxs
 Array of debug boxes.
core::array< STriDebug * > m_tri
 Array of debug triangles.
core::array< CRenderTextData * > m_texts
 Array of debug text billboards.
CSceneDebugm_noZDebug

Detailed Description

A helper class that allows you to draw lines, circles, text... etc., for debugging.

You can draw debug visualizations by calling addLine, addText, addCircle, etc., in each loop. The debug data added will be automatically cleared every frame.

CSceneDebug* debug = CSceneDebug::getInstance();
// Use debugNoZ for drawing that ignores depth and appears in front of all other 3D objects.
CSceneDebug* debugNoZ = debug->getNoZDebug();
debugNoZ->addText(core::vector3df(0.0f, 1.0f, 0.0f), "Debug string 3d", SColor(255,255,255,255));
debugNoZ->addText2D(core::vector2df(10.0f, 10.0f), "Debug string 2d", SColor(255,255,255,255));
CSceneDebug * getNoZDebug()
Returns the singleton instance dedicated for "No Z Debug" visualization.
void addText(const core::vector3df &pos, const char *string, const SColor &color)
Adds a 3D debug text billboard at the given scene position.
void addText2D(const core::vector2df &pos, const char *string, const SColor &color)
Adds a 2D debug text billboard at the given screen position.
CSceneDebug()
Constructor. Initializes internal arrays.
Class representing a 32 bit ARGB color.
Definition SColor.h:285
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition vector3d.h:445
vector2d< f32 > vector2df
Typedef for f32 2d vector.
Definition vector2d.h:323

Member Function Documentation

◆ addBoudingBox()

void Skylicht::CSceneDebug::addBoudingBox ( const core::aabbox3df & box,
const SColor & color )

Adds a debug axis-aligned bounding box to the scene.

Parameters
boxBounding box geometry.
colorColor of the box.

◆ addCircle()

void Skylicht::CSceneDebug::addCircle ( const core::vector3df & pos,
float radius,
const core::vector3df & normal,
const SColor & color )

Adds a debug circle to the scene.

Parameters
posCenter position of the circle.
radiusRadius of the circle.
normalNormal vector defining the circle's orientation.
colorColor of the circle.

◆ addEclipse()

void Skylicht::CSceneDebug::addEclipse ( const core::vector3df & pos,
float radiusZ,
float radiusX,
const core::vector3df & normal,
const SColor & color )

Adds a debug ellipse to the scene.

Parameters
posCenter position of the ellipse.
radiusZRadius along the Z axis.
radiusXRadius along the X axis.
normalNormal vector defining the ellipse's orientation.
colorColor of the ellipse.

◆ addLine() [1/2]

void Skylicht::CSceneDebug::addLine ( const core::line3df & line,
const SColor & color )

Adds a debug line to the scene.

Parameters
lineLine geometry.
colorColor of the line.

◆ addLine() [2/2]

void Skylicht::CSceneDebug::addLine ( const core::vector3df & v1,
const core::vector3df & v2,
const SColor & color )

Adds a debug line to the scene.

Parameters
v1First endpoint of the line.
v2Second endpoint of the line.
colorColor of the line.

◆ addLinestrip() [1/2]

void Skylicht::CSceneDebug::addLinestrip ( const core::array< core::vector3df > & point,
const SColor & color )

Adds a debug linestrip (connected line segments) to the scene.

Parameters
pointArray of points forming the linestrip.
colorColor of the linestrip.

◆ addLinestrip() [2/2]

void Skylicht::CSceneDebug::addLinestrip ( const std::vector< core::vector3df > & point,
const SColor & color )

Adds a debug linestrip to the scene.

Parameters
pointIrrlicht array of points forming the linestrip.
colorColor of the linestrip.

◆ addPosition()

void Skylicht::CSceneDebug::addPosition ( const core::vector3df & pos,
float length,
const SColor & color )

Adds debug axis lines to visualize a position and orientation.

Parameters
posCenter position.
lengthLength of each axis line.
colorColor of the axes.

◆ addSphere()

void Skylicht::CSceneDebug::addSphere ( const core::vector3df & pos,
float radius,
const SColor & color )

Adds a debug sphere (as two circles) to the scene.

Parameters
posCenter position of the sphere.
radiusRadius of the sphere.
colorColor of the sphere.

◆ addText()

void Skylicht::CSceneDebug::addText ( const core::vector3df & pos,
const char * string,
const SColor & color )

Adds a 3D debug text billboard at the given scene position.

Parameters
pos3D position for the text.
stringText to display.
colorText color.

◆ addText2D()

void Skylicht::CSceneDebug::addText2D ( const core::vector2df & pos,
const char * string,
const SColor & color )

Adds a 2D debug text billboard at the given screen position.

Parameters
pos2D screen position for the text.
stringText to display.
colorText color.

◆ addTransform()

void Skylicht::CSceneDebug::addTransform ( const core::matrix4 & mat,
float vectorLength )

Adds debug axis lines at a transformed position (visualizes transform matrix axes). X (red), Y (green), Z (blue).

Parameters
matTransformation matrix.
vectorLengthLength of each axis line.

◆ addTransformBBox()

void Skylicht::CSceneDebug::addTransformBBox ( const core::aabbox3df & box,
const SColor & color,
const core::matrix4 & mat )

Adds a debug bounding box with a transformation applied. The box is drawn with its edges transformed by the given matrix.

Parameters
boxBounding box geometry.
colorColor of the box.
matTransformation matrix.

◆ addTri()

void Skylicht::CSceneDebug::addTri ( const core::triangle3df & tri,
const SColor & color )

Adds a debug triangle to the scene.

Parameters
triThe triangle geometry.
colorColor of the triangle.

◆ getBox()

const SBoxDebug & Skylicht::CSceneDebug::getBox ( int i)
inline

Get a reference to the debug box at the specified index.

Allows direct access to a specific debug bounding box for inspection or custom rendering.

Parameters
iIndex of the box in the internal array.
Returns
Constant reference to the SBoxDebug structure.

◆ getBoxCount()

u32 Skylicht::CSceneDebug::getBoxCount ( )
inline

Get the number of debug boxes currently stored.

Returns
Number of debug boxes.

◆ getLine()

const SLineDebug & Skylicht::CSceneDebug::getLine ( int i)
inline

Get a reference to the debug line at the specified index.

This function allows direct inspection or rendering of a specific debug line primitive currently stored.

Parameters
iIndex of the debug line in the internal array.
Returns
Constant reference to the SLineDebug structure.

◆ getLinesCount()

u32 Skylicht::CSceneDebug::getLinesCount ( )
inline

Get the number of debug lines currently stored.

Returns
Number of debug lines.

◆ getLineStrip()

const SLineStripDebug & Skylicht::CSceneDebug::getLineStrip ( int i)
inline

Get a reference to the debug linestrip at the specified index.

This function allows direct access to a specific debug linestrip (sequence of connected points) for custom processing or visualization.

Parameters
iIndex of the linestrip in the internal array.
Returns
Constant reference to the SLineStripDebug structure.

◆ getLineStripCount()

u32 Skylicht::CSceneDebug::getLineStripCount ( )
inline

Get the number of debug linestrips currently stored.

Returns
Number of debug linestrips.

◆ getNoZDebug()

CSceneDebug * Skylicht::CSceneDebug::getNoZDebug ( )

Returns the singleton instance dedicated for "No Z Debug" visualization.

"No Z Debug" means drawing debug primitives that ignore 3D object depth, allowing them to be rendered through all geometry (no depth testing). This is useful for visualizing guides or markers regardless of occlusion by scene objects.

Creates a new instance if it doesn't exist.

Returns
Pointer to the noZDebug instance.

◆ getTri()

const STriDebug & Skylicht::CSceneDebug::getTri ( int i)
inline

Get a reference to the debug triangle at the specified index.

Allows direct access to a specific debug triangle for inspection or custom rendering.

Parameters
iIndex of the triangle in the internal array.
Returns
Constant reference to the STriDebug structure.

◆ getTriCount()

u32 Skylicht::CSceneDebug::getTriCount ( )
inline

Get the number of debug triangles currently stored.

Returns
Number of debug triangles.

Member Data Documentation

◆ m_texts

core::array<CRenderTextData*> Skylicht::CSceneDebug::m_texts
protected

Array of debug text billboards.

Dedicated CSceneDebug instance for "No Z Debug" visualization (renders without depth testing)


The documentation for this class was generated from the following file: