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

TerrainHeightmap Class Reference

#include <terrain.h>

Collaboration diagram for TerrainHeightmap:

Collaboration graph
[legend]
List of all members.

Detailed Description

Heightmap for terrain pages This object contains the elevation data and various other properties for storing terrain data in memory. Once the heightmap is created, scaling properties cannot be changed and elevation data cannot be changed. Heightmaps are necessarily square in shape, so the size property reflects the number of grid points of one side of it.

Author:
Cody Russell (cody jhu edu)


Public Member Functions

 TerrainHeightmap (float fHScale=10.0f, float fVScale=5.0f)
virtual ~TerrainHeightmap ()
void Load (ImageData *pkImage)
void Load (const std::string &rstrFilename, int iSize)
int GetIndex (int x, int y) const
float GetHeight (int x, int y) const
const Vector3dGetNormal (int x, int y) const
float GetWorldHeight (float x, float y)
float GetMaxHeight ()
float GetMinHeight ()
const int GetSize () const
const float GetHScale () const
const float GetVScale () const

Protected Attributes

float * m_pfData
int m_iSize
Vector3dm_pkNormalData
float m_fHScale
float m_fVScale
float m_fMaxHeight
float m_fMinHeight


Constructor & Destructor Documentation

TerrainHeightmap float  fHScale = 10.0f,
float  fVScale = 5.0f
 

Initialize heightmap

Parameters:
fHScale Horizontal scaling property.
fVScale Vertical/elevation scaling property

virtual ~TerrainHeightmap  )  [virtual]
 


Member Function Documentation

void Load ImageData pkImage  ) 
 

Load the elevation data and size from an ImageData object.

Parameters:
pkImage Image to load

void Load const std::string &  rstrFilename,
int  iSize
 

Load the elevation data from a file

Parameters:
rstrFilename Filename of image to load
iSize Size of each side of the square image

int GetIndex int  x,
int  y
const
 

Get the index

Parameters:
x x coord
y y coord
Returns:
int index

float GetHeight int  x,
int  y
const
 

Get the height of a point in heightmap-space.

Parameters:
x x coordinate
y y (depth) coordinate, as if looking down on the terrain
Returns:
float value of height here, already scaled by VScale

const Vector3d& GetNormal int  x,
int  y
const
 

Get vertex normal of a point in heightmap-space

Parameters:
x x coordinate
y y (depth) coordinate
Returns:
Normal vector

float GetWorldHeight float  x,
float  y
 

Gets elevation in world units (eg, between elevation grid), where x and y are still considered ground-level

Parameters:
x x coordinate
y y coordinate
Returns:
float value of height here, already scaled by VScale

float GetMaxHeight  )  [inline]
 

Returns the maximum height of any point in the heightmap

Returns:
Elevation of highest point

float GetMinHeight  )  [inline]
 

Returns the minimum height of any point in the heightmap

Returns:
Elevation of lowest point

const int GetSize  )  const [inline]
 

Returns the size of one side of the heightmap

Returns:
Size of one side of the heightmap

const float GetHScale  )  const [inline]
 

Get the horizontal scaling factor for the heightmap

Returns:
Horizontal scaling factor

const float GetVScale  )  const [inline]
 

Get the vertical scaling factor for the heightmap

Returns:
Vertical scaling factor


Member Data Documentation

float* m_pfData [protected]
 

The elevation data

int m_iSize [protected]
 

Size of one side of the heightmap. Heightmaps must be square.

Vector3d* m_pkNormalData [protected]
 

The normals

float m_fHScale [protected]
 

Scale factor in XY domains

float m_fVScale [protected]
 

Scale factor in the Z domain

float m_fMaxHeight [protected]
 

The highest height value in the map

float m_fMinHeight [protected]
 

The lowest height value in the map


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:15 2004 for NeoEngine by doxygen 1.3.5