SuperTuxKart
|
This class is used for debugging. More...
#include <show_curve.hpp>
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 ¢er, 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::SPDynamicDrawCall > | m_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 |
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.
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.
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.
pnt | The new point to add. |
void ShowCurve::makeCircle | ( | const Vec3 & | center, |
float | radius | ||
) |
Makes this curve to show a circle with given center point and radius.
center | Center point of the circle. |
radius | Radius of the circle. |
void ShowCurve::setHeading | ( | float | heading | ) |
Sets the heading for the curve.
heading | The heading (in rad). |