SuperTuxKart
Loading...
Searching...
No Matches
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.
 
 ~ShowCurve ()
 The destructor removes this scene node and frees the mesh.
 
void addPoint (const Vec3 &pnt)
 Adds a point to the curve ('tunnel').
 
void makeCircle (const Vec3 &center, float radius)
 Makes this curve to show a circle with given center point and radius.
 
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.
 
void clear ()
 

Private Member Functions

 LEAK_CHECK ()
 

Private Attributes

std::shared_ptr< SP::SPDynamicDrawCallm_dy_dc
 The mesh of the curve.
 
float m_width
 The width of the graph when it is displayed.
 
float m_height
 The height of the graph when it is displayed.
 
irr::video::SColor m_color
 The color to use for the curve.
 
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.

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

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