A class with helper methods for rendering primitives like lines, for debug visualization.
More...
|
| DebugRenderer () |
| Constructs a DebugRenderer. More...
|
|
const Matrix4 & | getProjectionMatrix () const |
| Gets the current projection matrix. More...
|
|
void | setProjectionMatrix (const Matrix4 &matrix) |
| Sets the current projection matrix. More...
|
|
void | queueLine (const Vector2 &pos1, const Vector2 &pos2, unsigned int colorRgba) |
| Queue a colored line segment. More...
|
|
void | queuePolygon (const Vector2 *points, int count, unsigned int colorRgba) |
| Queue a colored polygon line. More...
|
|
void | queueFilledPolygon (const Vector2 *points, int count, unsigned int colorRgba) |
| Queue a filled convex polygon shape. More...
|
|
void | queueCircle (const Vector2 ¢er, float radius, int segments, unsigned int colorRgba) |
| Queues a circle centered about a point. More...
|
|
void | queueFilledCircle (const Vector2 ¢er, float radius, int segments, unsigned int colorRgba) |
| Queues a filled circle centered about a point. More...
|
|
void | flush () |
| Flushes the current shape being queued, preventing additional vertices from getting added to that draw call. More...
|
|
void | synchronizeForRendering () |
| Flips double buffered data, and clears the current queue. More...
|
|
void | render () |
| Renders draw calls in the render queue. More...
|
|
A class with helper methods for rendering primitives like lines, for debug visualization.
This class stores a list of draw calls and vertices, each double buffered. When shapes are queued for rendering, they are added to these lists. A call to synchronizeForRender() moves currently queued data into the double buffer for rendering. Calls to render() then render this data. This allows shapes to be queued at any time, and rendering to be performed safely on a separate render thread.
- Note
- While queuing and rendering can happen on different threads, methods themselves are not thread safe.
void DebugRenderer::setProjectionMatrix |
( |
const Matrix4 & |
matrix | ) |
|
Sets the current projection matrix.
This matrix transforms all shapes queued while it is set. When the matrix changes, subsequent queued shapes will be transformed with the new matrix. This means that multiple matrices can be used within a single frame. This can be useful, for example, when rendering debug shapes for a camera relative scene and then a screen relative UI.
- Parameters
-
matrix | The matrix to set as current |