18#include <OgreHardwareVertexBuffer.h>
19#include <OgreRenderQueueListener.h>
21#include <OgreSingleton.h>
24class DebugDraw :
public Ogre::RenderQueueListener,
public Ogre::Singleton<DebugDraw>{
43 void SetColour(
const Ogre::ColourValue& colour);
58 void SetZ(
const float z);
103 const float x1,
const float y1,
const float x2,
const float y2
116 void Line3d(
const Ogre::Vector3& point1,
const Ogre::Vector3& point2);
130 const Ogre::Vector3& point1,
const Ogre::Vector3& point2,
131 const Ogre::Vector3& point3
151 const float x1,
const float y1,
const float x2,
const float y2,
152 const float x3,
const float y3,
const float x4,
const float y4
184 const Ogre::Vector3& point,
const float x,
const float y,
198 bool& repeatThisInvocation
396#define DEBUG_DRAW DebugDraw::getSingleton()
Definition: DebugDraw.h:24
Ogre::RenderSystem * render_system_
The render system.
Definition: DebugDraw.h:261
void Quad(const float x1, const float y1, const float x2, const float y2, const float x3, const float y3, const float x4, const float y4)
Draws a quad in 2D space.
Definition: DebugDraw.cpp:219
void DestroyLineVertexBuffer()
Destroys a 2D line vertex buffer (2 vertices).
Definition: DebugDraw.cpp:493
unsigned int line_3d_max_vertex_
Maximum number of vertices for debug 3D lines.
Definition: DebugDraw.h:291
Ogre::MaterialPtr material_3d_
Material for a 3D object.
Definition: DebugDraw.h:365
void CreateLineVertexBuffer()
Creates a 2D line vertex buffer (2 vertices).
Definition: DebugDraw.cpp:474
Ogre::FontPtr font_
Font to use for debug text.
Definition: DebugDraw.h:345
void SetScreenSpace(const bool screen_space)
Sets the screen space.
Definition: DebugDraw.cpp:97
void DestroyLine3dVertexBuffer()
Destroys a 3D line vertex buffer (2 vertices).
Definition: DebugDraw.cpp:523
void CreateTriangle3dVertexBuffer()
Creates a 3D triangle vertex buffer (3 vertices).
Definition: DebugDraw.cpp:530
Ogre::RenderOperation text_render_operation_
A text render operation.
Definition: DebugDraw.h:326
int font_height_
Font height for the debug text.
Definition: DebugDraw.h:350
bool screen_space_
The screen space.
Definition: DebugDraw.h:375
Ogre::HardwareVertexBufferSharedPtr line_3d_vertex_buffer_
A 3D line vertex buffer (2 vertices).
Definition: DebugDraw.h:286
TextAlignment text_alignment_
Alignment for debug text.
Definition: DebugDraw.h:355
float z_coordinate_
Z coordinate for the debug object.
Definition: DebugDraw.h:380
void DestroyTriangle3dVertexBuffer()
Destroys a 3D triangle vertex buffer (3 vertices).
Definition: DebugDraw.cpp:553
Ogre::ColourValue colour_
Color for the debug object or text.
Definition: DebugDraw.h:370
void SetTextAlignment(TextAlignment alignment)
Definition: DebugDraw.cpp:106
void SetFadeDistance(const float fade_s, const float fade_e)
Sets the fade distance for text.
Definition: DebugDraw.cpp:101
Ogre::RenderOperation triangle_3d_render_operation_
A 3D triangle render operation.
Definition: DebugDraw.h:296
float fade_start_square_
For text fading.
Definition: DebugDraw.h:385
DebugDraw()
Constructor.
Definition: DebugDraw.cpp:32
Ogre::HardwareVertexBufferSharedPtr line_vertex_buffer_
A 2D line vertex buffer (2 vertices).
Definition: DebugDraw.h:271
void SetZ(const float z)
Set the Z coordinate.
Definition: DebugDraw.cpp:99
void DestroyTextVertexBuffer()
Destroys a text vertex buffer.
Definition: DebugDraw.cpp:607
virtual ~DebugDraw()
Destructor.
Definition: DebugDraw.cpp:86
void Triangle3d(const Ogre::Vector3 &point1, const Ogre::Vector3 &point2, const Ogre::Vector3 &point3)
Draws a triangle in 3D space.
Definition: DebugDraw.cpp:180
TextAlignment
Text alignment modes.
Definition: DebugDraw.h:71
@ LEFT
Left aligned text.
Definition: DebugDraw.h:76
@ CENTER
Center aligned text.
Definition: DebugDraw.h:86
@ RIGHT
Right aligned text.
Definition: DebugDraw.h:81
void SetColour(const Ogre::ColourValue &colour)
Sets the colour of the element to draw.
Definition: DebugDraw.cpp:95
unsigned int line_max_vertex_
Maximum number of vertices for debug 2D lines.
Definition: DebugDraw.h:276
void CreateLine3dVertexBuffer()
Creates a 3D line vertex buffer (2 vertices).
Definition: DebugDraw.cpp:500
Ogre::RenderOperation line_render_operation_
A 2D line render operation.
Definition: DebugDraw.h:266
unsigned int text_max_vertex_
Maximum number of vertices for debug text.
Definition: DebugDraw.h:340
Ogre::HardwareVertexBufferSharedPtr text_vertex_buffer_
A text vertex buffer.
Definition: DebugDraw.h:333
void Line(const float x1, const float y1, const float x2, const float y2)
Draws a line in 2D space.
Definition: DebugDraw.cpp:108
Ogre::HardwareVertexBufferSharedPtr quad_vertex_buffer_
A quad vertex buffer (4 vertices).
Definition: DebugDraw.h:316
Ogre::MaterialPtr material_
Material for a 2D object.
Definition: DebugDraw.h:360
void DestroyQuadVertexBuffer()
Destroys a quad vertex buffer (4 vertices).
Definition: DebugDraw.cpp:579
Ogre::HardwareVertexBufferSharedPtr triangle_3d_vertex_buffer_
A 3D triangle vertex buffer (3 vertices).
Definition: DebugDraw.h:301
Ogre::SceneManager * scene_manager_
The scene manager.
Definition: DebugDraw.h:256
Ogre::RenderOperation line_3d_render_operation_
A 3D line render operation.
Definition: DebugDraw.h:281
void CreateTextVertexBuffer()
Creates a text vertex buffer.
Definition: DebugDraw.cpp:586
void CreateQuadVertexBuffer()
Creates a quad vertex buffer (4 vertices).
Definition: DebugDraw.cpp:560
void Text(const float x, const float y, const Ogre::String &text)
Writes debug text on the game screen.
Definition: DebugDraw.cpp:292
Ogre::RenderOperation quad_render_operation_
A quad render operation.
Definition: DebugDraw.h:311
void Line3d(const Ogre::Vector3 &point1, const Ogre::Vector3 &point2)
Draws a line in 3D space.
Definition: DebugDraw.cpp:149
unsigned int triangle_3d_max_vertex_
Maximum number of vertices for debug 3D triangles.
Definition: DebugDraw.h:306
float fade_end_square_
For text fading.
Definition: DebugDraw.h:390
void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &repeatThisInvocation)
Ends the render queue.
Definition: DebugDraw.cpp:417
unsigned int quad_max_vertex_
Maximum number of vertices for debug quads.
Definition: DebugDraw.h:321
Ogre::String String
Definition: TypeDefine.h:37
unsigned char uint8
Definition: scummsys.h:431