V-Gears 0
Free Final Fantasy VII engine.
DebugDraw Class Reference

#include <DebugDraw.h>

Inheritance diagram for DebugDraw:
Collaboration diagram for DebugDraw:

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...
 

Member Enumeration Documentation

◆ TextAlignment

Text alignment modes.

Enumerator
LEFT 

Left aligned text.

RIGHT 

Right aligned text.

CENTER 

Center aligned text.

Constructor & Destructor Documentation

◆ DebugDraw()

DebugDraw::DebugDraw ( )

Constructor.

◆ ~DebugDraw()

DebugDraw::~DebugDraw ( )
virtual

Destructor.

Member Function Documentation

◆ CreateLine3dVertexBuffer()

void DebugDraw::CreateLine3dVertexBuffer ( )
private

Creates a 3D line vertex buffer (2 vertices).

◆ CreateLineVertexBuffer()

void DebugDraw::CreateLineVertexBuffer ( )
private

Creates a 2D line vertex buffer (2 vertices).

◆ CreateQuadVertexBuffer()

void DebugDraw::CreateQuadVertexBuffer ( )
private

Creates a quad vertex buffer (4 vertices).

◆ CreateTextVertexBuffer()

void DebugDraw::CreateTextVertexBuffer ( )
private

Creates a text vertex buffer.

◆ CreateTriangle3dVertexBuffer()

void DebugDraw::CreateTriangle3dVertexBuffer ( )
private

Creates a 3D triangle vertex buffer (3 vertices).

◆ DestroyLine3dVertexBuffer()

void DebugDraw::DestroyLine3dVertexBuffer ( )
private

Destroys a 3D line vertex buffer (2 vertices).

◆ DestroyLineVertexBuffer()

void DebugDraw::DestroyLineVertexBuffer ( )
private

Destroys a 2D line vertex buffer (2 vertices).

◆ DestroyQuadVertexBuffer()

void DebugDraw::DestroyQuadVertexBuffer ( )
private

Destroys a quad vertex buffer (4 vertices).

◆ DestroyTextVertexBuffer()

void DebugDraw::DestroyTextVertexBuffer ( )
private

Destroys a text vertex buffer.

◆ DestroyTriangle3dVertexBuffer()

void DebugDraw::DestroyTriangle3dVertexBuffer ( )
private

Destroys a 3D triangle vertex buffer (3 vertices).

◆ Line()

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.

Parameters
[in]x1X coordinate of the starting point.
[in]y1Y coordinate of the starting point.
[in]x2X coordinate of the ending point.
[in]y2Y coordinate of the ending point.

◆ Line3d()

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.

Parameters
[in]point1Starting point.
[in]point2Ending point.

◆ Quad()

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.

Parameters
[in]x1X coordinate of the first point.
[in]y1Y coordinate of the first point.
[in]x2X coordinate of the second point.
[in]y2Y coordinate of the second point.
[in]x3X coordinate of the third point.
[in]y3Y coordinate of the third point.
[in]x4X coordinate of the fourth point.
[in]y4Y coordinate of the fourth point.

◆ renderQueueEnded()

void DebugDraw::renderQueueEnded ( Ogre::uint8  queueGroupId,
const Ogre::String &  invocation,
bool &  repeatThisInvocation 
)

Ends the render queue.

Parameters
[in]queueGroupIdThe group id of the queue to end.
[in]invocation
[in]repeatThisInvocation
Todo:
Understand and document.

◆ SetColour()

void DebugDraw::SetColour ( const Ogre::ColourValue &  colour)

Sets the colour of the element to draw.

Parameters
[in]colourThe color to apply.

◆ SetFadeDistance()

void DebugDraw::SetFadeDistance ( const float  fade_s,
const float  fade_e 
)

Sets the fade distance for text.

Parameters
[in]fade_sThe text starts fading at this distance.
[in]fade_eThe text has faded completely at this distance.

◆ SetScreenSpace()

void DebugDraw::SetScreenSpace ( const bool  screen_space)

Sets the screen space.

Parameters
[in]screen_spaceThe screen space.
Todo:
Understand and document properly.

◆ SetTextAlignment()

void DebugDraw::SetTextAlignment ( TextAlignment  alignment)

◆ SetZ()

void DebugDraw::SetZ ( const float  z)

Set the Z coordinate.

Parameters
[in]zThe Z coordinate.

◆ Text() [1/2]

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.

Parameters
[in]xLeft position of the text in the screen.
[in]yLeft position of the text in the screen.
[in]textThe text to write.

◆ Text() [2/2]

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.

Parameters
[in]pointTop left point of the screen where the text will be written.
[in]xText width.
[in]yText height.
[in]textThe text to write.

◆ Triangle3d()

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.

Parameters
[in]point1A triangle vertex point.
[in]point2A triangle vertex point.
[in]point3A triangle vertex point.

Member Data Documentation

◆ colour_

Ogre::ColourValue DebugDraw::colour_
private

Color for the debug object or text.

◆ fade_end_square_

float DebugDraw::fade_end_square_
private

For text fading.

The text fully fades at this distance.

◆ fade_start_square_

float DebugDraw::fade_start_square_
private

For text fading.

The text start fading from this distance.

◆ font_

Ogre::FontPtr DebugDraw::font_
private

Font to use for debug text.

◆ font_height_

int DebugDraw::font_height_
private

Font height for the debug text.

◆ line_3d_max_vertex_

unsigned int DebugDraw::line_3d_max_vertex_
private

Maximum number of vertices for debug 3D lines.

◆ line_3d_render_operation_

Ogre::RenderOperation DebugDraw::line_3d_render_operation_
private

A 3D line render operation.

◆ line_3d_vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr DebugDraw::line_3d_vertex_buffer_
private

A 3D line vertex buffer (2 vertices).

◆ line_max_vertex_

unsigned int DebugDraw::line_max_vertex_
private

Maximum number of vertices for debug 2D lines.

◆ line_render_operation_

Ogre::RenderOperation DebugDraw::line_render_operation_
private

A 2D line render operation.

◆ line_vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr DebugDraw::line_vertex_buffer_
private

A 2D line vertex buffer (2 vertices).

◆ material_

Ogre::MaterialPtr DebugDraw::material_
private

Material for a 2D object.

◆ material_3d_

Ogre::MaterialPtr DebugDraw::material_3d_
private

Material for a 3D object.

◆ quad_max_vertex_

unsigned int DebugDraw::quad_max_vertex_
private

Maximum number of vertices for debug quads.

◆ quad_render_operation_

Ogre::RenderOperation DebugDraw::quad_render_operation_
private

A quad render operation.

◆ quad_vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr DebugDraw::quad_vertex_buffer_
private

A quad vertex buffer (4 vertices).

◆ render_system_

Ogre::RenderSystem* DebugDraw::render_system_
private

The render system.

◆ scene_manager_

Ogre::SceneManager* DebugDraw::scene_manager_
private

The scene manager.

◆ screen_space_

bool DebugDraw::screen_space_
private

The screen space.

◆ text_alignment_

TextAlignment DebugDraw::text_alignment_
private

Alignment for debug text.

◆ text_max_vertex_

unsigned int DebugDraw::text_max_vertex_
private

Maximum number of vertices for debug text.

Todo:
Confirm if it's 6 vertices per letter.

◆ text_render_operation_

Ogre::RenderOperation DebugDraw::text_render_operation_
private

A text render operation.

◆ text_vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr DebugDraw::text_vertex_buffer_
private

A text vertex buffer.

Todo:
Confirm if it's 6 vertices per letter.

◆ triangle_3d_max_vertex_

unsigned int DebugDraw::triangle_3d_max_vertex_
private

Maximum number of vertices for debug 3D triangles.

◆ triangle_3d_render_operation_

Ogre::RenderOperation DebugDraw::triangle_3d_render_operation_
private

A 3D triangle render operation.

◆ triangle_3d_vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr DebugDraw::triangle_3d_vertex_buffer_
private

A 3D triangle vertex buffer (3 vertices).

◆ z_coordinate_

float DebugDraw::z_coordinate_
private

Z coordinate for the debug object.


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