My Project
Classes | Public Member Functions | List of all members
ParaTerrain::CDynamicTerrainLoader Class Reference
Inheritance diagram for ParaTerrain::CDynamicTerrainLoader:
ParaTerrain::TerrainLatticeLoader

Public Member Functions

 CDynamicTerrainLoader (const char *sConfigFile)
 fTerrainTileSize: In case a world is extremely large, it can be divided into a matrix of square tiles of a given size, called terrain tile size. More...
 
virtual TerrainLoadTerrainAt (Terrain *pTerrain, int latticeX, int latticeY, bool useGeoMipmap=false)
 Called by the TerrainLattice when a Terrain object in the lattice has entered the visible region and, therefore, needs to be loaded into RAM. More...
 
virtual void UnloadTerrain (int latticeX, int latticeY, Terrain *pTerrain)
 Called by the TerrainLattice when a Terrain object in the lattice is no longer within the visible region and can, therefore, be disposed of, freeing RAM for other visible Terrain objects. More...
 
virtual float GetTerrainWidth ()
 Returns the width in world units of each of the individual Terrain objects in the lattice (they must all be the same width.)
 
virtual float GetTerrainHeight ()
 Returns the height in world units of each of the individual Terrain objects in the lattice (they must all be the same height.)
 
virtual bool UpdateTileConfigFile (int x, int y, const string &sTileConfigFile)
 update the tile config file for the terrain terrain tile x,y. More...
 
virtual bool SaveWorldConfigFile ()
 save world config file to disk. More...
 

Constructor & Destructor Documentation

§ CDynamicTerrainLoader()

CDynamicTerrainLoader::CDynamicTerrainLoader ( const char *  sConfigFile)

fTerrainTileSize: In case a world is extremely large, it can be divided into a matrix of square tiles of a given size, called terrain tile size.

Terrain data can be selectively loaded to the game world. Remember, all world objects are created using the world coordinate system, not the terrain tile's location system. if fWorldSize<=fTerrainTileSize, it is assumed that there is only a single terrain tile in the entire world.

Member Function Documentation

§ LoadTerrainAt()

Terrain * CDynamicTerrainLoader::LoadTerrainAt ( Terrain pTerrain,
int  latticeX,
int  latticeY,
bool  useGeoMipmap = false 
)
virtual

Called by the TerrainLattice when a Terrain object in the lattice has entered the visible region and, therefore, needs to be loaded into RAM.

this function will always return a valid terrain. If there is no terrain data, a default terrain is returned.

Parameters
pTerrainthe terrain object to be filled with data. If it is NULL, a new terrain object will be created.
Returns
: the loaded terrain object is returned.

Implements ParaTerrain::TerrainLatticeLoader.

§ SaveWorldConfigFile()

bool CDynamicTerrainLoader::SaveWorldConfigFile ( )
virtual

save world config file to disk.

Implements ParaTerrain::TerrainLatticeLoader.

§ UnloadTerrain()

void CDynamicTerrainLoader::UnloadTerrain ( int  latticeX,
int  latticeY,
Terrain pTerrain 
)
virtual

Called by the TerrainLattice when a Terrain object in the lattice is no longer within the visible region and can, therefore, be disposed of, freeing RAM for other visible Terrain objects.

Parameters
pTerrainthe terrain object will be reduced a blank terrain after calling this function.

Implements ParaTerrain::TerrainLatticeLoader.

§ UpdateTileConfigFile()

bool CDynamicTerrainLoader::UpdateTileConfigFile ( int  x,
int  y,
const string &  sTileConfigFile 
)
virtual

update the tile config file for the terrain terrain tile x,y.

return true if succeeded. One needs to SaveWorldConfigFile() in order for the changes to be written to disk.

Parameters
sTileConfigFileif "", it will erase the tile. otherwise it will change the config file.

Implements ParaTerrain::TerrainLatticeLoader.


The documentation for this class was generated from the following files: