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

This class is responsible for drawing skid marks for a kart. More...

#include <skid_marks.hpp>

Inheritance diagram for SkidMarks:
Inheritance graph
[legend]

Classes

class  SkidMarkQuads
 

Public Member Functions

 SkidMarks (const AbstractKart &kart, float width=0.32f)
 Initialises empty skid marks. More...
 
 ~SkidMarks ()
 Removes all skid marks from the scene graph and frees the state. More...
 
void update (float dt, bool force_skid_marks=false, video::SColor *custom_color=NULL)
 Either adds to an existing skid mark quad, or (if the kart is skidding) starts a new skid mark quad. More...
 
void reset ()
 Removes all skid marks, called when a race is restarted.
 

Private Attributes

const AbstractKartm_kart
 Reference to the kart to which these skidmarks belong. More...
 
bool m_skid_marking
 True if the kart was skidding in the previous frame. More...
 
float m_width
 Reduce effect of Z-fighting. More...
 
Materialm_material
 Material to use for the skid marks. More...
 
std::shared_ptr< SP::SPShaderm_shader
 Shader(alphablend) to use for the skid marks. More...
 
std::vector< std::unique_ptr< SkidMarkQuads > > m_left
 Two skidmark objects for the left and right wheel. More...
 
std::vector< std::unique_ptr< SkidMarkQuads > > m_right
 

Static Private Attributes

static const int m_start_alpha = 200
 Initial alpha value. More...
 
static const int m_start_grey = 32
 Initial grey value, same for the 3 channels. More...
 
static float m_avoid_z_fighting = 0.005f
 Shared static so that consecutive skidmarks are at a slightly different height. More...
 

Detailed Description

This class is responsible for drawing skid marks for a kart.

Constructor & Destructor Documentation

◆ SkidMarks()

SkidMarks::SkidMarks ( const AbstractKart kart,
float  width = 0.32f 
)

Initialises empty skid marks.

◆ ~SkidMarks()

SkidMarks::~SkidMarks ( )

Removes all skid marks from the scene graph and frees the state.

Member Function Documentation

◆ update()

void SkidMarks::update ( float  dt,
bool  force_skid_marks = false,
video::SColor *  custom_color = NULL 
)

Either adds to an existing skid mark quad, or (if the kart is skidding) starts a new skid mark quad.

Parameters
dtTime step.

Member Data Documentation

◆ m_avoid_z_fighting

float SkidMarks::m_avoid_z_fighting = 0.005f
staticprivate

Shared static so that consecutive skidmarks are at a slightly different height.

◆ m_kart

const AbstractKart& SkidMarks::m_kart
private

Reference to the kart to which these skidmarks belong.

◆ m_left

std::vector<std::unique_ptr<SkidMarkQuads> > SkidMarks::m_left
private

Two skidmark objects for the left and right wheel.

◆ m_material

Material* SkidMarks::m_material
private

Material to use for the skid marks.

◆ m_shader

std::shared_ptr<SP::SPShader> SkidMarks::m_shader
private

Shader(alphablend) to use for the skid marks.

◆ m_skid_marking

bool SkidMarks::m_skid_marking
private

True if the kart was skidding in the previous frame.

◆ m_start_alpha

const int SkidMarks::m_start_alpha = 200
staticprivate

Initial alpha value.

◆ m_start_grey

const int SkidMarks::m_start_grey = 32
staticprivate

Initial grey value, same for the 3 channels.

◆ m_width

float SkidMarks::m_width
private

Reduce effect of Z-fighting.


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