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);
float getLodTransition() const
Get the transition state between the current LOD and the next lower one (only valid after calculateCu...
AxisAlignedBox mAABB
Relative to terrain centre.
Abstract class defining the interface all renderable objects must implement.
static unsigned short POSITION_BUFFER
Buffer binding used for holding positions.
VertexDataRecord(uint16 res, uint16 sz, uint16 lvls)
bool gpuVertexDataDirty
Is the GPU vertex data out of date?
uint16 mSize
The number of vertices at the original terrain resolution this node encompasses.
Abstract class defining a movable object in a scene.
uint16 batchSize
Number of vertices rendered down one side (not including skirts)
Summary class collecting together vertex source information.
Real calcMaxHeightDelta
Temp calc area for max height delta.
uint16 resolution
Resolution of the data compared to the base terrain data (NOT number of vertices!) ...
float Real
Software floating point type.
Class to manage the scene object rendering queue.
VertexData * cpuVertexData
Summary class collecting together index data source information.
Class representing a node in the scene graph.
bool mSelfOrChildRendered
Real maxHeightDelta
Maximum delta height between this and the next lower lod.
Real lastCFactor
The cFactor value used to calculate transitionDist.
uint16 numSkirtRowsCols
Number of rows and columns of skirts.
int mCurrentLod
Relative to mLocalCentre.
Real lastTransitionDist
The most recently calculated transition distance.
TerrainQuadTreeNode * mParent
Class encapsulating a standard 4x4 homogeneous matrix.
The main containing class for a chunk of terrain.
Standard 3-dimensional vector.
Shared pointer implementation used to share vertex buffers.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly...
VertexData * gpuVertexData
uint16 getXOffset() const
Get the horizontal offset into the main terrain data of this node.
unsigned short mMaterialLodIndex
-1 = none (do not render)
uint16 skirtRowColSkip
The number of rows / cols to skip in between skirts.
#define _OgreTerrainExport
Utility class providing helper methods for reading / writing structured data held in a DataStream...
TerrainQuadTreeNode * mParent
MovableObject implementation to provide the hook to the scene.
A viewpoint from which the scene will be rendered.
A node in a quad tree used to store a patch of terrain.
int getCurrentLod() const
Get the current LOD index (only valid after calculateCurrentLod)
static unsigned short DELTA_BUFFER
Buffer binding used for holding delta values.
VertexDataRecord * mVertexDataRecord
uint16 treeLevels
Number of quadtree levels (including this one) this data applies to.
const Vector3 & getLocalCentre() const
Get the local centre of this node, relative to parent terrain centre.
vector< LodLevel * >::type LodLevelList
Hook to the render queue.
TerrainQuadTreeNode * mParent
'New' rendering operation using vertex buffers.
Class representing an approach to rendering this particular Material.
Real mBoundingRadius
Relative to mLocalCentre.
uint16 getBaseLod() const
Get the base LOD level this node starts at (the highest LOD it handles)
uint16 getYOffset() const
Get the vertical offset into the main terrain data of this node.
A 3D box aligned with the x/y/z axes.
uint16 size
Size of the data along one edge.
IndexData * gpuIndexData
Index data on the gpu.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
TerrainQuadTreeNode * mNodeWithVertexData