TerrainComponent Class Reference

Component wrapper of Irrlicht's ITerrainSceneNode. More...

Inheritance diagram for TerrainComponent:

Inheritance graph
[legend]
Collaboration diagram for TerrainComponent:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 TerrainComponent (Entity *parent)
 Constructor (default).
 TerrainComponent (Entity *parent, const std::string &fileName, const vector3df &scale=vector3df(1.0f, 1.0f, 1.0f), const SColor &vertexColor=SColor(255, 255, 255, 255), s32 maxLOD=5, s32 smoothFactor=0)
 Constructor.
 ~TerrainComponent ()
 Deconstructor.
ITerrainSceneNode * getTerrainSceneNode ()
 Returns a direct pointer to the ITerrainSceneNode.
const aabbox3df & getBoundingBox () const
 Get the bounding box of the terrain.
const aabbox3df & getBoundingBox (s32 patchX, s32 patchZ) const
 Gets the bounding box of a patch.
f32 getHeight (f32 x, f32 y)
 Gets height of a point of the terrain.
IMesh * getMesh ()
 Returns the current mesh.
const vector3df & getTerrainCenter () const
 Gets the center of the terrain.
bool loadHeightMap (const std::string &fileName, const SColor &vertexColor=SColor(255, 255, 255, 255), s32 smoothFactor=0)
 Loads the data from a heightMapFile.
void scaleTexture (f32 scale=1.0f, f32 scale2=0.0f)
 Scales the base texture.
void onHeightMap (void *p)
 Responds to changes of the heightmap attached to this component.

Static Public Member Functions

static bool parseXML (IXMLReader *file, Entity *entity)
 Parses for a TerrainComponent.


Detailed Description

Component wrapper of Irrlicht's ITerrainSceneNode.

XML:

 <TerrainComponent>
    <!-- Properties -->
 </TerrainComponent>

Definition at line 33 of file TerrainComponent.h.


Constructor & Destructor Documentation

TerrainComponent::TerrainComponent ( Entity parent  ) 

Constructor (default).

Parameters:
parent The parent entity to which the component should be added.

Definition at line 23 of file TerrainComponent.cpp.

TerrainComponent::TerrainComponent ( Entity parent,
const std::string &  fileName,
const vector3df &  scale = vector3df(1.0f, 1.0f, 1.0f),
const SColor &  vertexColor = SColor(255, 255, 255, 255),
s32  maxLOD = 5,
s32  smoothFactor = 0 
)

Constructor.

Parameters:
parent The parent entity to which the component should be added.
fileName Filename of the heightmap to load.
scale The initial scale of the component.
vertexColor The default color of all the vertices.
maxLOD The maximum LOD (level of detail) for the component.
smoothFactor The number of times the vertices are smoothed.

Definition at line 30 of file TerrainComponent.cpp.

TerrainComponent::~TerrainComponent (  ) 

Deconstructor.

Definition at line 40 of file TerrainComponent.cpp.


Member Function Documentation

const aabbox3df & TerrainComponent::getBoundingBox ( s32  patchX,
s32  patchZ 
) const

Gets the bounding box of a patch.

Definition at line 78 of file TerrainComponent.cpp.

const aabbox3df & TerrainComponent::getBoundingBox (  )  const [virtual]

Get the bounding box of the terrain.

Reimplemented from SceneComponent.

Definition at line 72 of file TerrainComponent.cpp.

f32 TerrainComponent::getHeight ( f32  x,
f32  y 
)

Gets height of a point of the terrain.

Definition at line 84 of file TerrainComponent.cpp.

IMesh * TerrainComponent::getMesh (  ) 

Returns the current mesh.

Note:
Not available in AngelScript.

Definition at line 90 of file TerrainComponent.cpp.

const vector3df & TerrainComponent::getTerrainCenter (  )  const

Gets the center of the terrain.

Definition at line 96 of file TerrainComponent.cpp.

ITerrainSceneNode * TerrainComponent::getTerrainSceneNode (  ) 

Returns a direct pointer to the ITerrainSceneNode.

Note:
Not available in AngelScript.

Definition at line 66 of file TerrainComponent.cpp.

bool TerrainComponent::loadHeightMap ( const std::string &  fileName,
const SColor &  vertexColor = SColor(255, 255, 255, 255),
s32  smoothFactor = 0 
)

Loads the data from a heightMapFile.

XML:

     <heightMap fileName="" />

Parameters:
fileName Filename of the heightmap to load.
vertexColor The default color of all the vertices.
smoothFactor The number of times the vertices are smoothed.

Definition at line 102 of file TerrainComponent.cpp.

void TerrainComponent::onHeightMap ( void *  p  ) 

Responds to changes of the heightmap attached to this component.

Note:
For internal use only!

Definition at line 150 of file TerrainComponent.cpp.

bool TerrainComponent::parseXML ( IXMLReader *  file,
Entity entity 
) [static]

Parses for a TerrainComponent.

Note:
For internal use only!

Reimplemented from SceneComponent.

Definition at line 162 of file TerrainComponent.cpp.

void TerrainComponent::scaleTexture ( f32  scale = 1.0f,
f32  scale2 = 0.0f 
)

Scales the base texture.

XML:

     <textureScale scale="" scale2="" />

Parameters:
scale The scaling amount. Values above 1.0 increase the number of time the texture is drawn on the terrain. Values below 0 will decrease the number of times the texture is drawn on the terrain. Using negative values will flip the texture, as well as still scaling it.
scale2 If set to 0 (default value), this will set the second texture coordinate set to the same values as in the first set. If this is another value than zero, it will scale the second texture coordinate set by this value.

Definition at line 144 of file TerrainComponent.cpp.


The documentation for this class was generated from the following files:

Generated on Fri Aug 21 23:55:18 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8