ET::TerrainInfo Class Reference

#include <ETTerrainInfo.h>

List of all members.

Public Member Functions

 TerrainInfo ()
 TerrainInfo (size_t width, size_t height, const float *heightmap=0)
 TerrainInfo (size_t width, size_t height, const std::vector< float > &heightmap)
void setHeightmap (size_t width, size_t height, const float *heightmap=0)
void setHeightmap (size_t width, size_t height, const std::vector< float > &heightmap)
const std::vector
< float > & 
getHeightmapData () const
float & at (size_t x, size_t y)
const float at (size_t x, size_t y) const
size_t getWidth () const
size_t getHeight () const
void setExtents (const Ogre::AxisAlignedBox &extents)
Ogre::AxisAlignedBox getExtents () const
const Ogre::Vector3 & getScaling () const
const Ogre::Vector3 & getOffset () const
int posToVertexX (float x) const
int posToVertexZ (float z) const
float vertexToPosX (int x) const
float vertexToPosZ (int z) const
float getHeightAt (float x, float z) const
Ogre::Vector3 getNormalAt (float x, float z) const
std::pair< bool,
Ogre::Vector3 > 
rayIntersects (const Ogre::Ray &ray) const

Private Attributes

size_t mWidth
size_t mHeight
std::vector< float > mHeightmap
Ogre::Vector3 mOffset
Ogre::Vector3 mScale


Detailed Description

This class stores all basic information about the terrain, i. e. its heightmap, its extents and the scaling.

Constructor & Destructor Documentation

ET::TerrainInfo::TerrainInfo (  ) 

Default constructor

ET::TerrainInfo::TerrainInfo ( size_t  width,
size_t  height,
const float *  heightmap = 0 
)

Constructs with a heightmap given as an array of floats.

ET::TerrainInfo::TerrainInfo ( size_t  width,
size_t  height,
const std::vector< float > &  heightmap 
)

Constructs with a heightmap given as a vector of floats.


Member Function Documentation

void ET::TerrainInfo::setHeightmap ( size_t  width,
size_t  height,
const float *  heightmap = 0 
)

Sets a new heightmap from an array of floats.

void ET::TerrainInfo::setHeightmap ( size_t  width,
size_t  height,
const std::vector< float > &  heightmap 
)

Sets a new heightmap from a vector of floats.

const std::vector<float>& ET::TerrainInfo::getHeightmapData (  )  const [inline]

Retrieves the raw heightmap data.

float& ET::TerrainInfo::at ( size_t  x,
size_t  y 
) [inline]

Retrieves a value from the heightmap.

const float ET::TerrainInfo::at ( size_t  x,
size_t  y 
) const [inline]

Retrieves a const value from the heightmap.

size_t ET::TerrainInfo::getWidth (  )  const [inline]

Retrieves the width of the heightmap.

size_t ET::TerrainInfo::getHeight (  )  const [inline]

Retrieves the height of the heightmap.

void ET::TerrainInfo::setExtents ( const Ogre::AxisAlignedBox &  extents  ) 

Sets the extents of the terrain in Ogre units.

Ogre::AxisAlignedBox ET::TerrainInfo::getExtents (  )  const

Retrieves the terrain extents in Ogre units.

const Ogre::Vector3& ET::TerrainInfo::getScaling (  )  const [inline]

Retrieves the scaling of one vertex in Ogre units.

const Ogre::Vector3& ET::TerrainInfo::getOffset (  )  const [inline]

Retrieves the offset point of the terrain.

int ET::TerrainInfo::posToVertexX ( float  x  )  const [inline]

Scales from Ogre positions to vertex indexes.

int ET::TerrainInfo::posToVertexZ ( float  z  )  const [inline]

Scales from Ogre positions to vertex indexes.

float ET::TerrainInfo::vertexToPosX ( int  x  )  const [inline]

Scales from vertex indexes to Ogre positions.

float ET::TerrainInfo::vertexToPosZ ( int  z  )  const [inline]

Scales from vertex indexes to Ogre positions.

float ET::TerrainInfo::getHeightAt ( float  x,
float  z 
) const

Calculates the height at the given coordinates.

Ogre::Vector3 ET::TerrainInfo::getNormalAt ( float  x,
float  z 
) const

Calculates the terrain normal at the given coordinates.

std::pair<bool, Ogre::Vector3> ET::TerrainInfo::rayIntersects ( const Ogre::Ray &  ray  )  const

Checks if a ray intersects with the terrain.

Parameters:
ray The ray to check for intersection with the terrain.
Returns:
(true, point of intersection) if the terrain is intersected.


Member Data Documentation

size_t ET::TerrainInfo::mWidth [private]

extents of the heightmap

size_t ET::TerrainInfo::mHeight [private]

std::vector<float> ET::TerrainInfo::mHeightmap [private]

the heightmap

Ogre::Vector3 ET::TerrainInfo::mOffset [private]

offset at which the (0, 0) point of the terrain is placed in Ogre

Ogre::Vector3 ET::TerrainInfo::mScale [private]

scale of a terrain vertex


The documentation for this class was generated from the following file:
Generated on Tue Sep 4 21:46:02 2007 for Editable Terrain Manager by  doxygen 1.5.3