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. |
XML:
<TerrainComponent> <!-- Properties --> </TerrainComponent>
Definition at line 33 of file TerrainComponent.h.
TerrainComponent::TerrainComponent | ( | Entity * | parent | ) |
Constructor (default).
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.
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 | ( | ) |
const aabbox3df & TerrainComponent::getBoundingBox | ( | s32 | patchX, | |
s32 | patchZ | |||
) | const |
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 | |||
) |
IMesh * TerrainComponent::getMesh | ( | ) |
Returns the current mesh.
Definition at line 90 of file TerrainComponent.cpp.
const vector3df & TerrainComponent::getTerrainCenter | ( | ) | const |
ITerrainSceneNode * TerrainComponent::getTerrainSceneNode | ( | ) |
Returns a direct pointer to the ITerrainSceneNode.
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="" />
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.
Definition at line 150 of file TerrainComponent.cpp.
bool TerrainComponent::parseXML | ( | IXMLReader * | file, | |
Entity * | entity | |||
) | [static] |
Parses for a TerrainComponent.
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="" />
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.