#include <terrain_base.h>
Inherited by TerrainServer.
Inheritance diagram for TerrainBase:

Public Types | |
| typedef Uint8 | THeightMapValue |
Public Member Functions | |
| TerrainBase () | |
| virtual | ~TerrainBase () |
| bool | loadHeightmap (const std::string fileName) |
| Loads heightmap. | |
| void | getExtents (int &x, int &y) |
| Obtains terrain size (heightmap extents). | |
| double | getHeight (double x, double y) |
| Height at given point (interpolated, continuous case). | |
| THeightMapValue | getTrueHeight (int x, int y) |
| Height at given point (heightmap value, discrete case). | |
| double | getScaledHeight (int x, int y) |
| Height at given point (heightmap scaled value, discrete case). | |
| double | getScaledMaxHeight (void) |
| Obtains the maximal height scale. | |
| GLVector3d & | getScale (GLVector3d &scale) |
| Obtains the current scale vector. | |
| GLVector3d | getScale (void) |
| Obtains a scale vector (vector, that describes the terrain extent). | |
| void | setScale (const GLVector3d &scale) |
| Sets a scale vector (vector, that describes the terrain extent). | |
| GLVector3d & | getRealScale (GLVector3d &scale) |
| obtains the real scale-vector. | |
| GLVector3d | getRealScale (void) |
| obtains the real scale-vector. | |
| GLVector3d & | getRealScaleInv (GLVector3d &scaleInv) |
| obtains the real scale-vector inverted. | |
| GLVector3d | getRealScaleInv (void) |
| obtains the real scale-vector inverted. | |
Protected Member Functions | |
| virtual bool | allocateHeightmap (int sizeX, int sizeY) |
| allocates memory and sets the heightmap pointer. | |
Protected Attributes | |
| THeightMapValue * | mHeightMap |
| heightmap values, mSizeX * mSizeY bytes. | |
Private Member Functions | |
| THeightMapValue | createHeightValueFromColor (SDL_Color *col) |
| color-to-height value transform routine Calculates intensity (Uint8) from the RGB triplet and rounds it. | |
Private Attributes | |
| int | mSizeX |
| int | mSizeY |
| terrain extents (physical size of the heightmap). | |
| GLVector3d | mScale |
| height and extents scale. | |
| GLVector3d | mScaleInv |
| inverted height and extents scale. | |
Provides heightmap and extents manipulation routines.
Definition at line 18 of file terrain_base.h.
|
|
Definition at line 21 of file terrain_base.h. |
|
|
Definition at line 8 of file terrain_base.cpp. |
|
|
Definition at line 16 of file terrain_base.cpp. References mHeightMap. |
|
||||||||||||
|
allocates memory and sets the heightmap pointer.
Reimplemented in TerrainRoetger. Definition at line 52 of file terrain_base.cpp. References mHeightMap, mSizeX, and mSizeY. Referenced by TerrainRoetger::allocateHeightmap(), and loadHeightmap(). |
|
|
color-to-height value transform routine Calculates intensity (Uint8) from the RGB triplet and rounds it.
Definition at line 279 of file terrain_base.h. Referenced by loadHeightmap(). |
|
||||||||||||
|
Obtains terrain size (heightmap extents).
Definition at line 210 of file terrain_base.h. References mSizeX, and mSizeY. Referenced by TerrainRoetger::calculate_roughness(), TerrainServer::createBlocks(), TerrainGeoMipMap::createBlocks(), TerrainServer::getDescriptor(), Terrain::getExtents(), TerrainRoetger::index(), TerrainSimple::render(), TerrainRoetger::render(), TerrainGeoMipMap::render(), and TerrainGeoMipMap::setDescriptor(). |
|
||||||||||||
|
Height at given point (interpolated, continuous case). It scales x, y to Terrain's extent, determines height values of closest neighbours (given by integer part of translated x, y) and returns interpolated height from them (using non-integer part). Heightmap values can be stored in the range of <0, 255>. However, this function returns scaled height - height is scaled to <0.0, 1.0> and multiplied by previously set scale-factor.
Definition at line 21 of file terrain_base.cpp. References getTrueHeight(), mScale, and mScaleInv. Referenced by Terrain::getHeight(). Here is the call graph for this function: ![]() |
|
|
obtains the real scale-vector.
Definition at line 252 of file terrain_base.h. Referenced by TerrainSimple::render(), TerrainRoetger::render(), TerrainGeoMipMap::render(), TerrainRoetger::update(), and TerrainGeoMipMap::update(). |
|
|
obtains the real scale-vector. This is mainly for rendering purposes. Others will use public getScale that is derived from normalized extent.
Definition at line 247 of file terrain_base.h. References mScale. Referenced by TerrainServer::TerrainBlock::createTriMeshData(), and TerrainGeoMipMap::TerrainBlock::initLevels(). |
|
|
obtains the real scale-vector inverted.
Definition at line 263 of file terrain_base.h. Referenced by TerrainRoetger::update(), and TerrainGeoMipMap::update(). |
|
|
obtains the real scale-vector inverted.
Definition at line 258 of file terrain_base.h. References mScaleInv. |
|
|
Obtains a scale vector (vector, that describes the terrain extent).
Definition at line 241 of file terrain_base.h. |
|
|
Obtains the current scale vector. Current scale vector is a vector that describes the "public extents" of the terrain.
Definition at line 233 of file terrain_base.h. References mScale, mSizeX, and mSizeY. Referenced by Terrain::getScale(). |
|
||||||||||||
|
Height at given point (heightmap scaled value, discrete case). Does the same as getTrueHeightAt(int x, int y) but scales the returned value.
Definition at line 223 of file terrain_base.h. References getTrueHeight(), and mScale. Referenced by TerrainRoetger::add_height_error(), and Terrain::getScaledHeight(). Here is the call graph for this function: ![]() |
|
|
Obtains the maximal height scale.
Definition at line 228 of file terrain_base.h. References mScale. Referenced by Terrain::getScaledMaxHeight(). |
|
||||||||||||
|
Height at given point (heightmap value, discrete case). Performs heightmap lookup at map's x, y coordinates. If terrain paging is implemented, the page that contains x, y is determined first and the lookup is delegated to it.
Definition at line 215 of file terrain_base.h. References mHeightMap, mSizeX, and mSizeY. Referenced by TerrainServer::TerrainBlock::createTriMeshData(), TerrainGeoMipMap::TerrainBlock::getDelta(), getHeight(), getScaledHeight(), Terrain::getTrueHeight(), TerrainGeoMipMap::TerrainBlock::initLevels(), TerrainGeoMipMap::NodeDelegate::nodeCreation(), TerrainSimple::render(), TerrainGeoMipMap::TerrainBlock::render(), TerrainRoetger::render_quadtree(), TerrainGeoMipMap::TerrainBlock::renderTriFanA(), and TerrainGeoMipMap::TerrainBlock::renderTriFanB(). |
|
|
Loads heightmap. Performs following steps: 1) Loads picture given by FileName using SDL_Image, saves it temporary in SDL_Surface 2) Converts to compact-form (1-byte-height-value) 3) Frees SDL_Surface
Definition at line 69 of file terrain_base.cpp. References allocateHeightmap(), createHeightValueFromColor(), LOGD, LOGE, mHeightMap, mSizeX, mSizeY, and TIN. Referenced by Terrain::loadHeightmap(). Here is the call graph for this function: ![]() |
|
|
Sets a scale vector (vector, that describes the terrain extent).
// An example of setting "my own" scale in meters: // for example in meters (m) const double ToMyUnits = 5; // "one heightmap pixel is a 5 m" double desiredTerrainHeightInMyUnits = 100; // "maximal height will be 100 m" terrain.GetExtents(extX, extY); terrain.setScale(GLVector3d(extX*ToMyUnits, extY*ToMyUnits, desiredTerrainHeightInMyUnits)) Note that rendered output will be scaled by the scale vector.
Definition at line 269 of file terrain_base.h. References mScale, mScaleInv, and mSizeX. Referenced by Terrain::setScale(). |
|
|
heightmap values, mSizeX * mSizeY bytes.
Definition at line 154 of file terrain_base.h. Referenced by allocateHeightmap(), getTrueHeight(), loadHeightmap(), and ~TerrainBase(). |
|
|
height and extents scale.
Definition at line 150 of file terrain_base.h. Referenced by getHeight(), getRealScale(), getScale(), getScaledHeight(), getScaledMaxHeight(), and setScale(). |
|
|
inverted height and extents scale.
Definition at line 151 of file terrain_base.h. Referenced by getHeight(), getRealScaleInv(), and setScale(). |
|
|
Definition at line 148 of file terrain_base.h. Referenced by allocateHeightmap(), getExtents(), getScale(), getTrueHeight(), loadHeightmap(), and setScale(). |
|
|
terrain extents (physical size of the heightmap).
Definition at line 148 of file terrain_base.h. Referenced by allocateHeightmap(), getExtents(), getScale(), getTrueHeight(), and loadHeightmap(). |
1.4.5