#include <LoaderGlue.h>
Inheritance diagram for random_racer::LoaderGlue:

Public Member Functions | |
| LoaderGlue (VRS::SO< vrsode::CollisionBody > collisionBody, VRS::SO< TerrainLoader > loader, float boxSize, float centerDiff, VRS::Vector position=VRS::Vector(0, 0, 0), VRS::SO< ItemDistributor > itemDistributor=NULL) | |
| Ctor. | |
| virtual | ~LoaderGlue () |
| Dtor. | |
| void | collisionCallback (unsigned int planeId) |
| Gets called if a new collsion happens, this relocates the planes around a calculated new center point and calls replaceTerrain() of the TerrainLoader. | |
| void | registerPlanes (VRS::SO< ReloadPlane > *planeArray) |
| Attaches the LoaderGlue to the 4 given ReloadPlanes, sets their normals according to their position in the array and then moves them to their initial position around the car. | |
| VRS::SO< VRS::Callback1< unsigned int > > | getCallback () |
| Returns the callback object which should get connected to the ReloadPlanes. | |
| void | checkForCollisions () |
| Checks all 4 planes if one of them collided. | |
Private Member Functions | |
| void | relocatePlanesAround (double x, double y) |
| Moves the 4 ReloadPlanes to a new position so that the Car again is in the center of a box. | |
Private Attributes | |
| VRS::SO< VRS::Callback1< unsigned int > > | m_callback |
| VRS::Vector | m_position |
| VRS::SO< ReloadPlane > | m_planes [4] |
| VRS::SO< vrsode::CollisionBody > | m_carBody |
| VRS::SO< TerrainLoader > | m_loader |
| VRS::SO< ItemDistributor > | m_itemDistributor |
| float | m_halfBoxSize |
| float | m_centerDiff |
Classes | |
| struct | Point |
| Just used internaly for calculating the nearest center points. More... | |
Definition at line 24 of file LoaderGlue.h.
| random_racer::LoaderGlue::LoaderGlue | ( | VRS::SO< vrsode::CollisionBody > | collisionBody, | |
| VRS::SO< TerrainLoader > | loader, | |||
| float | boxSize, | |||
| float | centerDiff, | |||
| VRS::Vector | position = VRS::Vector(0, 0, 0), |
|||
| VRS::SO< ItemDistributor > | itemDistributor = NULL | |||
| ) |
Ctor.
| collisionBody | This 'is' the Car and we use its poistion to see where the car currently is at to calculate the new planes. | |
| loader | The TerrainLoader we tell to replaceTerrain() every time collisionCallback() is called after relocating the planes. | |
| boxSize | How big the effective box is which the 4 ReloadPlanes build. | |
| centerDiff | How far away the center points the of the 8 possible next plane locations are from the current center point, setting this to values which are bigger than boxSize / 2.0 makes reloading more efficient because it does happen less often. | |
| position | Is currently semi-unused. | |
| itemDistributor | this object distributes collectable items in in our world. |
| random_racer::LoaderGlue::~LoaderGlue | ( | ) | [virtual] |
| void random_racer::LoaderGlue::relocatePlanesAround | ( | double | x, | |
| double | y | |||
| ) | [private] |
Moves the 4 ReloadPlanes to a new position so that the Car again is in the center of a box.
Definition at line 142 of file LoaderGlue.cpp.
References m_halfBoxSize, and m_planes.
Referenced by collisionCallback().
Here is the caller graph for this function:

| void random_racer::LoaderGlue::collisionCallback | ( | unsigned int | planeId | ) |
Gets called if a new collsion happens, this relocates the planes around a calculated new center point and calls replaceTerrain() of the TerrainLoader.
Definition at line 48 of file LoaderGlue.cpp.
References m_carBody, m_centerDiff, m_itemDistributor, m_loader, m_position, random_racer::TerrainLoader::nearestIndex(), relocatePlanesAround(), random_racer::LoaderGlue::Point::x, and random_racer::LoaderGlue::Point::y.
Here is the call graph for this function:

| void random_racer::LoaderGlue::registerPlanes | ( | VRS::SO< ReloadPlane > * | planeArray | ) |
Attaches the LoaderGlue to the 4 given ReloadPlanes, sets their normals according to their position in the array and then moves them to their initial position around the car.
| planeArray | A C-Array containing 4 SOs of ReloadPlanes. |
| VRS::SO<VRS::Callback1<unsigned int> > random_racer::LoaderGlue::getCallback | ( | ) | [inline] |
Returns the callback object which should get connected to the ReloadPlanes.
Definition at line 107 of file LoaderGlue.h.
References m_callback.
| void random_racer::LoaderGlue::checkForCollisions | ( | ) |
Checks all 4 planes if one of them collided.
Definition at line 153 of file LoaderGlue.cpp.
References m_planes.
VRS::SO<VRS::Callback1<unsigned int> > random_racer::LoaderGlue::m_callback [private] |
VRS::Vector random_racer::LoaderGlue::m_position [private] |
VRS::SO<ReloadPlane> random_racer::LoaderGlue::m_planes[4] [private] |
Definition at line 37 of file LoaderGlue.h.
Referenced by checkForCollisions(), and relocatePlanesAround().
VRS::SO<vrsode::CollisionBody> random_racer::LoaderGlue::m_carBody [private] |
VRS::SO<TerrainLoader> random_racer::LoaderGlue::m_loader [private] |
VRS::SO<ItemDistributor> random_racer::LoaderGlue::m_itemDistributor [private] |
float random_racer::LoaderGlue::m_halfBoxSize [private] |
float random_racer::LoaderGlue::m_centerDiff [private] |
1.5.1