#include <ETTerrainManager.h>
Public Member Functions | |
TerrainManager (Ogre::SceneManager *sceneMgr, const std::string &name="ETTerrain") | |
~TerrainManager () | |
void | createTerrain (const TerrainInfo &info, size_t tileSize=33, unsigned int maxLOD=255, bool vertexNormals=false) |
void | destroyTerrain () |
void | setUseLODMorphing (bool lodMorph=true, float startMorphing=0.25f, const std::string &morphParamName="morphFactor") |
void | setLODErrorMargin (unsigned int maxPixelError, unsigned int viewportHeight) |
const TerrainInfo & | getTerrainInfo () const |
void | setMaterial (Ogre::MaterialPtr material) |
const Ogre::MaterialPtr & | getMaterial () const |
void | deform (int x, int z, const Brush &brush, float intensity=1.0f) |
void | setHeights (int x, int z, const Brush &brush) |
void | getHeights (int x, int z, Brush &brush) const |
Private Attributes | |
Impl::TerrainImpl * | mImpl |
ET::TerrainManager::TerrainManager | ( | Ogre::SceneManager * | sceneMgr, | |
const std::string & | name = "ETTerrain" | |||
) |
Constructs the Terrain Manager.
sceneMgr | The Ogre Scene Manager to use for rendering. | |
name | Instance name used internally to create unique object names for terrain tiles and nodes. |
ET::TerrainManager::~TerrainManager | ( | ) |
void ET::TerrainManager::createTerrain | ( | const TerrainInfo & | info, | |
size_t | tileSize = 33 , |
|||
unsigned int | maxLOD = 255 , |
|||
bool | vertexNormals = false | |||
) |
Creates terrain as specified by the given TerrainInfo.
info | TerrainInfo to construct terrain from | |
tileSize | the tile size to use, must be (2^n+1) | |
maxLOD | the maximal level of detail to be used | |
vertexNormals | generate vertex normals? (necessary for dynamic lighting) |
void ET::TerrainManager::destroyTerrain | ( | ) |
Destroys the currently loaded terrain (if any).
void ET::TerrainManager::setUseLODMorphing | ( | bool | lodMorph = true , |
|
float | startMorphing = 0.25f , |
|||
const std::string & | morphParamName = "morphFactor" | |||
) |
Enables or disables support for terrain LOD morphing. Note that this method has no effect on already loaded terrain, you need to reload your terrain. Also this needs a corresponding vertex shader in the associated material to actually work.
lodMorph | ||
startMorphing | percentage of the distance at which to start morphing | |
morphParamName | name of the shader parameter which contains the current morph factor |
void ET::TerrainManager::setLODErrorMargin | ( | unsigned int | maxPixelError, | |
unsigned int | viewportHeight | |||
) |
Specifies the pixel error tolerance when determining LOD to use for each tile. Note that this call does not affect already loaded terrain data.
maxPixelError | the maximum estimated pixel error to tolerate | |
viewportHeight | vertical resolution of the viewport to use to estimate the pixel error |
const TerrainInfo& ET::TerrainManager::getTerrainInfo | ( | ) | const |
Retrieves the terrain info of the currently loaded terrain.
void ET::TerrainManager::setMaterial | ( | Ogre::MaterialPtr | material | ) |
Sets the material to use for the terrain tiles. You need to call this if you actually want to see anything :)
const Ogre::MaterialPtr& ET::TerrainManager::getMaterial | ( | ) | const |
Retrieve the currently used material for the terrain.
void ET::TerrainManager::deform | ( | int | x, | |
int | z, | |||
const Brush & | brush, | |||
float | intensity = 1.0f | |||
) |
Deforms terrain vertices at the given coordinates with the given brush. Note that the positions specify vertex indexes, NOT scene coordinates. Use TerrainInfo::posToVertex if necessary.
void ET::TerrainManager::setHeights | ( | int | x, | |
int | z, | |||
const Brush & | brush | |||
) |
Sets terrain heights at the given coordinates as specified by the given brush. Note that the positions specify vertex indexes, NOT scene coordinates.
void ET::TerrainManager::getHeights | ( | int | x, | |
int | z, | |||
Brush & | brush | |||
) | const |
Retrieves terrain heights at the given coordinates and stores them into the given brush. Note that the positions specify vertex indexes, NOT scene coordinates.
Impl::TerrainImpl* ET::TerrainManager::mImpl [private] |
implementation hiding via PIMPL idiom