SuperTuxKart
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ShowCurve Class Reference

This class is used for debugging. More...

#include <show_curve.hpp>

Inheritance diagram for ShowCurve:
Inheritance graph
[legend]

Public Member Functions

 ShowCurve (float width, float height, const irr::video::SColor &color=irr::video::SColor(77, 0, 179, 0))
 ShowCurve constructor. More...
 
 ~ShowCurve ()
 The destructor removes this scene node and frees the mesh. More...
 
void addPoint (const Vec3 &pnt)
 Adds a point to the curve ('tunnel'). More...
 
void makeCircle (const Vec3 &center, float radius)
 Makes this curve to show a circle with given center point and radius. More...
 
void update (float dt)
 
void setVisible (bool v)
 Makes this scene node visible or not.
 
bool isVisible () const
 
void setPosition (const Vec3 &xyz)
 Sets the origin of this scene node.
 
void setHeading (float heading)
 Sets the heading for the curve. More...
 
void clear ()
 

Private Member Functions

 LEAK_CHECK ()
 

Private Attributes

std::shared_ptr< SP::SPDynamicDrawCallm_dy_dc
 The mesh of the curve. More...
 
float m_width
 The width of the graph when it is displayed. More...
 
float m_height
 The height of the graph when it is displayed. More...
 
irr::video::SColor m_color
 The color to use for the curve. More...
 
std::array< irr::video::S3DVertexSkinnedMesh, 4 > m_current_vertices
 
std::array< irr::video::S3DVertexSkinnedMesh, 4 > m_previous_vertices
 
bool m_first_vertices
 
bool m_visible
 

Detailed Description

This class is used for debugging.

It allows to show an arbitrary curve in the race. The curve is shown as a 'tunnel', i.e. in the constructor you can specify the width and height of this tunnel. Each point then adds 4 vertices: point + (+- width/2, +- height2, 0). That's not exact (if the curve is not parallel to the z axis), but good enough for debugging.

Constructor & Destructor Documentation

◆ ShowCurve()

ShowCurve::ShowCurve ( float  width,
float  height,
const irr::video::SColor &  color = irr::video::SColor(77, 0, 179, 0) 
)

ShowCurve constructor.

It just creates an empty dynamic draw call.

◆ ~ShowCurve()

ShowCurve::~ShowCurve ( )

The destructor removes this scene node and frees the mesh.

Member Function Documentation

◆ addPoint()

void ShowCurve::addPoint ( const Vec3 pnt)

Adds a point to the curve ('tunnel').

This adds 4 vertices, and it creates the triangles to connect it to the previous point.

Parameters
pntThe new point to add.

◆ makeCircle()

void ShowCurve::makeCircle ( const Vec3 center,
float  radius 
)

Makes this curve to show a circle with given center point and radius.

Parameters
centerCenter point of the circle.
radiusRadius of the circle.

◆ setHeading()

void ShowCurve::setHeading ( float  heading)

Sets the heading for the curve.

Parameters
headingThe heading (in rad).

Member Data Documentation

◆ m_color

irr::video::SColor ShowCurve::m_color
private

The color to use for the curve.

◆ m_dy_dc

std::shared_ptr<SP::SPDynamicDrawCall> ShowCurve::m_dy_dc
private

The mesh of the curve.

◆ m_height

float ShowCurve::m_height
private

The height of the graph when it is displayed.

◆ m_width

float ShowCurve::m_width
private

The width of the graph when it is displayed.


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