VR-Engage  2.2
Loading...
Searching...
No Matches
debugRenderCommands.h
Go to the documentation of this file.
1/*********************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*********************************************************************************/
5
6//! \file debugRenderCommands.h
7//! \ingroup vreDebugManager
8//! \brief Contains the debug rendering command classes for the VREngage debug system.
9//!
10//! This file defines various debug rendering command classes that are used by the
11//! debug renderer to render visual debug elements in the VREngage environment.
12//! These commands support different types of primitives like spheres, cubes, lines,
13//! triangles, and text (both 2D and 3D).
14
15#pragma once
16
19
20#include <list>
21
22namespace makVre
23{
24//! \brief Command namespace for debug rendering commands
25
26//! \brief Command for drawing a debug sphere in 3D space
27//!
28//! Renders a sphere at the specified position with the given radius and color
30{
31public:
32 //! \brief Constructor for sphere drawing command
33 //! \param position Center position of the sphere
34 //! \param radius Radius of the sphere
35 //! \param c Color of the sphere
36 //! \param fill Fill mode (solid, wireframe, etc.)
37 //! \param clip Whether to clip the sphere against the view frustum
38 //! \param time Duration in seconds for this command to remain active
39 DebugDrawSphereCommand(const DtVector& position, const double& radius, const DtColor& c, DtColor::Fill fill,
40 bool clip, const double& time);
41
42 //! \brief Virtual destructor
43 virtual ~DebugDrawSphereCommand() override;
44
45 virtual void draw(DtDebugCanvas& canvas) override;
46
47protected:
48 //! \brief Center position of the sphere
49 DtVector myPosition;
50 //! \brief Radius of the sphere
51 double myRadius;
52};
53
54//! \brief Command for drawing a debug cube in 3D space
55//!
56//! Renders an axis-aligned cube defined by its min and max corner points
58{
59public:
60 //! \brief Constructor for cube drawing command
61 //! \param start Minimum corner point of the cube
62 //! \param end Maximum corner point of the cube
63 //! \param c Color of the cube
64 //! \param fill Fill mode (solid, wireframe, etc.)
65 //! \param clip Whether to clip the cube against the view frustum
66 //! \param time Duration in seconds for this command to remain active
68 const DtVector& start, const DtVector& end, const DtColor& c, DtColor::Fill fill, bool clip, const double& time);
69
70 //! \brief Virtual destructor
71 virtual ~DebugDrawCubeCommand() override;
72
73 virtual void draw(DtDebugCanvas& canvas) override;
74
75protected:
76 DtVector myStart;
77 DtVector myEnd;
78};
79
80//! \brief Command for drawing a debug line in 3D space
81//!
82//! Renders a straight line between two points
84{
85public:
86 //! \brief Constructor for line drawing command
87 //! \param start Start point of the line
88 //! \param end End point of the line
89 //! \param c Color of the line
90 //! \param clip Whether to clip the line against the view frustum
91 //! \param time Duration in seconds for this command to remain active
92 DebugDrawLineCommand(const DtVector& start, const DtVector& end, const DtColor& c, bool clip, const double& time);
93
94 //! \brief Virtual destructor
95 virtual ~DebugDrawLineCommand() override;
96
97 virtual void draw(DtDebugCanvas& canvas) override;
98
99protected:
100 DtVector myStart;
101 DtVector myEnd;
102};
103
104//! \brief Command for drawing debug triangles in 3D space
105//!
106//! Renders a set of triangles defined by a list of vertex points
108{
109public:
110 //! \brief Constructor for triangle drawing command
111 //! \param points List of triangle vertices (should be multiples of 3)
112 //! \param c Color of the triangles
113 //! \param fill Fill mode (solid, wireframe, etc.)
114 //! \param clip Whether to clip the triangles against the view frustum
115 //! \param time Duration in seconds for this command to remain active
117 const std::vector<DtVector>& points, const DtColor& c, DtColor::Fill fill, bool clip, const double& time);
118
119 //! \brief Virtual destructor
120 virtual ~DebugDrawTrisCommand() override;
121
122 virtual void draw(DtDebugCanvas& canvas) override;
123
124protected:
125 //! \brief List of triangle vertices
126 std::vector<DtVector> myPoints;
127};
128
129//! \brief Command for drawing 3D text in the 3D world
130//!
131//! Renders text at a specific 3D position in world space
133{
134public:
135 //! \brief Constructor for 3D text drawing command
136 //! \param position Position in 3D space where the text should appear
137 //! \param text The text to display
138 //! \param c Color of the text
139 //! \param clip Whether to clip the text against the view frustum
140 //! \param time Duration in seconds for this command to remain active
142 const DtVector& position, const std::string& text, const DtColor& c, bool clip, const double& time);
143
144 //! \brief Virtual destructor
145 virtual ~DebugDrawText3dCommand() override;
146
147 virtual void draw(DtDebugCanvas& canvas) override;
148
149protected:
150 DtVector myPosition;
151 std::string myText;
152};
153
154//! \brief Command for drawing 2D text on the screen
155//!
156//! Renders text at a specific 2D position in screen space
158{
159public:
160 //! \brief Constructor for 2D text drawing command
161 //! \param position Position in screen space where the text should appear
162 //! \param text The text to display
163 //! \param c Color of the text
164 //! \param time Duration in seconds for this command to remain active
165 DebugDrawText2dCommand(const DtVector& position, const std::string& text, const DtColor& c, const double& time);
166
167 //! \brief Virtual destructor
168 virtual ~DebugDrawText2dCommand() override;
169
170 virtual void draw(DtDebugCanvas& canvas) override;
171
172protected:
173 DtVector myPosition;
174 std::string myText;
175};
176
177//! \brief Command for drawing a debug graph on the screen
178//!
179//! Renders a real-time graph to visualize data points over time
181{
182public:
183 //! \brief Constructor for graph drawing command
184 //! \param name Name of the graph
185 //! \param c Color of the graph
186 //! \param time Duration in seconds for this command to remain active
187 DebugDrawGraphCommand(const std::string& name, const DtColor& c, const double& time);
188
189 //! \brief Virtual destructor
190 virtual ~DebugDrawGraphCommand() override;
191
192 virtual void draw(DtDebugCanvas& canvas) override;
193
194 const std::string& name() { return myName; }
195 //! \brief Adds a data point to the graph
196 //! \param point The data point value to add
197 void addPoint(double point);
198 void setScreenPosition(const DtVector& screenPos) { myScreenPosition = screenPos; }
199
200 //! \brief Gets the default size of the graph
201 //! \return The default width/height of the graph in pixels
202 static float theGraphSize() { return 200.0f; }
203
204protected:
205 //! \brief Time at which the graph should reset
207 //! \brief Name of the graph
208 std::string myName;
209 //! \brief Collection of data points to plot
210 std::vector<double> myPoints;
211 //! \brief Current point index
213 //! \brief Minimum value in the graph
214 double myMin;
215 //! \brief Maximum value in the graph
216 double myMax;
217 //! \brief Position of the graph on the screen
219};
220
221//! \brief Command for drawing a debug text panel on the screen
222//!
223//! Renders a panel of text that can be updated with new lines
225{
226public:
227 //! \brief Constructor for text panel drawing command
228 //! \param name Name of the text panel
229 //! \param c Color of the text
230 //! \param time Duration in seconds for this command to remain active
231 DebugDrawTextPanelCommand(const std::string& name, const DtColor& c, const double& time);
232
233 //! \brief Virtual destructor
234 virtual ~DebugDrawTextPanelCommand() override;
235
236 virtual void draw(DtDebugCanvas& canvas) override;
237
238 const std::string& name() { return myName; }
239 //! \brief Adds a line of text to the panel
240 //! \param point The text line to add
241 //! \param scroll Whether to automatically scroll to show newest text
242 void addText(const std::string& point, bool scroll = false);
243 void setScreenPosition(const DtVector& screenPos) { myScreenPosition = screenPos; }
244
245 //! \brief Gets the default size of the text panel
246 //! \return The default width of the panel in pixels
247 static float thePanelSize() { return 320.0f; }
248
249protected:
250 //! \brief Time at which the panel should reset
252 //! \brief Name of the text panel
253 std::string myName;
254 //! \brief Collection of text lines to display
255 std::list<std::string> myText;
256 //! \brief Current text index
258 //! \brief Position of the panel on the screen
260};
261
262} // namespace makVre
DtVector myEnd
Definition debugRenderCommands.h:77
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
DtVector myStart
Definition debugRenderCommands.h:76
virtual ~DebugDrawCubeCommand() override
Virtual destructor.
DebugDrawCubeCommand(const DtVector &start, const DtVector &end, const DtColor &c, DtColor::Fill fill, bool clip, const double &time)
Constructor for cube drawing command.
std::string myName
Name of the graph.
Definition debugRenderCommands.h:208
DtVector myScreenPosition
Position of the graph on the screen.
Definition debugRenderCommands.h:218
double myMin
Minimum value in the graph.
Definition debugRenderCommands.h:214
std::vector< double > myPoints
Collection of data points to plot.
Definition debugRenderCommands.h:210
void addPoint(double point)
Adds a data point to the graph.
double myResetTime
Time at which the graph should reset.
Definition debugRenderCommands.h:206
static float theGraphSize()
Gets the default size of the graph.
Definition debugRenderCommands.h:202
const std::string & name()
Definition debugRenderCommands.h:194
int myCurrentPoint
Current point index.
Definition debugRenderCommands.h:212
DebugDrawGraphCommand(const std::string &name, const DtColor &c, const double &time)
Constructor for graph drawing command.
double myMax
Maximum value in the graph.
Definition debugRenderCommands.h:216
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
virtual ~DebugDrawGraphCommand() override
Virtual destructor.
void setScreenPosition(const DtVector &screenPos)
Definition debugRenderCommands.h:198
DebugDrawLineCommand(const DtVector &start, const DtVector &end, const DtColor &c, bool clip, const double &time)
Constructor for line drawing command.
DtVector myStart
Definition debugRenderCommands.h:100
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
DtVector myEnd
Definition debugRenderCommands.h:101
virtual ~DebugDrawLineCommand() override
Virtual destructor.
DebugDrawSphereCommand(const DtVector &position, const double &radius, const DtColor &c, DtColor::Fill fill, bool clip, const double &time)
Constructor for sphere drawing command.
DtVector myPosition
Center position of the sphere.
Definition debugRenderCommands.h:49
virtual ~DebugDrawSphereCommand() override
Virtual destructor.
double myRadius
Radius of the sphere.
Definition debugRenderCommands.h:51
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
DebugDrawText2dCommand(const DtVector &position, const std::string &text, const DtColor &c, const double &time)
Constructor for 2D text drawing command.
virtual ~DebugDrawText2dCommand() override
Virtual destructor.
DtVector myPosition
Definition debugRenderCommands.h:173
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
std::string myText
Definition debugRenderCommands.h:174
DebugDrawText3dCommand(const DtVector &position, const std::string &text, const DtColor &c, bool clip, const double &time)
Constructor for 3D text drawing command.
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
DtVector myPosition
Definition debugRenderCommands.h:150
std::string myText
Definition debugRenderCommands.h:151
virtual ~DebugDrawText3dCommand() override
Virtual destructor.
std::list< std::string > myText
Collection of text lines to display.
Definition debugRenderCommands.h:255
void setScreenPosition(const DtVector &screenPos)
Definition debugRenderCommands.h:243
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
int myCurrentText
Current text index.
Definition debugRenderCommands.h:257
const std::string & name()
Definition debugRenderCommands.h:238
DtVector myScreenPosition
Position of the panel on the screen.
Definition debugRenderCommands.h:259
DebugDrawTextPanelCommand(const std::string &name, const DtColor &c, const double &time)
Constructor for text panel drawing command.
virtual ~DebugDrawTextPanelCommand() override
Virtual destructor.
void addText(const std::string &point, bool scroll=false)
Adds a line of text to the panel.
double myResetTime
Time at which the panel should reset.
Definition debugRenderCommands.h:251
static float thePanelSize()
Gets the default size of the text panel.
Definition debugRenderCommands.h:247
std::string myName
Name of the text panel.
Definition debugRenderCommands.h:253
DebugDrawTrisCommand(const std::vector< DtVector > &points, const DtColor &c, DtColor::Fill fill, bool clip, const double &time)
Constructor for triangle drawing command.
virtual void draw(DtDebugCanvas &canvas) override
Pure virtual draw method that must be implemented by derived classes.
std::vector< DtVector > myPoints
List of triangle vertices.
Definition debugRenderCommands.h:126
virtual ~DebugDrawTrisCommand() override
Virtual destructor.
Class for representing and manipulating RGBA colors.
Definition color.h:22
Fill
Fill mode enumeration for rendering.
Definition color.h:26
DtDebugDrawCommand(DtColor color, DtColor::Fill fill, bool clip, const double &time, bool is3D)
Constructor for debug draw commands.
Definition debugRenderer.h:53
Contains the debug renderer class for the VREngage debug system.
Defines export macros for the VREngage Debug Manager library.
#define DEBUGMANAGER_DLL
Export/import macro for non-Windows platforms.
Definition export.h:40
Include export definitions for this library.
Definition glsVreMessageUtil.h:49