My Project
Public Member Functions | Static Public Member Functions | List of all members
ParaTerrain::Loader Class Reference

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 LoaderGetInstance ()
 Returns the Singleton instance of the Loader class.
 

Detailed Description

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.

Member Function Documentation

§ LoadCommonTerrainTexture()

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.

§ LoadElevations() [1/2]

HRESULT Loader::LoadElevations ( Terrain pTerrain,
const char *  szFilename,
float  fTerrainSize,
float  elevationScale,
bool  swapVertical = TRUE 
)
Parameters
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.
fTerrainSizesize of the terrain
elevationScale
swapVerticalwhether swap vertically of the loaded height map
Returns
S_OK if succeeded.

§ LoadElevations() [2/2]

HRESULT Loader::LoadElevations ( float **  ppImageData,
int *  nSize,
const char *  szFilename,
bool  swapVertical = TRUE 
)

load elevation to a buffer.

Parameters
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.
swapVerticalwhether swap vertically of the loaded height map
Returns
S_OK if succeeded.

Load from raw elevation

just use the file buffer as the image buffer

§ LoadHoleFile()

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

§ LoadTerrainTexture()

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.


The documentation for this class was generated from the following files: