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

Public Member Functions | |
| VRSTerrainLoader (VRS::SO< VRS::SceneThing > thing, VRS::SO< ControlPointContainer > container, double boxSize, double viewSize) | |
| Ctor, for the other params see TerrainLoader::TerrainLoader(). | |
| virtual | ~VRSTerrainLoader () |
| Dtor, clears m_thing and terminate()s the worker thread. | |
| virtual void | replaceTerrain (const VRS::Vector &position, const VRS::Vector ¢er) |
| Fetches the best matching terrain from m_terrainCache, generates, normals, etc, updates the tranlation and updates the meshs vertices with those from the cache. | |
| void | beautifyMesh () |
| Recalculates normals, colors and texture coordinates for m_mesh and calls our MeshBeautifier to do its job. | |
| VRS::SO< VRS::Mesh > | mesh () |
| returns the contained mesh | |
| VRS::Vector | heightAt (double, double) |
| returns a vector with the height of the terrain filled into y at a certain x z position. | |
| void | terminate () |
| Terminates the worker thread after letting him finish his work. | |
Private Member Functions | |
| int | generate () |
| This is the real method which represents the background- process of this class, returns 1 on success and 0 on error. | |
Static Private Member Functions | |
| static int | workerWrapper (void *self) |
| The function which is run by the worker thread. | |
Private Attributes | |
| SDL_Thread * | m_worker |
| SDL_mutex * | m_controlMutex |
| SDL_mutex * | m_generateWakeMutex |
| SDL_mutex * | m_vertexMutex |
| SDL_cond * | m_replaceWakeCond |
| SDL_cond * | m_generateWakeCond |
| int | m_signalWhenDoneWith |
| bool | m_workerIsWaiting |
| bool | m_terminateWorker |
| VRS::SO< TerrainGenerator > | m_generator |
| Our TerrainGenerator which is used for generating terrains. | |
| TerrainPart | m_terrainCache [4] |
| VRS::SO< VRS::Translation > | m_translation |
| VRS::SO< VRS::Mesh > | m_mesh |
| VRS::SO< VRS::DataIterator< VRS::Vector > > | m_vertexIter |
| VRS::SO< VRS::DataIterator< VRS::Vector > > | m_textureIter |
| VRS::SO< VRS::DataIterator< VRS::Color > > | m_colorIter |
| VRS::SO< MeshBeautifier > | m_beautifier |
Friends | |
| class | ODETerrainLoader |
Classes | |
| struct | TerrainPart |
| Used for storing the 4 most recent TerrainParts. More... | |
The VRSTerrainLoader also encapsulates a worker thread wich uses a TerrainGenerator to generate terrain with the use of the Nurbs.
Definition at line 37 of file VRSTerrainLoader.h.
| random_racer::VRSTerrainLoader::VRSTerrainLoader | ( | VRS::SO< VRS::SceneThing > | thing, | |
| VRS::SO< ControlPointContainer > | container, | |||
| double | boxSize, | |||
| double | viewSize | |||
| ) |
Ctor, for the other params see TerrainLoader::TerrainLoader().
| thing | The SceneThing into which we will load our generated Terrain and the Translation Matrix, so it should be emtpy and not used by somebody else. | |
| container | The ControlPointContainer which we will pass to the TerrainGenerator for generating terrain. |
| random_racer::VRSTerrainLoader::~VRSTerrainLoader | ( | ) | [virtual] |
Dtor, clears m_thing and terminate()s the worker thread.
Definition at line 439 of file VRSTerrainLoader.cpp.
References random_racer::TerrainLoader::m_thing.
| int random_racer::VRSTerrainLoader::workerWrapper | ( | void * | self | ) | [static, private] |
The function which is run by the worker thread.
After being started, this wraps generate() to give the method a this.
| self | This gets casted to TerrainLoader* and is interpreted as "this" for the thread worker. |
Definition at line 248 of file VRSTerrainLoader.cpp.
| int random_racer::VRSTerrainLoader::generate | ( | ) | [private] |
This is the real method which represents the background- process of this class, returns 1 on success and 0 on error.
Definition at line 254 of file VRSTerrainLoader.cpp.
References random_racer::TerrainLoader::m_boxSize, m_controlMutex, m_generateWakeCond, m_generateWakeMutex, random_racer::TerrainLoader::m_position, m_replaceWakeCond, m_signalWhenDoneWith, m_terminateWorker, and m_workerIsWaiting.
| virtual void random_racer::VRSTerrainLoader::replaceTerrain | ( | const VRS::Vector & | position, | |
| const VRS::Vector & | center | |||
| ) | [virtual] |
Fetches the best matching terrain from m_terrainCache, generates, normals, etc, updates the tranlation and updates the meshs vertices with those from the cache.
See TerrainLoader::replaceTerrain() for the params.
Implements random_racer::TerrainLoader.
| void random_racer::VRSTerrainLoader::beautifyMesh | ( | ) |
Recalculates normals, colors and texture coordinates for m_mesh and calls our MeshBeautifier to do its job.
Definition at line 446 of file VRSTerrainLoader.cpp.
References m_beautifier, m_translation, and m_vertexIter.
Referenced by random_racer::MeshBeautifier::terLoadTextureCommand().
Here is the caller graph for this function:

| VRS::SO< VRS::Mesh > random_racer::VRSTerrainLoader::mesh | ( | ) |
| VRS::Vector random_racer::VRSTerrainLoader::heightAt | ( | double | , | |
| double | ||||
| ) |
returns a vector with the height of the terrain filled into y at a certain x z position.
Definition at line 505 of file VRSTerrainLoader.cpp.
References m_translation, and m_vertexIter.
| void random_racer::VRSTerrainLoader::terminate | ( | ) |
Terminates the worker thread after letting him finish his work.
Definition at line 462 of file VRSTerrainLoader.cpp.
References m_controlMutex, m_generateWakeCond, m_generateWakeMutex, m_terminateWorker, m_worker, and m_workerIsWaiting.
friend class ODETerrainLoader [friend] |
Definition at line 40 of file VRSTerrainLoader.h.
SDL_Thread* random_racer::VRSTerrainLoader::m_worker [private] |
SDL_mutex* random_racer::VRSTerrainLoader::m_controlMutex [private] |
SDL_mutex* random_racer::VRSTerrainLoader::m_generateWakeMutex [private] |
SDL_mutex* random_racer::VRSTerrainLoader::m_vertexMutex [private] |
Definition at line 47 of file VRSTerrainLoader.h.
SDL_cond* random_racer::VRSTerrainLoader::m_replaceWakeCond [private] |
SDL_cond* random_racer::VRSTerrainLoader::m_generateWakeCond [private] |
int random_racer::VRSTerrainLoader::m_signalWhenDoneWith [private] |
bool random_racer::VRSTerrainLoader::m_workerIsWaiting [private] |
bool random_racer::VRSTerrainLoader::m_terminateWorker [private] |
VRS::SO<TerrainGenerator> random_racer::VRSTerrainLoader::m_generator [private] |
Our TerrainGenerator which is used for generating terrains.
Definition at line 60 of file VRSTerrainLoader.h.
Definition at line 84 of file VRSTerrainLoader.h.
VRS::SO<VRS::Translation> random_racer::VRSTerrainLoader::m_translation [private] |
VRS::SO<VRS::Mesh> random_racer::VRSTerrainLoader::m_mesh [private] |
Definition at line 87 of file VRSTerrainLoader.h.
VRS::SO<VRS::DataIterator<VRS::Vector> > random_racer::VRSTerrainLoader::m_vertexIter [private] |
VRS::SO<VRS::DataIterator<VRS::Vector> > random_racer::VRSTerrainLoader::m_textureIter [private] |
Definition at line 88 of file VRSTerrainLoader.h.
VRS::SO<VRS::DataIterator<VRS::Color> > random_racer::VRSTerrainLoader::m_colorIter [private] |
Definition at line 89 of file VRSTerrainLoader.h.
VRS::SO<MeshBeautifier> random_racer::VRSTerrainLoader::m_beautifier [private] |
1.5.1