My Project
|
The Loader is a Singleton object that provides access to ElevationLoaders and TextureLoaders. More...
#include <Loader.h>
Public Member Functions | |
HRESULT | LoadElevations (Terrain *pTerrain, const char *szFilename, float fTerrainSize, float elevationScale, bool swapVertical=TRUE) |
HRESULT | LoadElevations (float **ppImageData, int *nSize, const char *szFilename, bool swapVertical=TRUE) |
load elevation to a buffer. More... | |
HRESULT | LoadHoleFile (Terrain *pTerrain, const char *szFilename, short nHoleScale) |
[absoleted: holes are specified in terrain config file] Load the terrain hole file. More... | |
void | LoadTerrainTexture (Terrain *pTerrain, const char *fileName) |
The texture will automatically be chopped into TextureCell objects and a grid of textures will be arranged across the Terrain's surface. More... | |
void | LoadCommonTerrainTexture (Terrain *pTerrain, const char *fileName) |
Uses the specified TextureLoader library to apply a repeating common texture to the specified Terrain object. More... | |
HRESULT | LoadTerrainInfo (Terrain *pTerrain, const char *szFilename) |
Static Public Member Functions | |
static Loader * | GetInstance () |
Returns the Singleton instance of the Loader class. | |
The Loader is a Singleton object that provides access to ElevationLoaders and TextureLoaders.
Loader dynamically loads DLL's (or shared objects) when their services are requested. It forwards along the loading parameters passed by the application to the dynamically loaded ElevationLoader or TextureLoader library. Since ElevationLoader and TextureLoader libraries are loaded dynamically, it is your responsibility to ensure that your application provides the required .DLL or .so files along with your install. See the documentation at terrainengine.com for a discussion of this topic.
void Loader::LoadCommonTerrainTexture | ( | Terrain * | pTerrain, |
const char * | fileName | ||
) |
Uses the specified TextureLoader library to apply a repeating common texture to the specified Terrain object.
See Terrain::SetCommonTexture for details on what a common texture is.
HRESULT Loader::LoadElevations | ( | Terrain * | pTerrain, |
const char * | szFilename, | ||
float | fTerrainSize, | ||
float | elevationScale, | ||
bool | swapVertical = TRUE |
||
) |
pTerrain | [out] output terrain |
szFilename | : file name to extract the data. it can either be a gray scale image or a raw elevation file containing just float value arrays. |
fTerrainSize | size of the terrain |
elevationScale | |
swapVertical | whether swap vertically of the loaded height map |
HRESULT Loader::LoadElevations | ( | float ** | ppImageData, |
int * | nSize, | ||
const char * | szFilename, | ||
bool | swapVertical = TRUE |
||
) |
load elevation to a buffer.
ppImageData | [out]: the out height field buffer. the caller is responsible for deleting the buffer using delete [] function. |
nSize | [out]: the output size of the terrain. |
szFilename | : file name to extract the data. it can either be a gray scale image or a raw elevation file containing just float value arrays. |
swapVertical | whether swap vertically of the loaded height map |
Load from raw elevation
just use the file buffer as the image buffer
HRESULT Loader::LoadHoleFile | ( | Terrain * | pTerrain, |
const char * | szFilename, | ||
short | nHoleScale | ||
) |
[absoleted: holes are specified in terrain config file] Load the terrain hole file.
Terrain hole file is currently encoded the same with RAW elevation file. with the distinction that it is an X*X array of BYTE values. If the BYTE value is 1, it is interpreted as a hole, otherwise it is false.
Load from raw elevation
just use the file buffer as the image buffer
void Loader::LoadTerrainTexture | ( | Terrain * | pTerrain, |
const char * | fileName | ||
) |
The texture will automatically be chopped into TextureCell objects and a grid of textures will be arranged across the Terrain's surface.