random_racer::TerrainLoader Class Reference

The base class for the 2 TerrainLoader implementations VRSTerrainLoader and ODETerrainLoader. More...

#include <TerrainLoader.h>

Inheritance diagram for random_racer::TerrainLoader:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TerrainLoader (VRS::SO< VRS::SceneThing > thing, double boxSize, double viewSize, const VRS::Vector &initialPosition=VRS::Vector())
 Ctor, creates a new TerrainLoader with its worker thread.
virtual ~TerrainLoader ()
 Dtor, also stops the worker thread (by waiting).
double boxSize ()
 Returns the current box size.
double viewSize ()
 Returns the current view size.
virtual void replaceTerrain (const VRS::Vector &position, const VRS::Vector &center)=0
 A pure-virtual method, usually called from LoaderGlue when a collision with a ReloadPlane happend.

Static Public Member Functions

template<class T>
static unsigned int nearestIndex (double x, double y, T *cache, unsigned int size, bool debug=false)
 This method tells you which cached terrains index is the nearest for a given position.

Protected Attributes

VRS::Vector m_position
 The current position of the car, to that the worker thread knows for where he should calculate things.
double m_boxSize
 See TerrainLoader().
double m_viewSize
 See TerrainLoader().
VRS::SO< VRS::SceneThing > m_thing
 The SceneThing on which the specific TerrainLoader operates.

Detailed Description

The base class for the 2 TerrainLoader implementations VRSTerrainLoader and ODETerrainLoader.

Definition at line 26 of file TerrainLoader.h.


Constructor & Destructor Documentation

random_racer::TerrainLoader::TerrainLoader ( VRS::SO< VRS::SceneThing >  thing,
double  boxSize,
double  viewSize,
const VRS::Vector &  initialPosition = VRS::Vector() 
)

Ctor, creates a new TerrainLoader with its worker thread.

Parameters:
thing The SceneThing which this loader manages, the semantics are a bit different for ODE and VRS, see the specific Ctors for more info.
boxSize The dimensions of the box which says when to reload a new part of the terrain.
viewSize The dimenstions of the really visible terrain (should be more than boxSize).
initialPosition Where the initial position of the car or whatever is to fill the cache with some terrains in the ctor.

random_racer::TerrainLoader::~TerrainLoader (  )  [virtual]

Dtor, also stops the worker thread (by waiting).

Definition at line 29 of file TerrainLoader.cpp.


Member Function Documentation

double random_racer::TerrainLoader::boxSize (  )  [inline]

Returns the current box size.

Definition at line 82 of file TerrainLoader.h.

References m_boxSize.

double random_racer::TerrainLoader::viewSize (  )  [inline]

Returns the current view size.

Definition at line 87 of file TerrainLoader.h.

References m_viewSize.

virtual void random_racer::TerrainLoader::replaceTerrain ( const VRS::Vector &  position,
const VRS::Vector &  center 
) [pure virtual]

A pure-virtual method, usually called from LoaderGlue when a collision with a ReloadPlane happend.

Parameters:
position The new position of the car in our absolute world
center The center of the new collision box so we can calculate good new terrains.

Implemented in random_racer::ODETerrainLoader, and random_racer::VRSTerrainLoader.

template<class T>
static unsigned int random_racer::TerrainLoader::nearestIndex ( double  x,
double  y,
T *  cache,
unsigned int  size,
bool  debug = false 
) [inline, static]

This method tells you which cached terrains index is the nearest for a given position.

Parameters:
x The x coordinates of your position I talked about.
y Well, I hope you can guess this. :>
cache A templated type which acts as the cache in wich we search.
size How much items there are in the cache.

Definition at line 115 of file TerrainLoader.h.

Referenced by random_racer::LoaderGlue::collisionCallback().

Here is the caller graph for this function:


Member Data Documentation

VRS::Vector random_racer::TerrainLoader::m_position [protected]

The current position of the car, to that the worker thread knows for where he should calculate things.

Definition at line 33 of file TerrainLoader.h.

Referenced by random_racer::VRSTerrainLoader::generate().

double random_racer::TerrainLoader::m_boxSize [protected]

See TerrainLoader().

Definition at line 38 of file TerrainLoader.h.

Referenced by boxSize(), and random_racer::VRSTerrainLoader::generate().

double random_racer::TerrainLoader::m_viewSize [protected]

See TerrainLoader().

Definition at line 43 of file TerrainLoader.h.

Referenced by random_racer::ODETerrainLoader::grabVertices(), and viewSize().

VRS::SO<VRS::SceneThing> random_racer::TerrainLoader::m_thing [protected]

The SceneThing on which the specific TerrainLoader operates.

Definition at line 48 of file TerrainLoader.h.

Referenced by random_racer::ODETerrainLoader::~ODETerrainLoader(), and random_racer::VRSTerrainLoader::~VRSTerrainLoader().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:13 2007 for Random Racer by  doxygen 1.5.1