Track::Track Class Reference

A playable stage. More...

#include <Track.h>

List of all members.

Public Member Functions

 Track (std::istream &stream, const Theme &theme, bool editor=false)
 Intialise by loading data from a stream, sharing an already loaded theme.
 Track (const Theme &theme, bool editor=false)
 Make an empty track.
virtual ~Track ()
const Pathget_path () const
 Get a the path without modification.
Pathget_path ()
 Get the path so it can be changed.
const Themeget_theme () const
boost::shared_ptr< btCollisionShape > get_collision_shape () const
 Return the collision shape for the entire track.
boost::shared_ptr< btCollisionShape > get_floor_shape () const
 Return the collision shape for the part of the track you can drive on.
const MeshFacesget_ai_mesh () const
 Return a mesh of the faces the ai drives on.
const MeshFaces::Graphget_ai_graph () const
 Get a graph showing connections between faces that AI can drive on.
void update_ai_mesh ()
 Recalculate the surface that the AI can drive on, and its connectivity graph.
btScalar get_lap_length () const
 Return the length of the lap.
void set_filename (std::string filename)
 Set the filename to record in replay files.
std::string get_filename () const
 Get the filename previously set by set_filename.
const Lightingget_lighting () const
void set_lighting (const Lighting &lighting)

Protected Member Functions

void scan_theme ()
 In editor mode, scan the meshes in the theme and set them to display wireframe.
void scan_ai_graph ()
 Find position coordinates for the AI mesh.

Protected Attributes

const unsigned int file_version
 The vesion used to load the file.
const Themetheme
 The theme of the track.
Path path
 The path the course follows.
bool editor
 If the track should act like in the editor.
std::string filename
MeshFaces m_ai_mesh
 Mesh used for AI navigation.
MeshFaces::Graph m_ai_graph
 Graph for AI navigation mesh.
btScalar m_lap_length
 Length of shortest path around the track.
Lighting m_lighting
 The lighting setup of the track.

Friends

std::ostream & operator<< (std::ostream &destination, const Track &track)
 write a track to a stream, so it can be loaded with Track(stream)


Detailed Description

A playable stage.

A track has a Track::Theme and Paths to drive on.

Definition at line 34 of file Track.h.


Constructor & Destructor Documentation

Track::Track::Track ( std::istream &  stream,
const Theme theme,
bool  editor = false 
)

Intialise by loading data from a stream, sharing an already loaded theme.

Parameters:
stream The stream to pull data from. It must point to a track. It will be advanced until the end of the track.
theme The theme the track was made for.
editor When set to true, causes the track to act more helpful to the editor. For example, by default tracks are rendered in wireframe.

Track::Track::Track ( const Theme theme,
bool  editor = false 
)

Make an empty track.

virtual Track::Track::~Track (  )  [virtual]


Member Function Documentation

const MeshFaces::Graph& Track::Track::get_ai_graph (  )  const

Get a graph showing connections between faces that AI can drive on.

Call update_ai_mesh() first.

const MeshFaces& Track::Track::get_ai_mesh (  )  const

Return a mesh of the faces the ai drives on.

Faces from different sources that line up will be joined together, allowing the mesh to be used as a navigatable surface. If you have changed the track, the ai mesh does not update automatically. Call update_ai_mesh() to update all references to the ai mesh. Precondition: update_ai_mesh() has been called since the last edit. Postcondition: get_ai_mesh() reflects the surface the AI should consider.

boost::shared_ptr<btCollisionShape> Track::Track::get_collision_shape (  )  const

Return the collision shape for the entire track.

std::string Track::Track::get_filename (  )  const

Get the filename previously set by set_filename.

boost::shared_ptr<btCollisionShape> Track::Track::get_floor_shape (  )  const

Return the collision shape for the part of the track you can drive on.

btScalar Track::Track::get_lap_length (  )  const

Return the length of the lap.

Requires update_ai_mesh() was called since the last change to the track.

const Lighting& Track::Track::get_lighting (  )  const

Path & Track::Track::get_path (  ) 

Get the path so it can be changed.

Definition at line 68 of file Track.cpp.

const Path& Track::Track::get_path (  )  const

Get a the path without modification.

const Theme& Track::Track::get_theme (  )  const

void Track::Track::scan_ai_graph (  )  [protected]

Find position coordinates for the AI mesh.

Requires that m_ai_mesh is up to date, but invalidates m_ai_graph. Abuses u texture coordinate to mean how far through the lap a point is. Also sets the m_lap_length.

void Track::Track::scan_theme (  )  [protected]

In editor mode, scan the meshes in the theme and set them to display wireframe.

void Track::Track::set_filename ( std::string  filename  ) 

Set the filename to record in replay files.

void Track::Track::set_lighting ( const Lighting lighting  ) 

void Track::Track::update_ai_mesh (  ) 

Recalculate the surface that the AI can drive on, and its connectivity graph.


Friends And Related Function Documentation

std::ostream & Track::Track::operator<< ( std::ostream &  destination,
const Track track 
) [friend]

write a track to a stream, so it can be loaded with Track(stream)

Parameters:
destination The stream to write to. If the stream is read back from the position it was in before this function call using
 Track::Track(stream) 
, then the resulting Track will be the same as the one passed in.
track The track to write to a file.
Returns:
The same stream reference as destination, however it will have the track written to it when the function completes.

Definition at line 73 of file Track.cpp.


Member Data Documentation

bool Track::Track::editor [protected]

If the track should act like in the editor.

Definition at line 113 of file Track.h.

const unsigned int Track::Track::file_version [protected]

The vesion used to load the file.

Definition at line 104 of file Track.h.

std::string Track::Track::filename [protected]

Definition at line 127 of file Track.h.

MeshFaces::Graph Track::Track::m_ai_graph [protected]

Graph for AI navigation mesh.

Definition at line 132 of file Track.h.

MeshFaces Track::Track::m_ai_mesh [protected]

Mesh used for AI navigation.

Definition at line 130 of file Track.h.

btScalar Track::Track::m_lap_length [protected]

Length of shortest path around the track.

Definition at line 134 of file Track.h.

Lighting Track::Track::m_lighting [protected]

The lighting setup of the track.

Definition at line 136 of file Track.h.

Path Track::Track::path [protected]

The path the course follows.

Definition at line 110 of file Track.h.

const Theme& Track::Track::theme [protected]

The theme of the track.

Definition at line 107 of file Track.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:19 2010 by Doxygen version 1.4.7 for Racer version svn335.