flimEngine
Terrain

Terrains can create models from heightmap textures loaded by the user and offer support methods for common terrain calculations. More...

Collaboration diagram for Terrain:

Classes

class  FlimTerrain
 A flim terrain. More...
 
class  TerrainManager
 Manager for terrains. More...
 

Functions

 FlimTerrain::FlimTerrain (const char *heightmapFile, const char *texturePath, float _sideLength, float _maxHeight, float _zeroAltitude, float U, float V)
 Constructor. More...
 
errcode FlimTerrain::ShowNearestCell (const Vect &pos)
 Shows the nearest cell. More...
 
CollisionVolumeAABB FlimTerrain::FindNearestCell (const Vect &pos)
 Searches for the nearest cell. More...
 
errcode FlimTerrain::ShowExactPosition (const Vect &pos)
 Shows the exact position. More...
 
Vect FlimTerrain::GetNormalizedPosition (const Vect &pos)
 Gets normalized position. More...
 
errcode FlimTerrain::GetExactPosition (const Vect &pos, Vect &output)
 Gets exact position. More...
 
errcode FlimTerrain::FindNormalUnderPosition (const Vect &pos, Vect &output)
 Searches for the first normal under position. More...
 
errcode FlimTerrain::ShowNearestCells (const Collidable &coll)
 Shows the nearest cells. More...
 
float FlimTerrain::getCellDimension () const
 Gets cell dimension. More...
 
static errcode TerrainManager::LoadTerrain (std::string key, const char *heightMapPath, const char *texturePath="grid", float _sideLength=100.0f, float _maxHeight=10.0f, float _zeroAltitude=0.0f, float U=30.0f, float V=30.0f)
 Loads a Terrain. More...
 
static errcode TerrainManager::GetTerrain (FlimTerrain *&output, std::string key)
 Gets a terrain. More...
 
static errcode TerrainManager::UnloadTerrains ()
 Unload Terrains. More...
 

Detailed Description

Terrains can create models from heightmap textures loaded by the user and offer support methods for common terrain calculations.

Function Documentation

◆ FindNearestCell()

CollisionVolumeAABB FlimTerrain::FindNearestCell ( const Vect &  pos)

Searches for the nearest cell.

Author
Jack Campbell
Date
6/1/2017
Parameters
posThe position.
Returns
The found cell.

◆ FindNormalUnderPosition()

errcode FlimTerrain::FindNormalUnderPosition ( const Vect &  pos,
Vect &  output 
)

Searches for the first normal under position.

Author
Jack Campbell
Date
6/1/2017
Parameters
posThe position.
[in,out]outputThe output.
Returns
The found normal under position.

◆ FlimTerrain()

FlimTerrain::FlimTerrain ( const char *  heightmapFile,
const char *  texturePath = "grid",
float  _sideLength = 100.0f,
float  _maxHeight = 10.0f,
float  _zeroAltitude = 0.0f,
float  U = 30.0f,
float  V = 30.0f 
)

Constructor.

Author
Jack Campbell
Date
6/1/2017
Parameters
heightmapFileThe heightmap file.
texturePathFull pathname of the texture file.
_sideLengthLength of the side.
_maxHeightThe maximum height.
_zeroAltitudeThe zero altitude.
UThe float to process.
VThe float to process.

◆ getCellDimension()

float FlimTerrain::getCellDimension ( ) const
inline

Gets cell dimension.

Author
Jack Campbell
Date
6/1/2017
Returns
The cell dimension.

◆ GetExactPosition()

errcode FlimTerrain::GetExactPosition ( const Vect &  pos,
Vect &  output 
)

Gets exact position.

Author
Jack Campbell
Date
6/1/2017
Parameters
posThe position.
[in,out]outputThe output.
Returns
The exact position.

◆ GetNormalizedPosition()

Vect FlimTerrain::GetNormalizedPosition ( const Vect &  pos)

Gets normalized position.

Author
Jack Campbell
Date
6/1/2017
Parameters
posThe position.
Returns
The normalized position.

◆ GetTerrain()

static errcode TerrainManager::GetTerrain ( FlimTerrain *&  output,
std::string  key 
)
inlinestatic

Gets a terrain.

Author
Jack Campbell
Date
6/1/2017
Parameters
[in,out]output[in,out] If non-null, the output.
keyThe key.
Returns
The terrain.

◆ LoadTerrain()

static Terrain & TerrainManager::LoadTerrain ( std::string  key,
const char *  heightMapPath,
const char *  texturePath = "grid",
float  _sideLength = 100.0f,
float  _maxHeight = 10.0f,
float  _zeroAltitude = 0.0f,
float  U = 30.0f,
float  V = 30.0f 
)
inlinestatic

Loads a Terrain.

Author
Jack Campbell
Date
3/5/2017
Parameters
keyThe key.
pathFull pathname of the file.
Returns
The Terrain.

◆ ShowExactPosition()

errcode FlimTerrain::ShowExactPosition ( const Vect &  pos)

Shows the exact position.

Author
Jack Campbell
Date
6/1/2017
Parameters
posThe position.
Returns
An errcode.

◆ ShowNearestCell()

errcode FlimTerrain::ShowNearestCell ( const Vect &  pos)

Shows the nearest cell.

Author
Jack Campbell
Date
6/1/2017
Parameters
posThe position.
Returns
An errcode.

◆ ShowNearestCells()

errcode FlimTerrain::ShowNearestCells ( const Collidable coll)

Shows the nearest cells.

Author
Jack Campbell
Date
6/1/2017
Parameters
collThe collection.
Returns
An errcode.

◆ UnloadTerrains()

static errcode TerrainManager::UnloadTerrains ( )
inlinestatic

Unload Terrains.

Author
Jack Campbell
Date
3/5/2017
Returns
An errcode.