|
| TerrainQuadTreeNode (Terrain *terrain, TerrainQuadTreeNode *parent, uint16 xoff, uint16 yoff, uint16 size, uint16 lod, uint16 depth, uint16 quadrant) |
| Constructor. More...
|
|
virtual | ~TerrainQuadTreeNode () |
|
Renderable * | _getRenderable () |
| Returns the internal renderable object for this node. More...
|
|
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 | load (uint16 depthStart, uint16 depthEnd) |
| Load node and children in a depth range (perform GPU tasks, will be render thread) More...
|
|
void | loadSelf () |
|
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...
|
|
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 | unload (uint16 depthStart, uint16 depthEnd) |
| Unload node and children in a depth range (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...
|
|
A node in a quad tree used to store a patch of terrain.
- Our goal is to perform traditional chunked LOD with geomorphing. But, instead of just dividing the terrain into tiles, we will divide them into a hierarchy of tiles, a quadtree, where any level of the quadtree can be a rendered tile (to the exclusion of its children). The idea is to collect together children into a larger batch with their siblings as LOD decreases, to improve performance.
- The minBatchSize and maxBatchSize parameters on Terrain a key to defining this behaviour. Both values are expressed in vertices down one axis. maxBatchSize determines the number of tiles on one side of the terrain, which is numTiles = (terrainSize-1) / (maxBatchSize-1). This in turn determines the depth of the quad tree, which is sqrt(numTiles). The minBatchSize determines the 'floor' of how low the number of vertices can go in a tile before it has to be grouped together with its siblings to drop any lower. We also do not group a tile with its siblings unless all of them are at this minimum batch size, rather than trying to group them when they all end up on the same 'middle' LOD; this is for several reasons; firstly, tiles hitting the same 'middle' LOD is less likely and more transient if they have different levels of 'roughness', and secondly since we're sharing a vertex / index pool between all tiles, only grouping at the min level means that the number of combinations of buffer sizes for any one tile is greatly simplified, making it easier to pool data. To be more specific, any tile / quadtree node can only have log2(maxBatchSize-1) - log2(minBatchSize-1) + 1 LOD levels (and if you set them to the same value, LOD can only change by going up/down the quadtree). The numbers of vertices / indices in each of these levels is constant for the same (relative) LOD index no matter where you are in the tree, therefore buffers can potentially be reused more easily.