The Terrain class implements a ActorKdTree-based terrain scene manager.
More...
#include <Terrain.hpp>
List of all members.
Detailed Description
The Terrain class implements a ActorKdTree-based terrain scene manager.
Some applications do not need complex LOD or CLOD management algorithms to display height fields or terrains, either because the data displayed has a limited size or because particular constraints are applied to the camera (like in RTS games for example) for which only a limited portion of the terrain is visible at a given time.
This applications can greatly benefit from the vl::Terrain scene manager which implements a fool-proof, high-precision (8, 16 and 32 bits heightmaps are supported) and efficient terrain/heightfield generation and management system. All the user has to provide is a texture for the terrain, a heightfield image and a detail texture following very simple and precise guidelines.
The vl::Terrain class takes care of all the rest, like dividing the provided images into chunks, generating the geometry, generating the kd-tree, computing the appropriate texture coordinates in order to prevent seams and so on.
If the OpenGL Shading Language is available, the vl::Terrain class can also store the heightmap directly on the GPU and can generate the geometry on the fly using a technique called "vertex texture
fetch" (http://developer.nvidia.com/object/using_vertex_textures.html). This technique allows the application to save GPU memory and to manage even greater terrain databases at a higher speed.
- See also:
- setTerrainTexture(), setHeightmapTexture(), setDetailTexture()
Constructor & Destructor Documentation
| vl::Terrain::Terrain |
( |
) |
[inline] |
Member Function Documentation
| virtual const char* vl::Terrain::className |
( |
) |
[inline, virtual] |
| bool vl::Terrain::useGLSL |
( |
) |
const [inline] |
| int vl::Terrain::detailRepetitionMode |
( |
) |
const [inline] |
| double vl::Terrain::width |
( |
) |
const [inline] |
| double vl::Terrain::depth |
( |
) |
const [inline] |
| double vl::Terrain::height |
( |
) |
const [inline] |
| const vec3& vl::Terrain::origin |
( |
) |
const [inline] |
| const String& vl::Terrain::detailTexture |
( |
) |
const [inline] |
| const String& vl::Terrain::terrainTexture |
( |
) |
const [inline] |
| const String& vl::Terrain::heightmapTexture |
( |
) |
const [inline] |
| void vl::Terrain::setUseGLSL |
( |
bool |
enable ) |
[inline] |
| void vl::Terrain::setDetailRepetitionCount |
( |
int |
count ) |
[inline] |
| void vl::Terrain::setWidth |
( |
double |
w ) |
[inline] |
| void vl::Terrain::setDepth |
( |
double |
d ) |
[inline] |
| void vl::Terrain::setHeight |
( |
double |
h ) |
[inline] |
| void vl::Terrain::setOrigin |
( |
const vec3 & |
origin ) |
[inline] |
| void vl::Terrain::setHeightmapTextureFormat |
( |
ETextureFormat |
format ) |
[inline] |
| void vl::Terrain::setTerrainTextureFormat |
( |
ETextureFormat |
format ) |
[inline] |
| void vl::Terrain::setDetailTextureFormat |
( |
ETextureFormat |
format ) |
[inline] |
| void vl::Terrain::setVertexShader |
( |
const String & |
vs_path ) |
[inline] |
| const String& vl::Terrain::vertexShader |
( |
) |
const [inline] |
| void vl::Terrain::setFragmentShader |
( |
const String & |
fs_path ) |
[inline] |
| const String& vl::Terrain::fragmentShader |
( |
) |
const [inline] |
| int vl::Terrain::chunkCount |
( |
) |
const [inline] |
| Actor* vl::Terrain::chunk |
( |
int |
i ) |
[inline] |
| const Actor* vl::Terrain::chunk |
( |
int |
i ) |
const [inline] |
| void vl::Terrain::setDetailTexture |
( |
const String & |
texture ) |
[inline] |
Sets the texture to be used as detail texture, it can be of any size.
| void vl::Terrain::setTerrainTexture |
( |
const String & |
texture ) |
[inline] |
Sets the texture to be used as the base terrain texture.
Its size must be of the form: n * d - n + 1 where:
- 'n' is any positive integer. 'n' is the value passed to setChunkSubdivision().
- 'd' is a power of 2 and defines the dimension of the texture applied to each terrain chunk. For example: for a terrain with 8x8 chunks each of which with a 256x256 texture we have: 8*256-8+1 = 2041 = x and y size of the texture image.
| void vl::Terrain::setHeightmapTexture |
( |
const String & |
texture ) |
[inline] |
Sets the texture to be used as the heightmap.
Its size must be of the form: n * d - n + 1 where:
- 'n' is any positive integer. 'n' is the value passed to setChunkSubdivision().
- 'd' is a power of 2 and defines the dimension of the heightmap portion used to build each terrain chunk. For example: for a terrain with 8x8 chunks each of which with a 256x256 heightmap we have: 8*256-8+1 = 2041 = x and y size of the heightmap image.
| const ShaderNode* vl::Terrain::shaderNode |
( |
) |
const [inline] |
Member Data Documentation
The documentation for this class was generated from the following files:
- C:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Terrain.hpp
- C:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Terrain.cpp