Patch to get terrain size from terrain scene node
Posted: Sat Feb 02, 2008 5:12 pm
I noticed, while attempting to use the terrain scene node with ODE, that there isn't actually any way of telling how large the terrain is (as far as I can tell). I've only added one new member, since apparently the terrain scene node only supports square terrains, which I suppose is an artifact of the LOD system.
You can add getTerrainSize() to the terrain scene nodes with the following additions:
In CTerrainSceneNode.h:
In CTerrainSceneNode.cpp:
In ITerrainSceneNode.h:
Rebuild & enjoy.
You can add getTerrainSize() to the terrain scene nodes with the following additions:
In CTerrainSceneNode.h:
Code: Select all
//! Returns the number of points in the heightmap (in the X/width and Z/depth directions).
virtual s32 getTerrainSize( ) const;
Code: Select all
s32 CTerrainSceneNode::getTerrainSize( ) const
{
return TerrainData.Size;
}
Code: Select all
//! Returns the number of points in the heightmap (in the X/width and Z/depth directions).
/** PATCH - NOT PART OF IRRLICHT 1.4 RELEASE.
Returns the length of one side of the square terrain.
*/
virtual s32 getTerrainSize( ) const = 0;