![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
#include <DebugDraw.h>
Public Types | |
enum | TextAlignment { LEFT , RIGHT , CENTER } |
Text alignment modes. More... | |
Public Member Functions | |
DebugDraw () | |
Constructor. More... | |
virtual | ~DebugDraw () |
Destructor. More... | |
void | SetColour (const Ogre::ColourValue &colour) |
Sets the colour of the element to draw. More... | |
void | SetScreenSpace (const bool screen_space) |
Sets the screen space. More... | |
void | SetZ (const float z) |
Set the Z coordinate. More... | |
void | SetFadeDistance (const float fade_s, const float fade_e) |
Sets the fade distance for text. More... | |
void | SetTextAlignment (TextAlignment alignment) |
void | Line (const float x1, const float y1, const float x2, const float y2) |
Draws a line in 2D space. More... | |
void | Line3d (const Ogre::Vector3 &point1, const Ogre::Vector3 &point2) |
Draws a line in 3D space. More... | |
void | Triangle3d (const Ogre::Vector3 &point1, const Ogre::Vector3 &point2, const Ogre::Vector3 &point3) |
Draws a triangle in 3D space. More... | |
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. More... | |
void | Text (const float x, const float y, const Ogre::String &text) |
Writes debug text on the game screen. More... | |
void | Text (const Ogre::Vector3 &point, const float x, const float y, const Ogre::String &text) |
Writes debug text on the game screen. More... | |
void | renderQueueEnded (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &repeatThisInvocation) |
Ends the render queue. More... | |
Private Member Functions | |
void | CreateLineVertexBuffer () |
Creates a 2D line vertex buffer (2 vertices). More... | |
void | DestroyLineVertexBuffer () |
Destroys a 2D line vertex buffer (2 vertices). More... | |
void | CreateLine3dVertexBuffer () |
Creates a 3D line vertex buffer (2 vertices). More... | |
void | DestroyLine3dVertexBuffer () |
Destroys a 3D line vertex buffer (2 vertices). More... | |
void | CreateTriangle3dVertexBuffer () |
Creates a 3D triangle vertex buffer (3 vertices). More... | |
void | DestroyTriangle3dVertexBuffer () |
Destroys a 3D triangle vertex buffer (3 vertices). More... | |
void | CreateQuadVertexBuffer () |
Creates a quad vertex buffer (4 vertices). More... | |
void | DestroyQuadVertexBuffer () |
Destroys a quad vertex buffer (4 vertices). More... | |
void | CreateTextVertexBuffer () |
Creates a text vertex buffer. More... | |
void | DestroyTextVertexBuffer () |
Destroys a text vertex buffer. More... | |
Private Attributes | |
Ogre::SceneManager * | scene_manager_ |
The scene manager. More... | |
Ogre::RenderSystem * | render_system_ |
The render system. More... | |
Ogre::RenderOperation | line_render_operation_ |
A 2D line render operation. More... | |
Ogre::HardwareVertexBufferSharedPtr | line_vertex_buffer_ |
A 2D line vertex buffer (2 vertices). More... | |
unsigned int | line_max_vertex_ |
Maximum number of vertices for debug 2D lines. More... | |
Ogre::RenderOperation | line_3d_render_operation_ |
A 3D line render operation. More... | |
Ogre::HardwareVertexBufferSharedPtr | line_3d_vertex_buffer_ |
A 3D line vertex buffer (2 vertices). More... | |
unsigned int | line_3d_max_vertex_ |
Maximum number of vertices for debug 3D lines. More... | |
Ogre::RenderOperation | triangle_3d_render_operation_ |
A 3D triangle render operation. More... | |
Ogre::HardwareVertexBufferSharedPtr | triangle_3d_vertex_buffer_ |
A 3D triangle vertex buffer (3 vertices). More... | |
unsigned int | triangle_3d_max_vertex_ |
Maximum number of vertices for debug 3D triangles. More... | |
Ogre::RenderOperation | quad_render_operation_ |
A quad render operation. More... | |
Ogre::HardwareVertexBufferSharedPtr | quad_vertex_buffer_ |
A quad vertex buffer (4 vertices). More... | |
unsigned int | quad_max_vertex_ |
Maximum number of vertices for debug quads. More... | |
Ogre::RenderOperation | text_render_operation_ |
A text render operation. More... | |
Ogre::HardwareVertexBufferSharedPtr | text_vertex_buffer_ |
A text vertex buffer. More... | |
unsigned int | text_max_vertex_ |
Maximum number of vertices for debug text. More... | |
Ogre::FontPtr | font_ |
Font to use for debug text. More... | |
int | font_height_ |
Font height for the debug text. More... | |
TextAlignment | text_alignment_ |
Alignment for debug text. More... | |
Ogre::MaterialPtr | material_ |
Material for a 2D object. More... | |
Ogre::MaterialPtr | material_3d_ |
Material for a 3D object. More... | |
Ogre::ColourValue | colour_ |
Color for the debug object or text. More... | |
bool | screen_space_ |
The screen space. More... | |
float | z_coordinate_ |
Z coordinate for the debug object. More... | |
float | fade_start_square_ |
For text fading. More... | |
float | fade_end_square_ |
For text fading. More... | |
DebugDraw::DebugDraw | ( | ) |
Constructor.
|
virtual |
Destructor.
|
private |
Creates a 3D line vertex buffer (2 vertices).
|
private |
Creates a 2D line vertex buffer (2 vertices).
|
private |
Creates a quad vertex buffer (4 vertices).
|
private |
Creates a text vertex buffer.
|
private |
Creates a 3D triangle vertex buffer (3 vertices).
|
private |
Destroys a 3D line vertex buffer (2 vertices).
|
private |
Destroys a 2D line vertex buffer (2 vertices).
|
private |
Destroys a quad vertex buffer (4 vertices).
|
private |
Destroys a text vertex buffer.
|
private |
Destroys a 3D triangle vertex buffer (3 vertices).
void DebugDraw::Line | ( | const float | x1, |
const float | y1, | ||
const float | x2, | ||
const float | y2 | ||
) |
Draws a line in 2D space.
If the debug vertex limit has been reached or if it would be exceeded by drawing the line, a warning message will be printed and nothing will be done.
[in] | x1 | X coordinate of the starting point. |
[in] | y1 | Y coordinate of the starting point. |
[in] | x2 | X coordinate of the ending point. |
[in] | y2 | Y coordinate of the ending point. |
void DebugDraw::Line3d | ( | const Ogre::Vector3 & | point1, |
const Ogre::Vector3 & | point2 | ||
) |
Draws a line in 3D space.
If the debug vertex limit has been reached or if it would be exceeded by drawing the line, a warning message will be printed and nothing will be done.
[in] | point1 | Starting point. |
[in] | point2 | Ending point. |
void DebugDraw::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.
If the debug vertex limit has been reached or if it would be exceeded by drawing the quad, a warning message will be printed and nothing will be done.
[in] | x1 | X coordinate of the first point. |
[in] | y1 | Y coordinate of the first point. |
[in] | x2 | X coordinate of the second point. |
[in] | y2 | Y coordinate of the second point. |
[in] | x3 | X coordinate of the third point. |
[in] | y3 | Y coordinate of the third point. |
[in] | x4 | X coordinate of the fourth point. |
[in] | y4 | Y coordinate of the fourth point. |
void DebugDraw::renderQueueEnded | ( | Ogre::uint8 | queueGroupId, |
const Ogre::String & | invocation, | ||
bool & | repeatThisInvocation | ||
) |
Ends the render queue.
[in] | queueGroupId | The group id of the queue to end. |
[in] | invocation | |
[in] | repeatThisInvocation |
void DebugDraw::SetColour | ( | const Ogre::ColourValue & | colour | ) |
Sets the colour of the element to draw.
[in] | colour | The color to apply. |
void DebugDraw::SetFadeDistance | ( | const float | fade_s, |
const float | fade_e | ||
) |
Sets the fade distance for text.
[in] | fade_s | The text starts fading at this distance. |
[in] | fade_e | The text has faded completely at this distance. |
void DebugDraw::SetScreenSpace | ( | const bool | screen_space | ) |
Sets the screen space.
[in] | screen_space | The screen space. |
void DebugDraw::SetTextAlignment | ( | TextAlignment | alignment | ) |
void DebugDraw::SetZ | ( | const float | z | ) |
Set the Z coordinate.
[in] | z | The Z coordinate. |
void DebugDraw::Text | ( | const float | x, |
const float | y, | ||
const Ogre::String & | text | ||
) |
Writes debug text on the game screen.
The text won't be warped automatically. If the maximum number of debug letters has been written, or if it would be exceeded by writing, a warning message will be printed to console and nothing will be done.
[in] | x | Left position of the text in the screen. |
[in] | y | Left position of the text in the screen. |
[in] | text | The text to write. |
void DebugDraw::Text | ( | const Ogre::Vector3 & | point, |
const float | x, | ||
const float | y, | ||
const Ogre::String & | text | ||
) |
Writes debug text on the game screen.
The text will be warped automatically. If the maximum number of debug letters has been written, or if it would be exceeded by writing, a warning message will be printed to console and nothing will be done.
[in] | point | Top left point of the screen where the text will be written. |
[in] | x | Text width. |
[in] | y | Text height. |
[in] | text | The text to write. |
void DebugDraw::Triangle3d | ( | const Ogre::Vector3 & | point1, |
const Ogre::Vector3 & | point2, | ||
const Ogre::Vector3 & | point3 | ||
) |
Draws a triangle in 3D space.
If the debug vertex limit has been reached or if it would be exceeded by drawing the triangle, a warning message will be printed and nothing will be done.
[in] | point1 | A triangle vertex point. |
[in] | point2 | A triangle vertex point. |
[in] | point3 | A triangle vertex point. |
|
private |
Color for the debug object or text.
|
private |
For text fading.
The text fully fades at this distance.
|
private |
For text fading.
The text start fading from this distance.
|
private |
Font to use for debug text.
|
private |
Font height for the debug text.
|
private |
Maximum number of vertices for debug 3D lines.
|
private |
A 3D line render operation.
|
private |
A 3D line vertex buffer (2 vertices).
|
private |
Maximum number of vertices for debug 2D lines.
|
private |
A 2D line render operation.
|
private |
A 2D line vertex buffer (2 vertices).
|
private |
Material for a 2D object.
|
private |
Material for a 3D object.
|
private |
Maximum number of vertices for debug quads.
|
private |
A quad render operation.
|
private |
A quad vertex buffer (4 vertices).
|
private |
The render system.
|
private |
The scene manager.
|
private |
The screen space.
|
private |
Alignment for debug text.
|
private |
Maximum number of vertices for debug text.
|
private |
A text render operation.
|
private |
A text vertex buffer.
|
private |
Maximum number of vertices for debug 3D triangles.
|
private |
A 3D triangle render operation.
|
private |
A 3D triangle vertex buffer (3 vertices).
|
private |
Z coordinate for the debug object.