39 #ifndef TERRAINRENDERABLE_H
40 #define TERRAINRENDERABLE_H
51 #define MORPH_CUSTOM_PARAM_ID 77
69 for(
size_t i=0; i<
mCache.size(); i++ )
138 #define STITCH_NORTH_SHIFT 0
139 #define STITCH_SOUTH_SHIFT 8
140 #define STITCH_WEST_SHIFT 16
141 #define STITCH_EAST_SHIFT 24
143 #define STITCH_NORTH 128 << STITCH_NORTH_SHIFT
144 #define STITCH_SOUTH 128 << STITCH_SOUTH_SHIFT
145 #define STITCH_WEST 128 << STITCH_WEST_SHIFT
146 #define STITCH_EAST 128 << STITCH_EAST_SHIFT
163 void deleteGeometry();
180 void initialise(
int startx,
int startz,
Real* pageHeightData);
197 virtual void _notifyCurrentCamera(
Camera* cam );
199 virtual void _updateRenderQueue(
RenderQueue* queue );
203 bool debugRenderables =
false);
218 virtual void getWorldTransforms(
Matrix4* xform )
const;
229 mForcedRenderLevel = i;
233 void _getNormalAt(
float x,
float y,
Vector3 * result );
236 float getHeightAt(
float x,
float y );
254 return mNeighbors[ n ];
264 void _calculateNormals();
275 Real getSquaredViewDepth(
const Camera* cam)
const;
284 void _updateCustomGpuParameter(
288 uint32 getTypeFlags(
void)
const;
296 inline size_t _index(
int x,
int z )
const
298 return ( x + z * mOptions->tileSize );
304 return mPositionBuffer[x * 3 + z * mOptions->tileSize * 3 + n];
312 for (
int i = 0; i < 4; i++ )
314 if ( mNeighbors[ i ] != 0 )
323 for (
int j = 0; j < 4; j++ )
325 if ( mNeighbors[ j ] != 0 && mNeighbors[ j ] ->mRenderLevel == i )
333 void _adjustRenderLevel(
int i );
335 bool _checkSize(
int n );
337 void _calculateMinLevelDist2(
Real C );
339 Real _calculateCFactor();
380 int mNextLevelDown[10];
384 IndexData* generateTriStripIndexes(
unsigned int stitchFlags);
386 IndexData* generateTriListIndexes(
unsigned int stitchFlags);
401 int stitchEdge(
Neighbor neighbor,
int hiLOD,
int loLOD,
402 bool omitFirstTri,
bool omitLastTri,
unsigned short** ppIdx);
Real lodMorphStart
At what point (parametric) should LOD morphing start.
void setMaterial(const MaterialPtr &m)
LightList mLightList
Cached light list.
A viewpoint from which the scene will be rendered.
TerrainRenderable * _getNeighbor(Neighbor n)
Returns the neighbor TerrainRenderable.
#define _OgreOctreePluginExport
bool coloured
Whether vertex colours are enabled.
Class encapsulating a standard 4x4 homogeneous matrix.
map< unsigned int, IndexData * >::type IndexMap
float Real
Software floating point type.
Real * mMinLevelDistSqr
List of squared distances at which LODs change.
bool lodMorph
Whether LOD morphing is enabled.
Real mBoundingRadius
The bounding radius of this tile.
A simple class for encapsulating parameters which are commonly needed by both TerrainSceneManager and...
size_t tilesPerPage
Precalculated number of tiles per page.
MaterialPtr mMaterial
Current material used by this tile.
Real getBoundingRadius(void) const
Overridden from MovableObject.
AxisAlignedBox mBounds
Bounding box of this tile.
Class representing colour.
size_t maxGeoMipMapLevel
The maximum terrain geo-mipmap level.
VertexBufferList mDeltaBuffers
size_t pageSize
The size of one edge of a terrain page, in vertices.
HardwareVertexBufferSharedPtr mMainBuffer
The buffer with all the renderable geometry in it.
Shared pointer implementation used to share index buffers.
A 3D box aligned with the x/y/z axes.
virtual const MaterialPtr & getMaterial(void) const
Retrieves a weak reference to the material this renderable object uses.
bool _hasNeighborRenderLevel(int i) const
int mLastNextLevel
The previous 'next' LOD level down, for frame coherency.
float _vertex(int x, int z, int n)
Returns the vertex coord for the given coordinates.
TerrainSceneManager * mSceneManager
Parent SceneManager.
Vector3 scale
The scale factor to apply to the terrain (each vertex is 1 unscaled unit away from the next...
vector< IndexData * >::type IndexArray
void _setNeighbor(Neighbor n, TerrainRenderable *t)
Sets the appropriate neighbor for this TerrainRenderable.
Abstract class defining a movable object in a scene.
size_t maxPixelError
The maximum pixel error allowed.
size_t _index(int x, int z) const
Returns the index into the height array for the given coords.
Abstract class defining the interface all renderable objects must implement.
Structure recording the use of an automatic parameter.
This is a basic SceneManager for organizing TerrainRenderables into a total landscape.
float * mPositionBuffer
System-memory buffer with just positions in it, for CPU operations.
bool mLightListDirty
Whether light list need to re-calculate.
A cache of TerrainIndexBuffers.
size_t detailTile
The number of times to repeat a detail texture over a tile.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Collects together the program parameters used for a GpuProgram.
Summary class collecting together index data source information.
Vector3 mCenter
The center point of this tile.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly...
int mRenderLevel
The current LOD level.
vector< HardwareVertexBufferSharedPtr >::type VertexBufferList
Optional set of delta buffers, used to morph from one LOD to the next.
const TerrainOptions * mOptions
Link to shared options.
size_t tileSize
The size of one edge of a terrain tile, in vertices.
MaterialPtr terrainMaterial
Pointer to the material to use to render the terrain.
Standard 3-dimensional vector.
std::map< K, V, P, A > type
const Camera * primaryCamera
The primary camera, used for error metric calculation and page choice.
bool lit
Whether dynamic lighting is enabled.
Summary class collecting together vertex source information.
'New' rendering operation using vertex buffers.
const AxisAlignedBox & getBoundingBox(void) const
Returns the bounding box of this TerrainRenderable.
int mForcedRenderLevel
Forced rendering LOD level, optional.
int _numNeighbors() const
vector< IndexMap * >::type LevelArray
Class to manage the scene object rendering queue.
int getRenderLevel() const
Returns the mipmap level that will be rendered for this frame.
static String mType
The MovableObject type.
bool mInit
Whether this tile has been initialised.
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
bool useTriStrips
Whether we should use triangle strips.
Real mLODMorphFactor
The morph factor between this and the next LOD level down.
static const Vector3 UNIT_SCALE
virtual const String & getMovableType(void) const
Returns the type of the movable.
void setForcedRenderLevel(int i)
Forces the LOD to the given level from this point on.
Represents a terrain tile.