Creating and using Terrain objects from heightmaps. More...
Detailed Description
Creating and using Terrain objects from heightmaps.
The Terrain class is an entity that can be built from a heightmap texture. The terrain can be created and saved through the TerrainAssets manager. To create a Terrain, use the TerrainAssets::Load() function and pass in a string storage key, a wide string of the filepath, a ShaderTextureLight pointer (must be of this type), a texture to apply to the terrain, and various integer parameters for adjusting the scale, height and texture repeat. For more info see the documentation on TerrainAssets::Load().
LoadResources.cpp:
The Terrain object can be applied to the scene with the Scene::SetTerrain() function which takes in a string key to the storage key in the TerrainAssets manager. The Scene::SetTerrain() function can be called within the Scene::Initialize() like so:
UserScene.cpp:
The Scene class also offers a Scene::GetCurTerrain() function to retreive a pointer to the current active Terrain. This can also be called through SceneManager's SceneManager::GetCurrentTerrain() function. The Terrain class offers only a few functions such as Terrain::SetTexture() to modify the texture of the Terrain and Terrain::GetSurfacePoint() which takes in a Vect position and returns a position clamped to the surface of the Terrain (if the passed in position was above/below the Terrain).
Classes | |
class | Terrain |
Terrain class for 3D terrain. More... | |
class | TerrainAssets |
System manager for for creating and accessing Terrain objects from external resources. More... | |