Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Private Attributes
SkidMark::SkidMarkPos Class Reference

List of all members.

Public Member Functions

 SkidMarkPos ()
 SkidMarkPos (ssgVertexArray *vertices, ssgNormalArray *normals, ssgColourArray *colors, float global_track_offset)
 ~SkidMarkPos ()
void recalcBSphere ()
void add (const sgCoord &coord, float angle, float length)
void addEnd (const sgCoord &coord)

Private Attributes

float m_track_offset

Detailed Description

Definition at line 44 of file skid_mark.hpp.


Constructor & Destructor Documentation

Definition at line 134 of file skid_mark.cpp.

                                 : ssgVtxTable ( GL_QUAD_STRIP,
                new ssgVertexArray,
                new ssgNormalArray,
                new ssgTexCoordArray,
                new ssgColourArray )
{}   // SkidMarkPos
SkidMark::SkidMarkPos::SkidMarkPos ( ssgVertexArray *  vertices,
ssgNormalArray *  normals,
ssgColourArray *  colors,
float  global_track_offset 
)

Definition at line 142 of file skid_mark.cpp.

                                                               :
        ssgVtxTable ( GL_QUAD_STRIP,
                      vertices,
                      normals,
                      new ssgTexCoordArray,
                      colors )
{
    m_track_offset = global_track_offset;
}   // SkidMarkPos

Definition at line 156 of file skid_mark.cpp.

{}   // ~SkidMarkPos

Member Function Documentation

void SkidMark::SkidMarkPos::add ( const sgCoord &  coord,
float  angle,
float  length 
)

Definition at line 167 of file skid_mark.cpp.

{
    sgCoord coord(kart_coord);

    coord.xyz[0] += length *  sgSin(kart_coord.hpr[0] + angle);
    coord.xyz[1] += length * -sgCos(kart_coord.hpr[0] + angle);


    // Width of the skidmark
    const float WIDTH = 0.1f;

    static float a = 1.0f;
    sgVec3 pos;
    sgSetVec3(pos,
              coord.xyz[0] + sgSin(coord.hpr[0]+a*90) * WIDTH,
              coord.xyz[1] - sgCos(coord.hpr[0]+a*90) * WIDTH,
              coord.xyz[2] + m_track_offset);
    vertices->add(pos);

    sgSetVec3(pos,
              coord.xyz[0] + sgSin(coord.hpr[0]-a*90) * WIDTH,
              coord.xyz[1] - sgCos(coord.hpr[0]-a*90) * WIDTH,
              coord.xyz[2] + m_track_offset);
    vertices->add(pos);
    a = (a > 0.0f ? -1.0f : 1.0f);

    sgVec3 norm;
    sgSetVec3(norm, 0, 0, 1);
    normals->add(norm); normals->add(norm);

    sgVec4 color;
    sgSetVec4(color, 0.07f, 0.07f, 0.07f, 0.8f);
    colours->add(color); colours->add(color);
    this->dirtyBSphere();
}   // add
void SkidMark::SkidMarkPos::addEnd ( const sgCoord &  coord)

Definition at line 204 of file skid_mark.cpp.

{
    // Width of the skidmark
    const float width = 0.1f;

    sgVec3 pos;
    sgSetVec3(pos,
              coord.xyz[0] + sgSin(coord.hpr[0]-90) * width,
              coord.xyz[1] - sgCos(coord.hpr[0]-90) * width,
              coord.xyz[2] + m_track_offset);
    vertices->add(pos);

    sgSetVec3(pos,
              coord.xyz[0] + sgSin(coord.hpr[0]+90) * width,
              coord.xyz[1] - sgCos(coord.hpr[0]+90) * width,
              coord.xyz[2] + m_track_offset);
    vertices->add(pos);

    sgVec3 norm;
    sgSetVec3(norm, 0, 0, 1);
    normals->add(norm); normals->add(norm);

    sgVec4 color;
    sgSetVec4(color, 0.15f, 0.15f, 0.15f, 0.0f);
    colours->add(color); colours->add(color);
    makeDList();
}   // addEnd

Definition at line 160 of file skid_mark.cpp.

{
    bsphere . setRadius ( 1000.0f ) ;
    bsphere . setCenter ( 0, 0, 0 ) ;
}   // recalcBSphere

Member Data Documentation

Definition at line 59 of file skid_mark.hpp.


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