SuperTuxKart
|
This implements the referee, a character that is displayed at the start of the race holding a 'ready-set-go' traffic light (or so). More...
#include <referee.hpp>
Public Member Functions | |
Referee () | |
Creates an instance of the referee, using the static values to initialise it. | |
Referee (const AbstractKart &kart) | |
Creates an instance of the referee, using the static values to initialise it. | |
void | selectReadySetGo (int rsg) |
Selects one of the states 'ready', 'set', or 'go' to be displayed by the referee. | |
void | attachToSceneNode () |
Make sure that this referee is attached to the scene graph. | |
void | removeFromSceneGraph () |
Removes the referee's scene node from the scene graph, but still keeps the scene node in memory. | |
scene::IAnimatedMeshSceneNode * | getSceneNode () |
Returns the scene node of this referee. | |
void | setPosition (const Vec3 &xyz) |
Moves the referee to the specified position. | |
void | setRotation (const Vec3 &hpr) |
Sets the rotation of the scene node (in degrees). | |
bool | isAttached () const |
Returns true if this referee is attached to the scene graph. | |
void | setAnimationFrameWithCreatedTicks (int created_ticks) |
Set the referee animation frame with created ticks of RescueAnimation, so that it's synchronized with world ticks, and can be rewound easily. | |
Static Public Member Functions | |
static void | init () |
Loads the static mesh. | |
static void | cleanup () |
Frees the static mesh. | |
static const Vec3 & | getStartOffset () |
Returns the graphical offset the referee should be drawn at at the start of a race. | |
static const Vec3 & | getStartRotation () |
Returns the rotation of the mesh so that it faces the kart (when applied to a kart with heading 0). | |
static const float | getHeight () |
Returns the height of the referee. | |
Private Attributes | |
scene::IAnimatedMeshSceneNode * | m_scene_node |
The scene node for an instance of the referee. | |
scene::ISceneNode * | m_light |
Static Private Attributes | |
static scene::IAnimatedMesh * | m_st_referee_mesh = NULL |
The static mesh, which is loaded from a static function and shared between all instances. | |
static video::ITexture * | m_st_traffic_lights [3] |
The three textures to use for ready, set, go. | |
static int | m_st_traffic_buffer = -1 |
Which mesh buffer to use to show the traffic light texture. | |
static int | m_st_first_start_frame = 1 |
Start frame of start animation. | |
static int | m_st_last_start_frame = 1 |
End frame of start animation. | |
static int | m_st_first_rescue_frame = 1 |
Start frame of rescue animation. | |
static int | m_st_last_rescue_frame = 1 |
End frame of rescue animation. | |
static Vec3 | m_st_start_offset = Vec3(-2, 2, 2) |
The position the referee should be shown relative to the kart when starting the race. | |
static Vec3 | m_st_scale = Vec3(1, 1, 1) |
Scaling to be applied to the referee. | |
static Vec3 | m_st_start_rotation = Vec3(0, 180, 0) |
A rotation to be applied to the referee before displaying it. | |
static float | m_height = 0.0f |
This implements the referee, a character that is displayed at the start of the race holding a 'ready-set-go' traffic light (or so).
It contains various static functions and variables which are used to store the original mesh, offsets, rotation, ... of the referee. Each instance of Referee then has a scene node where the referee is shown. One instance of this object is used to display the referee for all(!) karts, i.e. the scene node is moved and rotated before rendering the view for each of the cameras. This reduces rendering effect somewhat, and helps making the startup less crowded.
Referee::Referee | ( | ) |
Creates an instance of the referee, using the static values to initialise it.
This is the constructor used when a start referee is needed.
Referee::Referee | ( | const AbstractKart & | kart | ) |
Creates an instance of the referee, using the static values to initialise it.
This is the constructor used when a rescue referee is needed.
kart | The kart which the referee should rescue. |
void Referee::attachToSceneNode | ( | ) |
Make sure that this referee is attached to the scene graph.
This is used for the start referee, which is removed from scene graph once the ready- set-go phase is over (it is kept in case of a restart of the race).
void Referee::removeFromSceneGraph | ( | ) |
Removes the referee's scene node from the scene graph, but still keeps the scene node in memory.
This is used for the start referee, so that it is quickly available in case of a restart.
void Referee::selectReadySetGo | ( | int | rsg | ) |
Selects one of the states 'ready', 'set', or 'go' to be displayed by the referee.
rsg | 0=ready, 1=set, 2=go. |
void Referee::setRotation | ( | const Vec3 & | hpr | ) |
Sets the rotation of the scene node (in degrees).
hpr | Rotation in degrees. |