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

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. More...
 
 Referee (const AbstractKart &kart)
 Creates an instance of the referee, using the static values to initialise it. More...
 
void selectReadySetGo (int rsg)
 Selects one of the states 'ready', 'set', or 'go' to be displayed by the referee. More...
 
void attachToSceneNode ()
 Make sure that this referee is attached to the scene graph. More...
 
void removeFromSceneGraph ()
 Removes the referee's scene node from the scene graph, but still keeps the scene node in memory. More...
 
scene::IAnimatedMeshSceneNode * getSceneNode ()
 Returns the scene node of this referee. More...
 
void setPosition (const Vec3 &xyz)
 Moves the referee to the specified position. More...
 
void setRotation (const Vec3 &hpr)
 Sets the rotation of the scene node (in degrees). More...
 
bool isAttached () const
 Returns true if this referee is attached to the scene graph. More...
 
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 Vec3getStartOffset ()
 Returns the graphical offset the referee should be drawn at at the start of a race. More...
 
static const Vec3getStartRotation ()
 Returns the rotation of the mesh so that it faces the kart (when applied to a kart with heading 0). More...
 
static const float getHeight ()
 Returns the height of the referee. More...
 

Private Attributes

scene::IAnimatedMeshSceneNode * m_scene_node
 The scene node for an instance of the referee. More...
 
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. More...
 
static video::ITexture * m_st_traffic_lights [3]
 The three textures to use for ready, set, go. More...
 
static int m_st_traffic_buffer = -1
 Which mesh buffer to use to show the traffic light texture. More...
 
static int m_st_first_start_frame = 1
 Start frame of start animation. More...
 
static int m_st_last_start_frame = 1
 End frame of start animation. More...
 
static int m_st_first_rescue_frame = 1
 Start frame of rescue animation. More...
 
static int m_st_last_rescue_frame = 1
 End frame of rescue animation. More...
 
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. More...
 
static Vec3 m_st_scale = Vec3(1, 1, 1)
 Scaling to be applied to the referee. More...
 
static Vec3 m_st_start_rotation = Vec3(0, 180, 0)
 A rotation to be applied to the referee before displaying it. More...
 
static float m_height = 0.0f
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Referee() [1/2]

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() [2/2]

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.

Parameters
kartThe kart which the referee should rescue.

Member Function Documentation

◆ attachToSceneNode()

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

◆ getHeight()

static const float Referee::getHeight ( )
inlinestatic

Returns the height of the referee.

◆ getSceneNode()

scene::IAnimatedMeshSceneNode* Referee::getSceneNode ( )
inline

Returns the scene node of this referee.

◆ getStartOffset()

static const Vec3& Referee::getStartOffset ( )
inlinestatic

Returns the graphical offset the referee should be drawn at at the start of a race.

◆ getStartRotation()

static const Vec3& Referee::getStartRotation ( )
inlinestatic

Returns the rotation of the mesh so that it faces the kart (when applied to a kart with heading 0).

◆ isAttached()

bool Referee::isAttached ( ) const
inline

Returns true if this referee is attached to the scene graph.

◆ removeFromSceneGraph()

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.

◆ selectReadySetGo()

void Referee::selectReadySetGo ( int  rsg)

Selects one of the states 'ready', 'set', or 'go' to be displayed by the referee.

Parameters
rsg0=ready, 1=set, 2=go.

◆ setPosition()

void Referee::setPosition ( const Vec3 xyz)
inline

Moves the referee to the specified position.

◆ setRotation()

void Referee::setRotation ( const Vec3 hpr)
inline

Sets the rotation of the scene node (in degrees).

Parameters
hprRotation in degrees.

Member Data Documentation

◆ m_scene_node

scene::IAnimatedMeshSceneNode* Referee::m_scene_node
private

The scene node for an instance of the referee.

◆ m_st_first_rescue_frame

int Referee::m_st_first_rescue_frame = 1
staticprivate

Start frame of rescue animation.

◆ m_st_first_start_frame

int Referee::m_st_first_start_frame = 1
staticprivate

Start frame of start animation.

◆ m_st_last_rescue_frame

int Referee::m_st_last_rescue_frame = 1
staticprivate

End frame of rescue animation.

◆ m_st_last_start_frame

int Referee::m_st_last_start_frame = 1
staticprivate

End frame of start animation.

◆ m_st_referee_mesh

scene::IAnimatedMesh * Referee::m_st_referee_mesh = NULL
staticprivate

The static mesh, which is loaded from a static function and shared between all instances.

◆ m_st_scale

Vec3 Referee::m_st_scale = Vec3(1, 1, 1)
staticprivate

Scaling to be applied to the referee.

◆ m_st_start_offset

Vec3 Referee::m_st_start_offset = Vec3(-2, 2, 2)
staticprivate

The position the referee should be shown relative to the kart when starting the race.

◆ m_st_start_rotation

Vec3 Referee::m_st_start_rotation = Vec3(0, 180, 0)
staticprivate

A rotation to be applied to the referee before displaying it.

◆ m_st_traffic_buffer

int Referee::m_st_traffic_buffer = -1
staticprivate

Which mesh buffer to use to show the traffic light texture.

◆ m_st_traffic_lights

video::ITexture* Referee::m_st_traffic_lights[3]
staticprivate

The three textures to use for ready, set, go.


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