TerrainFile

Engine/source/terrain/terrFile.h

More...

Public Types

enum
Constants {  FILE_VERSION = 7
}

Public Friends

Protected Attributes

The full path and name of the TerrainFile.

The file version.

The grid map layers used to accelerate collision queries for the height map data.

The memory pool used by the grid map layers.

The fixed point height map.

The layer index at each height map sample.

MaterialList used to map terrain materials to material instances for the sake of collision (physics, etc.).

The materials used to render the terrain.

bool

The dirty flag.

The dimensions of the layer and height maps.

Protected Functions

_load(FileStream & stream)

The internal loading function.

The legacy file loading code.

Used to populate the materail vector by finding the TerrainMaterial objects by name.

Public Functions

Returns the constant heightmap vector.

import(const GBitmap & heightMap, F32 heightScale, const Vector< U8 > & layerMap, const Vector< String > & materials, bool flipYAxis)
bool
bool

Check if the given point is valid within the (non-tiled) terrain file.

bool
save(const char * filename)
setHeight(U32 x, U32 y, U16 height)
setHeightMap(const Vector< U16 > & heightmap, bool updateCollision)

Sets a new heightmap state.

setLayerIndex(U32 x, U32 y, U8 index)
setSize(U32 newResolution, bool clear)
smooth(F32 factor, U32 steps, bool updateCollision)

Performs multiple smoothing steps on the heightmap.

updateGrid(const Point2I & minPt, const Point2I & maxPt)

Updates the terrain grid for the specified area.

Public Static Functions

create(String * inOutFilename, U32 newSize, const Vector< String > & materials)

Detailed Description

Public Types

Constants

Enumerator

FILE_VERSION = 7

Public Friends

Protected Attributes

Torque::Path mFilePath 

The full path and name of the TerrainFile.

U32 mFileVersion 

The file version.

U32 mGridLevels 
Vector< TerrainSquare * > mGridMap 

The grid map layers used to accelerate collision queries for the height map data.

Vector< TerrainSquare > mGridMapPool 

The memory pool used by the grid map layers.

Vector< U16 > mHeightMap 

The fixed point height map.

Vector< U8 > mLayerMap 

The layer index at each height map sample.

MaterialList mMaterialInstMapping 

MaterialList used to map terrain materials to material instances for the sake of collision (physics, etc.).

Vector< TerrainMaterial * > mMaterials 

The materials used to render the terrain.

bool mNeedsResaving 

The dirty flag.

U32 mSize 

The dimensions of the layer and height maps.

Protected Functions

_buildGridMap()

_initMaterialInstMapping()

_load(FileStream & stream)

The internal loading function.

_loadLegacy(FileStream & stream)

The legacy file loading code.

_resolveMaterials(const Vector< String > & materials)

Used to populate the materail vector by finding the TerrainMaterial objects by name.

Public Functions

TerrainFile()

~TerrainFile()

findSquare(U32 level, U32 x, U32 y)

getHeight(U32 x, U32 y)

getHeightAddress(U32 x, U32 y)

getHeightMap()

Returns the constant heightmap vector.

getLayerIndex(U32 x, U32 y)

getMaterialMapping(U32 index)

getMaterialName(U32 x, U32 y)

getMaxHeight()

import(const GBitmap & heightMap, F32 heightScale, const Vector< U8 > & layerMap, const Vector< String > & materials, bool flipYAxis)

isEmptyAt(U32 x, U32 y)

isPointInTerrain(U32 x, U32 y)

Check if the given point is valid within the (non-tiled) terrain file.

save(const char * filename)

setHeight(U32 x, U32 y, U16 height)

setHeightMap(const Vector< U16 > & heightmap, bool updateCollision)

Sets a new heightmap state.

setLayerIndex(U32 x, U32 y, U8 index)

setSize(U32 newResolution, bool clear)

smooth(F32 factor, U32 steps, bool updateCollision)

Performs multiple smoothing steps on the heightmap.

updateGrid(const Point2I & minPt, const Point2I & maxPt)

Updates the terrain grid for the specified area.

Public Static Functions

create(String * inOutFilename, U32 newSize, const Vector< String > & materials)

load(const Torque::Path & path)