#include <Track.h>
Public Member Functions | |
Track (Ogre::SceneManager *_manager) | |
~Track () | |
Ogre::ManualObject * | getManual () const |
void | setManual (Ogre::ManualObject *_val) |
Ogre::SimpleSpline * | getSpline () const |
void | setSpline (Ogre::SimpleSpline *_val) |
Ogre::SimpleSpline * | getSplineEqualised () const |
void | setSplineEqualised (Ogre::SimpleSpline *_val) |
int | getClosePoints () const |
void | setClosePoints (const int &_val) |
Ogre::Real | getTrackWidth () const |
void | setTrackWidth (const Ogre::Real &_val) |
int | getInterpSteps () const |
Sets the number of interpolation steps between each track segment. | |
void | setInterpSteps (const int &_val) |
Ogre::Real | getInterpAmount () const |
void | equaliseSpline (Ogre::Real _dist=0.0f) |
void | controlObjectMoved () |
Used when a control object is moved. Every time the control object moves, the equalised spline must be recalculated. | |
void | recalc () |
Used to create the control objects so we can interact with the spline directly. | |
void | redraw () |
Draw. This isn't an actual "draw to screen" method, more an "update the model" method. | |
void | closeSpline () |
void | linkClosedSpline () |
After the control objects have been created, we can finally link them together (so they move together). | |
void | buildTrackFromSpline () |
Create the physical track from the spline. | |
void | finalise () |
void | buildIntroTrackType (int _length, Ogre::Real _distBetween, Ogre::Vector3 _startPos, Ogre::Real _distSideways) |
void | createFromFakeTrack (Ogre::Vector3 _startPos, Track *_fakeTrack) |
Turn a "fake" track into a real one. | |
void | startRace () |
Start the "race". | |
void | endRace () |
End the "race". | |
void | updateLapCount () |
Called whenever the player completes a lap. | |
void | updateLapTimes () |
Called to update the lap times if needs be. | |
int | getTotalLaps () |
int | getCurrentLap () |
Ogre::Real | getTotalTime () |
Ogre::Real | getCurrentLapTime () |
Ogre::Real | getBestLapTime () |
void | setTotalLaps (int _val) |
void | setCurrentLap (int _val) |
void | setTotalTime (Ogre::Real _val) |
void | setCurrentLapTime (Ogre::Real _val) |
void | setBestLapTime (Ogre::Real _val) |
bool | move (Ogre::Real _time) |
Hacking into GameObject's move function to some timer-related things. | |
void | informOfContact (TrackPhysicalObject *_val) |
Called when a control object encounters the craft. | |
void | regenerateFakeTrack (int _val) |
Make a fake track for use in the GUI. Doesn't do the physical stages. | |
void | redrawFake () |
Custom redraw function for fake track. | |
Ogre::SceneManager * | getSceneManager () |
void | hideNodes () |
Hide all of the track editing nodes. | |
Protected Member Functions | |
void | setID () |
void | recalcControlObjects () |
void | recalcPhysicalObjects () |
Protected Attributes | |
Ogre::ManualObject * | m_manual |
Ogre::SimpleSpline * | m_spline |
Ogre::SimpleSpline * | m_splineEqualised |
Ogre::Real | m_trackWidth |
Ogre::Real | m_interpAmount |
int | m_interpSteps |
std::vector< TrackControlObject * > | m_controlObjects |
std::vector < TrackPhysicalObject * > | m_controlObjectsEqualised |
std::list< TrackPhysicalObject * > | m_encounters |
int | m_numClosePoints |
float | m_equaliseDistance |
int | m_totalLaps |
int | m_currentLap |
Ogre::Real | m_totalTime |
Ogre::Real | m_currentLapTime |
Ogre::Real | m_bestLapTime |
Ogre::SceneManager * | m_sceneManager |
Static Protected Attributes | |
static int | s_nextID = 0 |
Track. This class contains all of the manipulation and construction methods for the game's track. One thing of note; to get a "decent" looking closed spline, the two points on either side of the start point all must be in line and not too close. We'll make them "lockable" when it comes to track editing (as in, just not making them moveable). We probably want a straight section of track for the finishing line anyway!
Definition at line 28 of file Track.h.
void Track::buildIntroTrackType | ( | int | _length, | |
Ogre::Real | _distBetween, | |||
Ogre::Vector3 | _startPos, | |||
Ogre::Real | _distSideways | |||
) |
void Track::buildTrackFromSpline | ( | ) |
void Track::closeSpline | ( | ) |
void Track::controlObjectMoved | ( | ) |
void Track::createFromFakeTrack | ( | Ogre::Vector3 | _startPos, | |
Track * | _fakeTrack | |||
) |
void Track::equaliseSpline | ( | Ogre::Real | _dist = 0.0f |
) |
Based on http://www.ogre3d.org/wiki/index.php/Equal_Length_Spline and http://www.ogre3d.org/forums/viewtopic.php?p=224334 Used to divide a created/modified spline into arcs of equal length.
void Track::finalise | ( | ) |
int Track::getInterpSteps | ( | ) | const |
Ogre::ManualObject * Track::getManual | ( | ) | const |
Reimplemented from GameObject.
void Track::hideNodes | ( | ) |
void Track::informOfContact | ( | TrackPhysicalObject * | _val | ) |
void Track::linkClosedSpline | ( | ) |
bool Track::move | ( | Ogre::Real | _time | ) | [virtual] |
Hacking into GameObject's move function to some timer-related things.
Reimplemented from GameObject.
void Track::recalc | ( | ) |
void Track::recalcControlObjects | ( | ) | [protected] |
void Track::recalcPhysicalObjects | ( | ) | [protected] |
void Track::redraw | ( | ) |
void Track::redrawFake | ( | ) |
void Track::regenerateFakeTrack | ( | int | _val | ) |
void Track::setID | ( | ) | [protected, virtual] |
Reimplemented from GameObject.
void Track::setManual | ( | Ogre::ManualObject * | _val | ) |
Reimplemented from GameObject.
void Track::setSplineEqualised | ( | Ogre::SimpleSpline * | _val | ) |
void Track::updateLapCount | ( | ) |
void Track::updateLapTimes | ( | ) |
Ogre::Real Track::m_bestLapTime [protected] |
std::vector<TrackControlObject*> Track::m_controlObjects [protected] |
std::vector<TrackPhysicalObject*> Track::m_controlObjectsEqualised [protected] |
int Track::m_currentLap [protected] |
Ogre::Real Track::m_currentLapTime [protected] |
std::list<TrackPhysicalObject*> Track::m_encounters [protected] |
float Track::m_equaliseDistance [protected] |
Ogre::Real Track::m_interpAmount [protected] |
int Track::m_interpSteps [protected] |
Ogre::ManualObject* Track::m_manual [protected] |
Reimplemented from GameObject.
int Track::m_numClosePoints [protected] |
Ogre::SceneManager* Track::m_sceneManager [protected] |
Ogre::SimpleSpline* Track::m_spline [protected] |
Ogre::SimpleSpline* Track::m_splineEqualised [protected] |
int Track::m_totalLaps [protected] |
Ogre::Real Track::m_totalTime [protected] |
Ogre::Real Track::m_trackWidth [protected] |
int Track::s_nextID = 0 [static, protected] |
Reimplemented from GameObject.