Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

CTerrain Class Reference

List of all members.

Detailed Description

World terrain.

Terrain is a heightfield that stretches over entire world on XY plane (so altitude is along Z axis).

Terrain can be queried for altitude at a specified point. Terrain altitudes may be updated. Terrain can render additional rectangular areas above it (ex. for selection).

To access the terrain use CEngine.

See also:
CEngine.


Public Types

enum  
 Terrain cells along X axis (must be a power of 2).

enum  
 Terrain cells along Y axis (must be a power of 2).


Public Methods

 CTerrain (const CResourceId &effect, const CResourceId &texture, float tuTiles, float tvTiles)
 Constructor.

virtual ~CTerrain ()
 Destructor.

void clearQuad ()
 Sets "none" additional quad.

void prepareQuad (float x1, float y1, float x2, float y2, float addZ)
 Initializes additional quad.

void renderQuad (D3DCOLOR color)
 Renders quad (must be initialized first).

float getAltitude (float x, float y) const
 Gets terrain altitude at XY coordinate.

float getAltitudeIdx (int idxX, int idxY) const
 Gets terrain altitude at XY cell index.

void getNearestCell (float x, float y, int &cx, int &cy) const
 Gets nearest cell index for XY coordinate.

float getMinAltitude () const
 Gets lowest altitude.

float getMaxAltitude () const
 Gets highest altitude.

const CResourceIdgetEffect () const
 Gets terrain effect resource ID.

void setEffect (const CResourceId &effect)
 Sets terrain effect resource ID.

const CResourceIdgetTexture () const
 Gets terrain texture resource ID.

void setTexture (const CResourceId &texture)
 Sets terrain texture resource ID.

void beginUpdate ()
 Begin heightfield update.

void setAltitude (int idxX, int idxY, float z)
 Update cell altitude.

void endUpdate ()
 Ends heightfield update.


Constructor & Destructor Documentation

CTerrain::CTerrain const CResourceId   effect,
const CResourceId   texture,
float    tuTiles,
float    tvTiles
 

Constructor.

Parameters:
tuTiles  Texture U (X) tiles.
tvTiles  Texture V (Y) tiles.
texture  Texture resource ID.


Member Function Documentation

void CTerrain::beginUpdate  
 

Begin heightfield update.

See also:
setAltitude(), endUpdate().

void CTerrain::endUpdate  
 

Ends heightfield update.

See also:
beginUpdate(), setAltitude().

void CTerrain::setAltitude int    idxX,
int    idxY,
float    z
 

Update cell altitude.

All updates must happen between beginUpdate() and endUpdate().

See also:
beginUpdate(), endUpdate().


Generated on Thu Dec 5 17:27:58 2002 for LT Game Jam Session by doxygen1.2.17