29 #ifndef __Ogre_TerrainQuadTreeNode_H__
30 #define __Ogre_TerrainQuadTreeNode_H__
42 class HardwareVertexBufferSharedPtr;
110 uint16 getLodCount()
const;
151 LodLevel() : batchSize(0), gpuIndexData(0), maxHeightDelta(0), calcMaxHeightDelta(0),
152 lastTransitionDist(0), lastCFactor(0) {}
167 void preDeltaCalculation(
const Rect& rect);
174 void postDeltaCalculation(
const Rect& rect);
179 void finaliseDeltaValues(
const Rect& rect);
197 void updateVertexData(
bool positions,
bool deltas,
const Rect& rect,
bool cpuData);
207 void mergeIntoBounds(
long x,
long y,
const Vector3& pos);
211 void resetBounds(
const Rect& rect);
217 bool rectIntersectsNode(
const Rect& rect);
222 bool rectContainsNode(
const Rect& rect);
227 bool pointIntersectsNode(
long x,
long y);
232 Real getBoundingRadius()
const;
236 Real getMinHeight()
const;
238 Real getMaxHeight()
const;
245 bool calculateCurrentLod(
const Camera* cam,
Real cFactor);
250 bool isRenderedAtCurrentLod()
const;
252 bool isSelfOrChildRenderedAtCurrentLod()
const;
254 void setCurrentLod(
int lod);
258 void setLodTransition(
float t);
308 : cpuVertexData(0), gpuVertexData(0), resolution(res), size(sz),
309 treeLevels(lvls), numSkirtRowsCols(0),
310 skirtRowColSkip(0), gpuVertexDataDirty(false) {}
344 const String& getMovableType(
void)
const;
346 Real getBoundingRadius(
void)
const;
349 bool isVisible(
void)
const;
350 uint32 getVisibilityFlags(
void)
const;
351 uint32 getQueryFlags(
void)
const;
352 bool getCastShadows(
void)
const;
371 void getWorldTransforms(
Matrix4* xform)
const;
372 Real getSquaredViewDepth(
const Camera* cam)
const;
374 bool getCastsShadows(
void)
const;
387 void getWorldTransforms(
Matrix4* xform)
const;
388 Real getSquaredViewDepth(
const Camera* cam)
const;
390 bool getCastsShadows(
void)
const;
394 void createCpuVertexData();
399 void destroyCpuVertexData();
401 void createGpuVertexData();
402 void destroyGpuVertexData();
403 void updateGpuVertexData();
404 void createGpuIndexData();
405 void destroyGpuIndexData();
408 void writePosVertex(
bool compress,
uint16 x,
uint16 y,
float height,
const Vector3& pos,
float uvScale,
float** ppPos);
409 void writeDeltaVertex(
bool compress,
uint16 x,
uint16 y,
float delta,
float deltaThresh,
float** ppDelta);
411 uint16 calcSkirtVertexIndex(
uint16 mainIndex,
bool isCol);
A viewpoint from which the scene will be rendered.
TerrainQuadTreeNode * mParent
Class encapsulating a standard 4x4 homogeneous matrix.
uint16 batchSize
Number of vertices rendered down one side (not including skirts)
float Real
Software floating point type.
VertexData * gpuVertexData
uint16 getXOffset() const
Get the horizontal offset into the main terrain data of this node.
The main containing class for a chunk of terrain.
IndexData * gpuIndexData
Index data on the gpu.
Real mBoundingRadius
Relative to mLocalCentre.
VertexDataRecord * mVertexDataRecord
uint16 skirtRowColSkip
The number of rows / cols to skip in between skirts.
Real calcMaxHeightDelta
Temp calc area for max height delta.
uint16 treeLevels
Number of quadtree levels (including this one) this data applies to.
Shared pointer implementation used to share vertex buffers.
A 3D box aligned with the x/y/z axes.
vector< LodLevel * >::type LodLevelList
Class representing an approach to rendering this particular Material.
Abstract class defining a movable object in a scene.
Class representing a node in the scene graph.
Abstract class defining the interface all renderable objects must implement.
TerrainQuadTreeNode * mParent
Hook to the render queue.
uint16 resolution
Resolution of the data compared to the base terrain data (NOT number of vertices!) ...
AxisAlignedBox mAABB
Relative to terrain centre.
Real maxHeightDelta
Maximum delta height between this and the next lower lod.
unsigned short mMaterialLodIndex
-1 = none (do not render)
uint16 getBaseLod() const
Get the base LOD level this node starts at (the highest LOD it handles)
static unsigned short DELTA_BUFFER
Buffer binding used for holding delta values.
int getCurrentLod() const
Get the current LOD index (only valid after calculateCurrentLod)
TerrainQuadTreeNode * mParent
float getLodTransition() const
Get the transition state between the current LOD and the next lower one (only valid after calculateCu...
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Summary class collecting together index data source information.
VertexDataRecord(uint16 res, uint16 sz, uint16 lvls)
#define _OgreTerrainExport
Visitor object that can be used to iterate over a collection of Renderable instances abstractly...
static unsigned short POSITION_BUFFER
Buffer binding used for holding positions.
uint16 getYOffset() const
Get the vertical offset into the main terrain data of this node.
Utility class providing helper methods for reading / writing structured data held in a DataStream...
Standard 3-dimensional vector.
uint16 size
Size of the data along one edge.
Real lastCFactor
The cFactor value used to calculate transitionDist.
uint16 numSkirtRowsCols
Number of rows and columns of skirts.
Summary class collecting together vertex source information.
'New' rendering operation using vertex buffers.
VertexData * cpuVertexData
Real lastTransitionDist
The most recently calculated transition distance.
Class to manage the scene object rendering queue.
const Vector3 & getLocalCentre() const
Get the local centre of this node, relative to parent terrain centre.
MovableObject implementation to provide the hook to the scene.
int mCurrentLod
Relative to mLocalCentre.
bool gpuVertexDataDirty
Is the GPU vertex data out of date?
TerrainQuadTreeNode * mNodeWithVertexData
A node in a quad tree used to store a patch of terrain.
bool mSelfOrChildRendered
uint16 mSize
The number of vertices at the original terrain resolution this node encompasses.