A node in a quad tree used to store a patch of terrain. More...
#include <OgreTerrainQuadTreeNode.h>
Classes | |
struct | LodLevel |
class | Movable |
MovableObject implementation to provide the hook to the scene. More... | |
class | Rend |
Hook to the render queue. More... | |
struct | VertexDataRecord |
Public Types | |
typedef vector< LodLevel * >::type | LodLevelList |
Public Member Functions | |
TerrainQuadTreeNode (Terrain *terrain, TerrainQuadTreeNode *parent, uint16 xoff, uint16 yoff, uint16 size, uint16 lod, uint16 depth, uint16 quadrant) | |
Constructor. More... | |
virtual | ~TerrainQuadTreeNode () |
void | assignVertexData (uint16 treeDepthStart, uint16 treeDepthEnd, uint16 resolution, uint sz) |
Assign vertex data to the tree, from a depth and at a given resolution. More... | |
bool | calculateCurrentLod (const Camera *cam, Real cFactor) |
Calculate appropriate LOD for this node and children. More... | |
void | finaliseDeltaValues (const Rect &rect) |
Promote the delta values calculated to the runtime ones (this must be called in the main thread). More... | |
const AxisAlignedBox & | getAABB () const |
Get the AABB (local coords) of this node. More... | |
uint16 | getBaseLod () const |
Get the base LOD level this node starts at (the highest LOD it handles) More... | |
Real | getBoundingRadius () const |
Get the bounding radius of this node. More... | |
TerrainQuadTreeNode * | getChild (unsigned short child) const |
Get child node. More... | |
int | getCurrentLod () const |
Get the current LOD index (only valid after calculateCurrentLod) More... | |
const Vector3 & | getLocalCentre () const |
Get the local centre of this node, relative to parent terrain centre. More... | |
uint16 | getLodCount () const |
Get the number of LOD levels this node can represent itself (only > 1 for leaf nodes) More... | |
const LodLevel * | getLodLevel (uint16 lod) |
Get the LodLevel information for a given lod. More... | |
float | getLodTransition () const |
Get the transition state between the current LOD and the next lower one (only valid after calculateCurrentLod) More... | |
Real | getMaxHeight () const |
Get the maximum height of the node. More... | |
Real | getMinHeight () const |
Get the minimum height of the node. More... | |
TerrainQuadTreeNode * | getParent () const |
Get parent node. More... | |
Terrain * | getTerrain () const |
Get ultimate parent terrain. More... | |
uint16 | getXOffset () const |
Get the horizontal offset into the main terrain data of this node. More... | |
uint16 | getYOffset () const |
Get the vertical offset into the main terrain data of this node. More... | |
bool | isLeaf () const |
Is this a leaf node (no children) More... | |
bool | isRenderedAtCurrentLod () const |
Returns whether this node is rendering itself at the current LOD level. More... | |
bool | isSelfOrChildRenderedAtCurrentLod () const |
Returns whether this node or its children are being rendered at the current LOD level. More... | |
void | load () |
Load node and children (perform GPU tasks, will be render thread) More... | |
void | mergeIntoBounds (long x, long y, const Vector3 &pos) |
Merge a point (relative to terrain node) into the local bounds, and that of children if applicable. More... | |
void | notifyDelta (uint16 x, uint16 y, uint16 lod, Real delta) |
Notify the node (and children) of a height delta value. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
bool | pointIntersectsNode (long x, long y) |
Returns true if the given point is in the terrain area that this node references. More... | |
void | postDeltaCalculation (const Rect &rect) |
Notify the node (and children) that deltas have finished being calculated. More... | |
void | preDeltaCalculation (const Rect &rect) |
Notify the node (and children) that deltas are going to be calculated for a given range. More... | |
void | prepare () |
Prepare node and children (perform CPU tasks, may be background thread) More... | |
void | prepare (StreamSerialiser &stream) |
Prepare node from a stream. More... | |
bool | rectContainsNode (const Rect &rect) |
Returns true if the given rectangle completely contains the terrain area that this node references. More... | |
bool | rectIntersectsNode (const Rect &rect) |
Returns true if the given rectangle overlaps the terrain area that this node references. More... | |
void | resetBounds (const Rect &rect) |
Reset the bounds of this node and all its children for the region given. More... | |
void | save (StreamSerialiser &stream) |
Save node to a stream. More... | |
void | setCurrentLod (int lod) |
Manually set the current LOD, intended for internal use only. More... | |
void | setLodTransition (float t) |
Manually set the current LOD transition state, intended for internal use only. More... | |
void | unload () |
Unload node and children (perform GPU tasks, will be render thread) More... | |
void | unprepare () |
Unprepare node and children (perform CPU tasks, may be background thread) More... | |
void | updateVertexData (bool positions, bool deltas, const Rect &rect, bool cpuData) |
Tell the node to update its vertex data for a given region. More... | |
void | useAncestorVertexData (TerrainQuadTreeNode *owner, uint16 treeDepthEnd, uint16 resolution) |
Tell a node that it should use an anscestor's vertex data. More... | |
Static Public Attributes | |
static unsigned short | DELTA_BUFFER |
Buffer binding used for holding delta values. More... | |
static unsigned short | POSITION_BUFFER |
Buffer binding used for holding positions. More... | |
Protected Member Functions | |
uint16 | calcSkirtVertexIndex (uint16 mainIndex, bool isCol) |
void | createCpuVertexData () |
void | createGpuIndexData () |
void | createGpuVertexData () |
void | destroyCpuVertexData () |
void | destroyGpuIndexData () |
void | destroyGpuVertexData () |
bool | getCastsShadows (void) const |
const LightList & | getLights (void) const |
const MaterialPtr & | getMaterial (void) const |
void | getRenderOperation (RenderOperation &op) |
Real | getSquaredViewDepth (const Camera *cam) const |
Technique * | getTechnique (void) const |
const VertexDataRecord * | getVertexDataRecord () const |
void | getWorldTransforms (Matrix4 *xform) const |
void | populateIndexData (uint16 batchSize, IndexData *destData) |
void | updateGpuVertexData () |
void | updateRenderQueue (RenderQueue *queue) |
void | updateVertexBuffer (HardwareVertexBufferSharedPtr &posbuf, HardwareVertexBufferSharedPtr &deltabuf, const Rect &rect) |
void | visitRenderables (Renderable::Visitor *visitor, bool debugRenderables=false) |
Protected Attributes | |
AxisAlignedBox | mAABB |
uint16 | mBaseLod |
uint16 | mBoundaryX |
uint16 | mBoundaryY |
Real | mBoundingRadius |
TerrainQuadTreeNode * | mChildren [4] |
TerrainQuadTreeNode * | mChildWithMaxHeightDelta |
The child with the largest height delta. More... | |
int | mCurrentLod |
uint16 | mDepth |
Vector3 | mLocalCentre |
SceneNode * | mLocalNode |
LodLevelList | mLodLevels |
float | mLodTransition |
unsigned short | mMaterialLodIndex |
Movable * | mMovable |
TerrainQuadTreeNode * | mNodeWithVertexData |
uint16 | mOffsetX |
uint16 | mOffsetY |
TerrainQuadTreeNode * | mParent |
uint16 | mQuadrant |
Rend * | mRend |
bool | mSelfOrChildRendered |
uint16 | mSize |
the number of vertices at the original terrain resolution this node encompasses More... | |
Terrain * | mTerrain |
VertexDataRecord * | mVertexDataRecord |
Friends | |
class | Movable |
class | Rend |
A node in a quad tree used to store a patch of terrain.
Definition at line 85 of file OgreTerrainQuadTreeNode.h.
typedef vector<LodLevel*>::type Ogre::TerrainQuadTreeNode::LodLevelList |
Definition at line 149 of file OgreTerrainQuadTreeNode.h.
Ogre::TerrainQuadTreeNode::TerrainQuadTreeNode | ( | Terrain * | terrain, |
TerrainQuadTreeNode * | parent, | ||
uint16 | xoff, | ||
uint16 | yoff, | ||
uint16 | size, | ||
uint16 | lod, | ||
uint16 | depth, | ||
uint16 | quadrant | ||
) |
Constructor.
terrain | The ultimate parent terrain |
parent | Optional parent node (in which case xoff, yoff are 0 and size must be entire terrain) |
xoff,off | Offsets from the start of the terrain data in 2D |
size | The size of the node in vertices at the highest LOD |
lod | The base LOD level |
depth | The depth that this node is at in the tree (or convenience) |
quadrant | The index of the quadrant (0, 1, 2, 3) |
|
virtual |
void Ogre::TerrainQuadTreeNode::assignVertexData | ( | uint16 | treeDepthStart, |
uint16 | treeDepthEnd, | ||
uint16 | resolution, | ||
uint | sz | ||
) |
Assign vertex data to the tree, from a depth and at a given resolution.
treeDepthStart | The first depth of tree that should use this data, owns the data |
treeDepthEnd | The end of the depth that should use this data (exclusive) |
resolution | The resolution of the data to use (compared to full terrain) |
sz | The size of the data along one edge |
Calculate appropriate LOD for this node and children.
cam | The camera to be used (this should already be the LOD camera) |
cFactor | The cFactor which incorporates the viewport size, max pixel error and lod bias |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void Ogre::TerrainQuadTreeNode::finaliseDeltaValues | ( | const Rect & | rect | ) |
Promote the delta values calculated to the runtime ones (this must be called in the main thread).
const AxisAlignedBox& Ogre::TerrainQuadTreeNode::getAABB | ( | ) | const |
Get the AABB (local coords) of this node.
|
inline |
Get the base LOD level this node starts at (the highest LOD it handles)
Definition at line 108 of file OgreTerrainQuadTreeNode.h.
Real Ogre::TerrainQuadTreeNode::getBoundingRadius | ( | ) | const |
Get the bounding radius of this node.
|
protected |
TerrainQuadTreeNode* Ogre::TerrainQuadTreeNode::getChild | ( | unsigned short | child | ) | const |
Get child node.
|
inline |
Get the current LOD index (only valid after calculateCurrentLod)
Definition at line 243 of file OgreTerrainQuadTreeNode.h.
|
protected |
|
inline |
Get the local centre of this node, relative to parent terrain centre.
Definition at line 229 of file OgreTerrainQuadTreeNode.h.
uint16 Ogre::TerrainQuadTreeNode::getLodCount | ( | ) | const |
Get the number of LOD levels this node can represent itself (only > 1 for leaf nodes)
Get the LodLevel information for a given lod.
lod | The lod level index relative to this classes own list; if you want to use a global lod level, subtract getBaseLod() first. Higher LOD levels are lower detail. |
|
inline |
Get the transition state between the current LOD and the next lower one (only valid after calculateCurrentLod)
Definition at line 251 of file OgreTerrainQuadTreeNode.h.
|
protected |
Real Ogre::TerrainQuadTreeNode::getMaxHeight | ( | ) | const |
Get the maximum height of the node.
Real Ogre::TerrainQuadTreeNode::getMinHeight | ( | ) | const |
Get the minimum height of the node.
TerrainQuadTreeNode* Ogre::TerrainQuadTreeNode::getParent | ( | ) | const |
Get parent node.
|
protected |
|
protected |
Terrain* Ogre::TerrainQuadTreeNode::getTerrain | ( | ) | const |
Get ultimate parent terrain.
|
protected |
|
protected |
|
inline |
Get the horizontal offset into the main terrain data of this node.
Definition at line 102 of file OgreTerrainQuadTreeNode.h.
|
inline |
Get the vertical offset into the main terrain data of this node.
Definition at line 104 of file OgreTerrainQuadTreeNode.h.
bool Ogre::TerrainQuadTreeNode::isLeaf | ( | ) | const |
Is this a leaf node (no children)
bool Ogre::TerrainQuadTreeNode::isRenderedAtCurrentLod | ( | ) | const |
Returns whether this node is rendering itself at the current LOD level.
bool Ogre::TerrainQuadTreeNode::isSelfOrChildRenderedAtCurrentLod | ( | ) | const |
Returns whether this node or its children are being rendered at the current LOD level.
void Ogre::TerrainQuadTreeNode::load | ( | ) |
Load node and children (perform GPU tasks, will be render thread)
void Ogre::TerrainQuadTreeNode::mergeIntoBounds | ( | long | x, |
long | y, | ||
const Vector3 & | pos | ||
) |
Merge a point (relative to terrain node) into the local bounds, and that of children if applicable.
x,y | The point on the terrain to which this position corresponds (affects which nodes update their bounds) |
pos | The position relative to the terrain centre |
Notify the node (and children) of a height delta value.
|
inlineinherited |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
bool Ogre::TerrainQuadTreeNode::pointIntersectsNode | ( | long | x, |
long | y | ||
) |
Returns true if the given point is in the terrain area that this node references.
x,y | The point in top-level terrain coords |
|
protected |
void Ogre::TerrainQuadTreeNode::postDeltaCalculation | ( | const Rect & | rect | ) |
Notify the node (and children) that deltas have finished being calculated.
void Ogre::TerrainQuadTreeNode::preDeltaCalculation | ( | const Rect & | rect | ) |
Notify the node (and children) that deltas are going to be calculated for a given range.
void Ogre::TerrainQuadTreeNode::prepare | ( | ) |
Prepare node and children (perform CPU tasks, may be background thread)
void Ogre::TerrainQuadTreeNode::prepare | ( | StreamSerialiser & | stream | ) |
Prepare node from a stream.
bool Ogre::TerrainQuadTreeNode::rectContainsNode | ( | const Rect & | rect | ) |
Returns true if the given rectangle completely contains the terrain area that this node references.
rect | The region in top-level terrain coords |
bool Ogre::TerrainQuadTreeNode::rectIntersectsNode | ( | const Rect & | rect | ) |
Returns true if the given rectangle overlaps the terrain area that this node references.
rect | The region in top-level terrain coords |
void Ogre::TerrainQuadTreeNode::resetBounds | ( | const Rect & | rect | ) |
Reset the bounds of this node and all its children for the region given.
rect | The region for which bounds should be reset, in top-level terrain coords |
void Ogre::TerrainQuadTreeNode::save | ( | StreamSerialiser & | stream | ) |
Save node to a stream.
void Ogre::TerrainQuadTreeNode::setCurrentLod | ( | int | lod | ) |
Manually set the current LOD, intended for internal use only.
void Ogre::TerrainQuadTreeNode::setLodTransition | ( | float | t | ) |
Manually set the current LOD transition state, intended for internal use only.
void Ogre::TerrainQuadTreeNode::unload | ( | ) |
Unload node and children (perform GPU tasks, will be render thread)
void Ogre::TerrainQuadTreeNode::unprepare | ( | ) |
Unprepare node and children (perform CPU tasks, may be background thread)
|
protected |
|
protected |
|
protected |
void Ogre::TerrainQuadTreeNode::updateVertexData | ( | bool | positions, |
bool | deltas, | ||
const Rect & | rect, | ||
bool | cpuData | ||
) |
Tell the node to update its vertex data for a given region.
void Ogre::TerrainQuadTreeNode::useAncestorVertexData | ( | TerrainQuadTreeNode * | owner, |
uint16 | treeDepthEnd, | ||
uint16 | resolution | ||
) |
Tell a node that it should use an anscestor's vertex data.
treeDepthEnd | The end of the depth that should use this data (exclusive) |
resolution | The resolution of the data to use |
|
protected |
|
friend |
Definition at line 349 of file OgreTerrainQuadTreeNode.h.
|
friend |
Definition at line 371 of file OgreTerrainQuadTreeNode.h.
|
static |
Buffer binding used for holding delta values.
Definition at line 258 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 275 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 271 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 268 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 268 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 276 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 264 of file OgreTerrainQuadTreeNode.h.
|
protected |
The child with the largest height delta.
Definition at line 281 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 277 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 272 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 274 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 350 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 265 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 279 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 278 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 348 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 306 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 267 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 267 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 263 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 273 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 370 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 282 of file OgreTerrainQuadTreeNode.h.
|
protected |
the number of vertices at the original terrain resolution this node encompasses
Definition at line 270 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 262 of file OgreTerrainQuadTreeNode.h.
|
protected |
Definition at line 307 of file OgreTerrainQuadTreeNode.h.
|
static |
Buffer binding used for holding positions.
Definition at line 256 of file OgreTerrainQuadTreeNode.h.