36 #ifndef TERRAINZONERENDERABLE_H
37 #define TERRAINZONERENDERABLE_H
48 #define MORPH_CUSTOM_PARAM_ID 77
53 typedef map<unsigned int, IndexData* >::type
IndexMap;
66 for(
size_t i=0; i<
mCache.size(); i++ )
135 #define STITCH_NORTH_SHIFT 0
136 #define STITCH_SOUTH_SHIFT 8
137 #define STITCH_WEST_SHIFT 16
138 #define STITCH_EAST_SHIFT 24
140 #define STITCH_NORTH 128 << STITCH_NORTH_SHIFT
141 #define STITCH_SOUTH 128 << STITCH_SOUTH_SHIFT
142 #define STITCH_WEST 128 << STITCH_WEST_SHIFT
143 #define STITCH_EAST 128 << STITCH_EAST_SHIFT
160 void deleteGeometry();
177 void initialise(
int startx,
int startz,
Real* pageHeightData);
194 virtual void _notifyCurrentCamera(
Camera* cam );
196 virtual void _updateRenderQueue(
RenderQueue* queue );
200 bool debugRenderables =
false);
214 virtual void getWorldTransforms(
Matrix4* xform )
const;
216 virtual const Quaternion& getWorldOrientation(
void)
const;
217 virtual const Vector3& getWorldPosition(
void)
const;
228 mForcedRenderLevel = i;
232 void _getNormalAt(
float x,
float y,
Vector3 * result );
235 float getHeightAt(
float x,
float y );
253 return mNeighbors[ n ];
263 void _calculateNormals();
274 Real getSquaredViewDepth(
const Camera* cam)
const;
283 void _updateCustomGpuParameter(
287 uint32 getTypeFlags(
void)
const;
295 inline size_t _index(
int x,
int z )
const
297 return ( x + z * mOptions->tileSize );
303 return mPositionBuffer[x * 3 + z * mOptions->tileSize * 3 + n];
311 for (
int i = 0; i < 4; i++ )
313 if ( mNeighbors[ i ] != 0 )
322 for (
int j = 0; j < 4; j++ )
324 if ( mNeighbors[ j ] != 0 && mNeighbors[ j ] ->mRenderLevel == i )
332 void _adjustRenderLevel(
int i );
334 bool _checkSize(
int n );
336 void _calculateMinLevelDist2(
Real C );
338 Real _calculateCFactor();
379 int mNextLevelDown[10];
383 IndexData* generateTriStripIndexes(
unsigned int stitchFlags);
385 IndexData* generateTriListIndexes(
unsigned int stitchFlags);
400 int stitchEdge(
Neighbor neighbor,
int hiLOD,
int loLOD,
401 bool omitFirstTri,
bool omitLastTri,
unsigned short** ppIdx);
int _numNeighbors() const
size_t tilesPerPage
Precalculated number of tiles per page.
A viewpoint from which the scene will be rendered.
void setForcedRenderLevel(int i)
Forces the LOD to the given level from this point on.
Real getBoundingRadius(void) const
Overridden from MovableObject.
Class encapsulating a standard 4x4 homogeneous matrix.
bool lodMorph
Whether LOD morphing is enabled.
LightList mLightList
Cached light list.
map< unsigned int, IndexData * >::type IndexMap
float Real
Software floating point type.
std::vector< IndexData *, A > type
This is a basic PCZone for organizing TerrainRenderables into a total landscape.
Class representing colour.
const Camera * primaryCamera
The primary camera, used for error metric calculation and page choice.
const TerrainZoneOptions * mOptions
Link to shared options.
bool coloured
Whether vertex colours are enabled.
A simple class for encapsulating parameters which are commonly needed by both TerrainSceneManager and...
Shared pointer implementation used to share index buffers.
A 3D box aligned with the x/y/z axes.
VertexBufferList mDeltaBuffers
size_t detailTile
The number of times to repeat a detail texture over a tile.
float * mPositionBuffer
System-memory buffer with just positions in it, for CPU operations.
#define _OgreOctreeZonePluginExport
vector< IndexData * >::type IndexArray
Abstract class defining a movable object in a scene.
Abstract class defining the interface all renderable objects must implement.
Implementation of a Quaternion, i.e.
size_t maxPixelError
The maximum pixel error allowed.
bool mInit
Whether this tile has been initialised.
TerrainZoneRenderable * _getNeighbor(Neighbor n)
Returns the neighbor TerrainZoneRenderable.
Structure recording the use of an automatic parameter.
Vector3 scale
The scale factor to apply to the terrain (each vertex is 1 unscaled unit away from the next...
const AxisAlignedBox & getBoundingBox(void) const
Returns the bounding box of this TerrainZoneRenderable.
int mLastNextLevel
The previous 'next' LOD level down, for frame coherency.
AxisAlignedBox mBounds
Bounding box of this tile.
size_t tileSize
The size of one edge of a terrain tile, in vertices.
int mRenderLevel
The current LOD level.
void _setNeighbor(Neighbor n, TerrainZoneRenderable *t)
Sets the appropriate neighbor for this TerrainZoneRenderable.
size_t pageSize
The size of one edge of a terrain page, in vertices.
bool lit
Whether dynamic lighting is enabled.
virtual const MaterialPtr & getMaterial(void) const
Retrieves a weak reference to the material this renderable object uses.
void setMaterial(const MaterialPtr &m)
int getRenderLevel() const
Returns the mipmap level that will be rendered for this frame.
Real lodMorphStart
At what point (parametric) should LOD morphing start.
Collects together the program parameters used for a GpuProgram.
bool mLightListDirty
Whether light list need to re-calculate.
Summary class collecting together index data source information.
TerrainZone * mTerrainZone
Parent Zone.
Real * mMinLevelDistSqr
List of squared distances at which LODs change.
bool useTriStrips
Whether we should use triangle strips.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly...
MaterialPtr terrainMaterial
Pointer to the material to use to render the terrain.
HardwareVertexBufferSharedPtr mMainBuffer
The buffer with all the renderable geometry in it.
Standard 3-dimensional vector.
A cache of TerrainIndexBuffers.
MaterialPtr mMaterial
Current material used by this tile.
~TerrainZoneBufferCache()
Summary class collecting together vertex source information.
'New' rendering operation using vertex buffers.
virtual const String & getMovableType(void) const
Returns the type of the movable.
vector< HardwareVertexBufferSharedPtr >::type VertexBufferList
Optional set of delta buffers, used to morph from one LOD to the next.
vector< IndexMap * >::type LevelArray
Class to manage the scene object rendering queue.
Represents a terrain tile.
bool _hasNeighborRenderLevel(int i) const
size_t _index(int x, int z) const
Returns the index into the height array for the given coords.
Real mBoundingRadius
The bounding radius of this tile.
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
float _vertex(int x, int z, int n)
Returns the vertex coord for the given coordinates.
Real mLODMorphFactor
The morph factor between this and the next LOD level down.
size_t maxGeoMipMapLevel
The maximum terrain geo-mipmap level.
static const Vector3 UNIT_SCALE
int mForcedRenderLevel
Forced rendering LOD level, optional.
Vector3 mCenter
The center point of this tile.
static String mType
The MovableObject type.