Go to the documentation of this file.
29 #ifndef __Ogre_TerrainQuadTreeNode_H__
30 #define __Ogre_TerrainQuadTreeNode_H__
42 class HardwareVertexBufferSharedPtr;
151 LodLevel() : batchSize(0), gpuIndexData(0), maxHeightDelta(0), calcMaxHeightDelta(0),
152 lastTransitionDist(0), lastCFactor(0) {}
308 : cpuVertexData(0), gpuVertexData(0), resolution(res), size(sz),
309 treeLevels(lvls), numSkirtRowsCols(0),
310 skirtRowColSkip(0), gpuVertexDataDirty(false) {}
VertexData * cpuVertexData
uint16 getXOffset() const
Get the horizontal offset into the main terrain data of this node.
bool getCastShadows(void) const
Returns whether shadow casting is enabled for this object.
uint32 getQueryFlags(void) const
Returns the query flags relevant for this object.
void getRenderOperation(RenderOperation &op)
Gets the render operation required to send this object to the frame buffer.
void notifyDelta(uint16 x, uint16 y, uint16 lod, Real delta)
Notify the node (and children) of a height delta value.
void load()
Load node and children (perform GPU tasks, will be render thread)
TerrainQuadTreeNode(Terrain *terrain, TerrainQuadTreeNode *parent, uint16 xoff, uint16 yoff, uint16 size, uint16 lod, uint16 depth, uint16 quadrant)
Constructor.
Real getSquaredViewDepth(const Camera *cam) const
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
bool getCastsShadows(void) const
Real calcMaxHeightDelta
Temp calc area for max height delta.
void createGpuIndexData()
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject ...
A viewpoint from which the scene will be rendered.
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.
bool isVisible(void) const
Returns whether or not this object is supposed to be visible or not.
void setCurrentLod(int lod)
Manually set the current LOD, intended for internal use only.
VertexDataRecord * mVertexDataRecord
uint16 skirtRowColSkip
The number of rows / cols to skip in between skirts.
IndexData * gpuIndexData
Index data on the gpu.
TerrainQuadTreeNode * mParent
void resetBounds(const Rect &rect)
Reset the bounds of this node and all its children for the region given.
Technique * getTechnique(void) const
TerrainQuadTreeNode * getChild(unsigned short child) const
Get child node.
#define _OgreTerrainExport
int mCurrentLod
Relative to mLocalCentre.
void unload()
Unload node and children (perform GPU tasks, will be render thread)
uint16 batchSize
Number of vertices rendered down one side (not including skirts)
void preDeltaCalculation(const Rect &rect)
Notify the node (and children) that deltas are going to be calculated for a given range.
uint16 getBaseLod() const
Get the base LOD level this node starts at (the highest LOD it handles)
const LightList & getLights(void) const
int getCurrentLod() const
Get the current LOD index (only valid after calculateCurrentLod)
The main containing class for a chunk of terrain.
void finaliseDeltaValues(const Rect &rect)
Promote the delta values calculated to the runtime ones (this must be called in the main thread).
bool isRenderedAtCurrentLod() const
Returns whether this node is rendering itself at the current LOD level.
Abstract class defining a movable object in a scene.
Real getMinHeight() const
Get the minimum height of the node.
void updateVertexData(bool positions, bool deltas, const Rect &rect, bool cpuData)
Tell the node to update its vertex data for a given region.
bool rectIntersectsNode(const Rect &rect)
Returns true if the given rectangle overlaps the terrain area that this node references.
unsigned short mMaterialLodIndex
-1 = none (do not render)
Technique * getTechnique(void) const
Retrieves a pointer to the Material Technique this renderable object uses.
VertexDataRecord(uint16 res, uint16 sz, uint16 lvls)
Class representing an approach to rendering this particular Material.
void unload(uint16 depthStart, uint16 depthEnd)
Unload node and children in a depth range (perform GPU tasks, will be render thread)
Rend(TerrainQuadTreeNode *parent)
Real lastCFactor
The cFactor value used to calculate transitionDist.
Class representing a node in the scene graph.
void writeDeltaVertex(bool compress, uint16 x, uint16 y, float delta, float deltaThresh, float **ppDelta)
A node in a quad tree used to store a patch of terrain.
void assignVertexData(uint16 treeDepthStart, uint16 treeDepthEnd, uint16 resolution, uint sz)
Assign vertex data to the tree, from a depth and at a given resolution.
bool mSelfOrChildRendered
Summary class collecting together vertex source information.
Real getBoundingRadius() const
Get the bounding radius of this node.
void save(StreamSerialiser &stream)
Save node to a stream.
void getWorldTransforms(Matrix4 *xform) const
void load(uint16 depthStart, uint16 depthEnd)
Load node and children in a depth range (perform GPU tasks, will be render thread)
const VertexDataRecord * getVertexDataRecord() const
void updateRenderQueue(RenderQueue *queue)
Class encapsulating a standard 4x4 homogeneous matrix.
uint16 calcSkirtVertexIndex(uint16 mainIndex, bool isCol)
uint32 getVisibilityFlags(void) const
Returns the visibility flags relevant for this object.
bool pointIntersectsNode(long x, long y)
Returns true if the given point is in the terrain area that this node references.
Real maxHeightDelta
Maximum delta height between this and the next lower lod.
TerrainQuadTreeNode * mNodeWithVertexData
bool isSelfOrChildRenderedAtCurrentLod() const
Returns whether this node or its children are being rendered at the current LOD level.
Shared pointer implementation used to share vertex buffers.
const String & getMovableType(void) const
Returns the type name of this object.
void populateIndexData(uint16 batchSize, IndexData *destData)
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
bool getCastsShadows(void) const
Method which reports whether this renderable would normally cast a shadow.
TerrainQuadTreeNode * mParent
void useAncestorVertexData(TerrainQuadTreeNode *owner, uint16 treeDepthEnd, uint16 resolution)
Tell a node that it should use an anscestor's vertex data.
const MaterialPtr & getMaterial(void) const
virtual ~TerrainQuadTreeNode()
void getWorldTransforms(Matrix4 *xform) const
Gets the world transform matrix / matrices for this renderable object.
uint16 numSkirtRowsCols
Number of rows and columns of skirts.
Renderable * _getRenderable()
Returns the internal renderable object for this node.
void getRenderOperation(RenderOperation &op)
void writePosVertex(bool compress, uint16 x, uint16 y, float height, const Vector3 &pos, float uvScale, float **ppPos)
uint16 treeLevels
Number of quadtree levels (including this one) this data applies to.
A 3D box aligned with the x/y/z axes.
AxisAlignedBox mAABB
Relative to terrain centre.
uint16 getYOffset() const
Get the vertical offset into the main terrain data of this node.
void _updateRenderQueue(RenderQueue *queue)
Internal method by which the movable object must add Renderable subclass instances to the rendering q...
Real lastTransitionDist
The most recently calculated transition distance.
void prepare(StreamSerialiser &stream)
Prepare node from a stream.
MovableObject implementation to provide the hook to the scene.
const AxisAlignedBox & getBoundingBox(void) const
Retrieves the local axis-aligned bounding box for this object.
void destroyCpuVertexData()
Utility class providing helper methods for reading / writing structured data held in a DataStream.
const Vector3 & getLocalCentre() const
Get the local centre of this node, relative to parent terrain centre.
uint16 size
Size of the data along one edge.
Hook to the render queue.
void postDeltaCalculation(const Rect &rect)
Notify the node (and children) that deltas have finished being calculated.
Real getSquaredViewDepth(const Camera *cam) const
Returns the camera-relative squared depth of this renderable.
void updateVertexBuffer(HardwareVertexBufferSharedPtr &posbuf, HardwareVertexBufferSharedPtr &deltabuf, const Rect &rect)
vector< LodLevel * >::type LodLevelList
bool gpuVertexDataDirty
Is the GPU vertex data out of date?
Visitor object that can be used to iterate over a collection of Renderable instances abstractly.
uint16 resolution
Resolution of the data compared to the base terrain data (NOT number of vertices!)
static unsigned short DELTA_BUFFER
Buffer binding used for holding delta values.
uint16 getLodCount() const
Get the number of LOD levels this node can represent itself (only > 1 for leaf nodes)
Abstract class defining the interface all renderable objects must implement.
const LodLevel * getLodLevel(uint16 lod)
Get the LodLevel information for a given lod.
void updateGpuVertexData()
const LightList & getLights(void) const
Gets a list of lights, ordered relative to how close they are to this renderable.
Real getMaxHeight() const
Get the maximum height of the node.
void setLodTransition(float t)
Manually set the current LOD transition state, intended for internal use only.
float Real
Software floating point type.
void createGpuVertexData()
TerrainQuadTreeNode * getParent() const
Get parent node.
bool isLeaf() const
Is this a leaf node (no children)
void prepare()
Prepare node and children (perform CPU tasks, may be background thread)
Real getBoundingRadius(void) const
Retrieves the radius of the origin-centered bounding sphere for this object.
bool rectContainsNode(const Rect &rect)
Returns true if the given rectangle completely contains the terrain area that this node references.
TerrainQuadTreeNode * mParent
void destroyGpuIndexData()
const AxisAlignedBox & getAABB() const
Get the AABB (local coords) of this node.
void unprepare()
Unprepare node and children (perform CPU tasks, may be background thread)
VertexData * gpuVertexData
void destroyGpuVertexData()
bool calculateCurrentLod(const Camera *cam, Real cFactor)
Calculate appropriate LOD for this node and children.
Summary class collecting together index data source information.
Real mBoundingRadius
Relative to mLocalCentre.
Standard 3-dimensional vector.
'New' rendering operation using vertex buffers.
Terrain * getTerrain() const
Get ultimate parent terrain.
Class to manage the scene object rendering queue.
static unsigned short POSITION_BUFFER
Buffer binding used for holding positions.
float getLodTransition() const
Get the transition state between the current LOD and the next lower one (only valid after calculateCu...
uint16 mSize
The number of vertices at the original terrain resolution this node encompasses.
Movable(TerrainQuadTreeNode *parent)
const MaterialPtr & getMaterial(void) const
Retrieves a weak reference to the material this renderable object uses.
void createCpuVertexData()
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.