SuperTuxKart
Loading...
Searching...
No Matches
show_curve.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2012-2015 Joerg Henrichs
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_SHOW_CURVE_HPP
20#define HEADER_SHOW_CURVE_HPP
21
22#include "utils/leak_check.hpp"
23#include "utils/no_copy.hpp"
24
25#include <SColor.h>
26#include <S3DVertex.h>
27#include <array>
28#include <memory>
29
30class Vec3;
31
32namespace SP
33{
34 class SPDynamicDrawCall;
35}
36
45class ShowCurve : public NoCopy
46{
47 LEAK_CHECK();
48private:
50 std::shared_ptr<SP::SPDynamicDrawCall> m_dy_dc;
51
53 float m_width;
54
56 float m_height;
57
59 irr::video::SColor m_color;
60
61 std::array<irr:: video::S3DVertexSkinnedMesh, 4>
62 m_current_vertices, m_previous_vertices;
63
64 bool m_first_vertices, m_visible;
65
66public:
67 ShowCurve(float width, float height,
68 const irr::video::SColor &color = irr::video::SColor(77, 0, 179, 0));
69 ~ShowCurve();
70 void addPoint(const Vec3 &pnt);
71 void makeCircle(const Vec3 &center, float radius);
72 void update(float dt);
73 void setVisible(bool v);
74 bool isVisible() const;
75 void setPosition(const Vec3 &xyz);
76 void setHeading(float heading);
77 void clear();
78
79}; // ShowCurve
80#endif
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
This class is used for debugging.
Definition: show_curve.hpp:46
void setHeading(float heading)
Sets the heading for the curve.
Definition: show_curve.cpp:139
~ShowCurve()
The destructor removes this scene node and frees the mesh.
Definition: show_curve.cpp:44
irr::video::SColor m_color
The color to use for the curve.
Definition: show_curve.hpp:59
void makeCircle(const Vec3 &center, float radius)
Makes this curve to show a circle with given center point and radius.
Definition: show_curve.cpp:122
void setVisible(bool v)
Makes this scene node visible or not.
Definition: show_curve.cpp:147
void addPoint(const Vec3 &pnt)
Adds a point to the curve ('tunnel').
Definition: show_curve.cpp:54
void setPosition(const Vec3 &xyz)
Sets the origin of this scene node.
Definition: show_curve.cpp:162
float m_width
The width of the graph when it is displayed.
Definition: show_curve.hpp:53
float m_height
The height of the graph when it is displayed.
Definition: show_curve.hpp:56
std::shared_ptr< SP::SPDynamicDrawCall > m_dy_dc
The mesh of the curve.
Definition: show_curve.hpp:50
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35