Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

graphics
Class CTerrain

   in Terrain.h
   in Terrain.cpp

class CTerrain


Field Summary
private SColor4ub m_BaseColour
          
private u16* m_Heightmap
          
private u32 m_MapSize
          
private u32 m_MapSizePatches
          
private CPatch* m_Patches
          
 
Constructor Summary
CTerrain()
          CTerrain constructor
~CTerrain()
          ReleaseData: delete any data allocated by this terrain
 
Method Summary
 static void CalcFromPosition( const CVector3D& pos, i32& i, i32& j )
          
 static void CalcFromPosition( float x, float z, i32& i, i32& j )
          
 void CalcNormal( u32 i, u32 j, CVector3D& normal ) const
          GetPatch: return the patch at (i,j) in patch space, or null if the patch is out of bounds
 void CalcPosition( i32 i, i32 j, CVector3D& pos ) const
          CalcNormal: calculate the world space normal of the vertex at (i,j)
 void ClampCoordToMap( int& index ) const
          
 float FlattenArea( float x0, float x1, float z0, float z1 )
          
 SColor4ub GetBaseColour() const
          
 float GetExactGroundLevel( float x, float z ) const
          Resize: resize this terrain to the given size (in patches per side)
 float GetExactGroundLevel( const CVector2D& v ) const
          
 u16* GetHeightMap() const
          
 CPatch* GetPatch( i32 i, i32 j ) const
          GetPatch: return the tile at (i,j) in tile space, or null if the tile is out of bounds
 u32 GetPatchesPerSide() const
          
 float GetSlope( float x, float z ) const
          
 CVector2D GetSlopeAngleFace( CEntity* entity ) const
          
 CMiniPatch* GetTile( i32 i, i32 j ) const
          
 u32 GetTilesPerSide() const
          
 float GetVertexGroundLevel( int i, int j ) const
          
 u32 GetVerticesPerSide() const
          
private void InitialisePatches()
          SetHeightMap: set up a new heightmap from 16-bit source data; assumes heightmap matches current terrain size
 bool Initialize( u32 size, const u16* data )
          
 bool IsOnMap( float x, float z ) const
          
 bool IsOnMap( const CVector2D& v ) const
          
 bool IsPassable( const CVector2D& tileSpaceLoc, HEntity entity ) const
          CalcPosition: calculate the world space position of the vertex at (i,j)
 void MakeDirty( int dirtyFlags )
          
 void MakeDirty( int i0, int j0, int i1, int j1, int dirtyFlags )
          
private void ReleaseData()
          Initialise: initialise this terrain to the given size (in patches per side); using given heightmap to setup elevation data
 void Resize( u32 size )
          InitialisePatches: initialise patch data
 void SetBaseColour( SColor4ub colour )
          
 void SetHeightMap( u16* heightmap )
          FlattenArea: flatten out an area of terrain (specified in world space coords); return the average height of the flattened area
 

Field Detail

m_BaseColour

private SColor4ub m_BaseColour;

m_Heightmap

private u16* m_Heightmap;

m_MapSize

private u32 m_MapSize;

m_MapSizePatches

private u32 m_MapSizePatches;

m_Patches

private CPatch* m_Patches;


Constructor Detail

CTerrain

public CTerrain();
CTerrain constructor

~CTerrain

public ~CTerrain();
ReleaseData: delete any data allocated by this terrain


Method Detail

CalcFromPosition

public static void CalcFromPosition( const CVector3D& pos, i32& i, i32& j );

CalcFromPosition

public static void CalcFromPosition( float x, float z, i32& i, i32& j );

CalcNormal

public void CalcNormal( u32 i, u32 j, CVector3D& normal ) const;
GetPatch: return the patch at (i,j) in patch space, or null if the patch is out of bounds

CalcPosition

public void CalcPosition( i32 i, i32 j, CVector3D& pos ) const;
CalcNormal: calculate the world space normal of the vertex at (i,j)

ClampCoordToMap

public void ClampCoordToMap( int& index ) const;

FlattenArea

public float FlattenArea( float x0, float x1, float z0, float z1 );

GetBaseColour

public SColor4ub GetBaseColour() const;

GetExactGroundLevel

public float GetExactGroundLevel( float x, float z ) const;
Resize: resize this terrain to the given size (in patches per side)

GetExactGroundLevel

public float GetExactGroundLevel( const CVector2D& v ) const;

GetHeightMap

public u16* GetHeightMap() const;

GetPatch

public CPatch* GetPatch( i32 i, i32 j ) const;
GetPatch: return the tile at (i,j) in tile space, or null if the tile is out of bounds

GetPatchesPerSide

public u32 GetPatchesPerSide() const;

GetSlope

public float GetSlope( float x, float z ) const;

GetSlopeAngleFace

public CVector2D GetSlopeAngleFace( CEntity* entity ) const;

GetTile

public CMiniPatch* GetTile( i32 i, i32 j ) const;

GetTilesPerSide

public u32 GetTilesPerSide() const;

GetVertexGroundLevel

public float GetVertexGroundLevel( int i, int j ) const;

GetVerticesPerSide

public u32 GetVerticesPerSide() const;

InitialisePatches

private void InitialisePatches();
SetHeightMap: set up a new heightmap from 16-bit source data; assumes heightmap matches current terrain size

Initialize

public bool Initialize( u32 size, const u16* data );

IsOnMap

public bool IsOnMap( float x, float z ) const;

IsOnMap

public bool IsOnMap( const CVector2D& v ) const;

IsPassable

public bool IsPassable( const CVector2D& tileSpaceLoc, HEntity entity ) const;
CalcPosition: calculate the world space position of the vertex at (i,j)

MakeDirty

public void MakeDirty( int dirtyFlags );

MakeDirty

public void MakeDirty( int i0, int j0, int i1, int j1, int dirtyFlags );

ReleaseData

private void ReleaseData();
Initialise: initialise this terrain to the given size (in patches per side); using given heightmap to setup elevation data

Resize

public void Resize( u32 size );
InitialisePatches: initialise patch data

SetBaseColour

public void SetBaseColour( SColor4ub colour );

SetHeightMap

public void SetHeightMap( u16* heightmap );
FlattenArea: flatten out an area of terrain (specified in world space coords); return the average height of the flattened area

 Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
Generated on September 04, 2007 at 18:13
CppDoc v2.4.0
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD