OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
The main containing class for a chunk of terrain. More...
#include <OgreTerrain.h>
Classes | |
class | DefaultGpuBufferAllocator |
Standard implementation of a buffer allocator which re-uses buffers. More... | |
class | GpuBufferAllocator |
Interface used to by the Terrain instance to allocate GPU buffers. More... | |
struct | ImportData |
Structure encapsulating import data that you may use to bootstrap the terrain without loading from a native data stream. More... | |
struct | LayerInstance |
An instance of a layer, with specific texture names. More... | |
Public Types | |
enum | Alignment { ALIGN_X_Z = 0 , ALIGN_X_Y = 1 , ALIGN_Y_Z = 2 } |
The alignment of the terrain. More... | |
typedef std::vector< LayerInstance > | LayerInstanceList |
enum | NeighbourIndex { NEIGHBOUR_EAST = 0 , NEIGHBOUR_NORTHEAST = 1 , NEIGHBOUR_NORTH = 2 , NEIGHBOUR_NORTHWEST = 3 , NEIGHBOUR_WEST = 4 , NEIGHBOUR_SOUTHWEST = 5 , NEIGHBOUR_SOUTH = 6 , NEIGHBOUR_SOUTHEAST = 7 , NEIGHBOUR_COUNT = 8 } |
Neighbour index enumeration - indexed anticlockwise from East like angles. More... | |
typedef std::vector< Real > | RealVector |
enum | Space { WORLD_SPACE = 0 , LOCAL_SPACE = 1 , TERRAIN_SPACE = 2 , POINT_SPACE = 3 } |
Enumeration of relative spaces that you might want to use to address the terrain. More... | |
Public Member Functions | |
Terrain (SceneManager *sm) | |
Constructor. | |
virtual | ~Terrain () |
void | _dirtyCompositeMapRect (const Rect &rect) |
Mark a region of the terrain composite map as dirty. | |
void | _dumpTextures (const String &prefix, const String &suffix) |
Dump textures to files. | |
const MaterialPtr & | _getCompositeMapMaterial () const |
Internal getting of material for the terrain composite map. | |
const String & | _getDerivedResourceGroup () const |
Get the final resource group to use when loading / saving. | |
const MaterialPtr & | _getMaterial () const |
Internal getting of material. | |
SceneNode * | _getRootSceneNode () const |
Get the root scene node for the terrain (internal use only) | |
bool | _getUseVertexCompression () const |
Whether we're using vertex compression or not. | |
void | addQueryFlags (uint32 flags) |
As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object. | |
Rect | calculateHeightDeltas (const Rect &rect) |
Calculate (or recalculate) the delta values of heights between a vertex in its recorded position, and the place it will end up in the LOD in which it is removed. | |
PixelBox * | calculateLightmap (const Rect &rect, const Rect &extraTargetRect, Rect &outFinalRect) |
Calculate (or recalculate) the terrain lightmap. | |
PixelBox * | calculateNormals (const Rect &rect, Rect &outFinalRect) |
Calculate (or recalculate) the normals on the terrain. | |
Vector3 | convertDirection (Space inSpace, const Vector3 &inDir, Space outSpace) const |
Convert a direction from one space to another with respect to this terrain. | |
void | convertDirection (Space inSpace, const Vector3 &inDir, Space outSpace, Vector3 &outDir) const |
Convert a direction from one space to another with respect to this terrain. | |
Vector3 | convertPosition (Space inSpace, const Vector3 &inPos, Space outSpace) const |
Convert a position from one space to another with respect to this terrain. | |
void | convertPosition (Space inSpace, const Vector3 &inPos, Space outSpace, Vector3 &outPos) const |
Convert a position from one space to another with respect to this terrain. | |
void | decreaseLodLevel () |
Removes highest LOD level loaded. | |
void | dirty () |
Mark the entire terrain as dirty. | |
void | dirtyLightmap () |
Mark a the entire lightmap as dirty. | |
void | dirtyLightmapRect (const Rect &rect) |
Mark a region of the lightmap as dirty. | |
void | dirtyRect (const Rect &rect) |
Mark a region of the terrain as dirty. | |
void | finaliseHeightDeltas (const Rect &rect, bool cpuData) |
Finalise the height deltas. | |
void | finaliseLightmap (const Rect &rect, PixelBox *lightmapBox) |
Finalise the lightmap. | |
void | finaliseNormals (const Rect &rect, PixelBox *normalsBox) |
Finalise the normals. | |
void | freeTemporaryResources () |
Free as many resources as possible for optimal run-time memory use. | |
const AxisAlignedBox & | getAABB () const |
Get the AABB (local coords) of the entire terrain. | |
Alignment | getAlignment () const |
Get the alignment of the terrain. | |
uint8 | getBlendTextureCount () const |
uint8 | getBlendTextureIndex (uint8 layerIndex) const |
Get the index of the blend texture that a given layer uses. | |
const String & | getBlendTextureName (uint8 textureIndex) const |
const std::vector< TexturePtr > & | getBlendTextures () const |
Get the packed blend textures. | |
Real | getBoundingRadius () const |
Get the bounding radius of the entire terrain. | |
const TexturePtr & | getCompositeMap () const |
Get access to the composite map, if enabled (as requested by the material generator) | |
const MaterialPtr & | getCompositeMapMaterial () const |
Get the material being used for the terrain composite map. | |
uint16 | getCompositeMapSize () const |
Get the requested size of composite map for this terrain. | |
const float * | getDeltaData () const |
Get a pointer to all the delta data for this terrain. | |
const float * | getDeltaData (uint32 x, uint32 y) const |
Get a pointer to the delta data for a given point. | |
const TexturePtr & | getGlobalColourMap () const |
Get access to the global colour map, if enabled. | |
bool | getGlobalColourMapEnabled () const |
Get whether a global colour map is enabled on this terrain. | |
uint16 | getGlobalColourMapSize () const |
Get the size of the global colour map (if used) | |
GpuBufferAllocator * | getGpuBufferAllocator () |
Get the current buffer allocator. | |
float | getHeightAtPoint (uint32 x, uint32 y) const |
Get the height data for a given terrain point. | |
float | getHeightAtTerrainPosition (Real x, Real y) const |
Get the height data for a given terrain position. | |
float | getHeightAtWorldPosition (const Vector3 &pos) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
float | getHeightAtWorldPosition (Real x, Real y, Real z) const |
Get the height data for a given world position (projecting the point down on to the terrain). | |
float * | getHeightData () const |
Get a pointer to all the height data for this terrain. | |
float * | getHeightData (uint32 x, uint32 y) const |
Get a pointer to the height data for a given point. | |
int | getHighestLodLoaded () const |
int | getHighestLodPrepared () const |
TerrainLayerBlendMap * | getLayerBlendMap (uint8 layerIndex) |
Retrieve the layer blending map for a given layer, which may be used to edit the blending information for that layer. | |
const TexturePtr & | getLayerBlendTexture (uint8 index) const |
Get a blend texture with a given index. | |
std::pair< uint8, uint8 > | getLayerBlendTextureIndex (uint8 layerIndex) const |
Get the texture index and colour channel of the blend information for a given layer. | |
const TexturePtr & | getLightmap () const |
Get access to the lightmap, if enabled (as requested by the material generator) | |
uint16 | getLightmapSize () const |
Get the requested size of lightmap for this terrain. | |
uint16 | getLODLevelWhenVertexEliminated (long rowOrColulmn) const |
Utility method, get the first LOD Level at which this vertex is no longer included. | |
uint16 | getLODLevelWhenVertexEliminated (long x, long y) const |
Utility method, get the first LOD Level at which this vertex is no longer included. | |
const MaterialPtr & | getMaterial () const |
Get the material being used for the terrain. | |
const String & | getMaterialName () const |
Get the name of the material being used for the terrain. | |
uint16 | getMaxBatchSize () const |
Get the maximum size in vertices along one side of a batch. | |
Real | getMaxHeight () const |
Get the maximum height of the terrain. | |
uint16 | getMinBatchSize () const |
Get the minimum size in vertices along one side of a batch. | |
Real | getMinHeight () const |
Get the minimum height of the terrain. | |
Terrain * | getNeighbour (NeighbourIndex index) const |
Retrieve the terrain's neighbour, or null if not present. | |
uint16 | getNumLodLevels () const |
Get the total number of LOD levels in the terrain. | |
uint16 | getNumLodLevelsPerLeaf () const |
Get the number of LOD levels in a leaf of the terrain quadtree. | |
void | getPoint (uint32 x, uint32 y, float height, Vector3 *outpos) const |
Get a Vector3 of the world-space point on the terrain, supplying the height data manually (can be more optimal). | |
void | getPoint (uint32 x, uint32 y, Vector3 *outpos) const |
Get a Vector3 of the world-space point on the terrain, aligned as per options. | |
void | getPointFromSelfOrNeighbour (int32 x, int32 y, Vector3 *outpos) const |
Get a Vector3 of the world-space point on the terrain, aligned as per options. | |
Affine3 | getPointTransform () const |
Get a transform which converts Vector4(xindex, yindex, height, 1) into an object-space position including scalings and alignment. | |
const Vector3 & | getPosition () const |
Get the world position of the terrain centre. | |
void | getPosition (const Vector3 &TSpos, Vector3 *outWSpos) const |
Convert a position from terrain basis space to world space. | |
void | getPosition (Real x, Real y, Real z, Vector3 *outWSpos) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | getPositionAlign (const Vector3 &TSpos, Alignment align, Vector3 *outWSpos) const |
Convert a position from terrain basis space to world space based on a specified alignment. | |
void | getPositionAlign (Real x, Real y, Real z, Alignment align, Vector3 *outWSpos) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
TerrainQuadTreeNode * | getQuadTree () |
Get the top level of the quad tree which is used to divide up the terrain. | |
uint32 | getQueryFlags (void) const |
Get the query flags for this terrain. | |
uint8 | getRenderQueueGroup (void) const |
Get the render queue group that this terrain will be rendered into. | |
uint16 | getResolutionAtLod (uint16 lodLevel) const |
Gets the resolution of the entire terrain (down one edge) at a given LOD level. | |
const String & | getResourceGroup () const |
Get the resource group to use when loading / saving. | |
SceneManager * | getSceneManager () const |
uint16 | getSize () const |
Get the size of the terrain in vertices along one side. | |
Real | getSkirtSize () const |
The default size of 'skirts' used to hide terrain cracks (default 10, set for new Terrain using TerrainGlobalOptions) | |
int | getTargetLodLevel () const |
TexturePtr | getTerrainNormalMap () const |
Get the (global) normal map texture. | |
void | getTerrainPosition (const Vector3 &WSpos, Vector3 *outTSpos) const |
Convert a position from world space to terrain basis space. | |
void | getTerrainPosition (Real x, Real y, Real z, Vector3 *outTSpos) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | getTerrainPositionAlign (const Vector3 &WSpos, Alignment align, Vector3 *outTSpos) const |
Convert a position from world space to terrain basis space based on a specified alignment. | |
void | getTerrainPositionAlign (Real x, Real y, Real z, Alignment align, Vector3 *outTSpos) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | getTerrainVector (const Vector3 &inVec, Vector3 *outVec) const |
Translate a vector from world space to local terrain space based on the alignment options. | |
void | getTerrainVector (Real x, Real y, Real z, Vector3 *outVec) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | getTerrainVectorAlign (const Vector3 &inVec, Alignment align, Vector3 *outVec) const |
Translate a vector from world space to local terrain space based on a specified alignment. | |
void | getTerrainVectorAlign (Real x, Real y, Real z, Alignment align, Vector3 *outVec) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | getVector (const Vector3 &inVec, Vector3 *outVec) const |
Translate a vector into world space based on the alignment options. | |
void | getVector (Real x, Real y, Real z, Vector3 *outVec) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | getVectorAlign (const Vector3 &inVec, Alignment align, Vector3 *outVec) const |
Translate a vector into world space based on a specified alignment. | |
void | getVectorAlign (Real x, Real y, Real z, Alignment align, Vector3 *outVec) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
uint32 | getVisibilityFlags (void) const |
Get the visibility flags for this terrain. | |
AxisAlignedBox | getWorldAABB () const |
Get the AABB (world coords) of the entire terrain. | |
Real | getWorldSize () const |
Get the size of the terrain in world units. | |
void | increaseLodLevel (bool synchronous=false) |
Increase Terrain's LOD level by 1. | |
bool | isDerivedDataUpdateInProgress () const |
Query whether a derived data update is in progress or not. | |
bool | isHeightDataModified () const |
Returns whether terrain heights have been modified since the terrain was first loaded / defined. | |
bool | isLoaded () const |
Return whether the terrain is loaded. | |
bool | isModified () const |
Returns whether this terrain has been modified since it was first loaded / defined. | |
void | load (const String &filename) |
Prepare and load the terrain in one simple call from a standalone file. | |
void | load (int lodLevel=0, bool synchronous=true) |
Load the terrain based on the data already populated via prepare methods. | |
void | load (StreamSerialiser &stream) |
Prepare and load the terrain in one simple call from a stream. | |
void | neighbourModified (NeighbourIndex index, const Rect &edgerect, const Rect &shadowrect) |
Notify that a neighbour has just finished updating and that this change affects this tile. | |
void | notifyNeighbours () |
Tell this instance to notify all neighbours that will be affected by a height change that has taken place. | |
OGRE_RW_MUTEX (mNeighbourMutex) | |
void | preFindVisibleObjects (SceneManager *source, SceneManager::IlluminationRenderStage irs, Viewport *v) override |
Overridden from SceneManager::Listener. | |
bool | prepare (const ImportData &importData) |
Prepare the terrain from some import data rather than loading from native data. | |
bool | prepare (const String &filename) |
Prepare the terrain from a standalone file. | |
bool | prepare (DataStreamPtr &stream) |
Prepare terrain data from saved data. | |
bool | prepare (StreamSerialiser &stream) |
Prepare terrain data from saved data. | |
std::pair< bool, Vector3 > | rayIntersects (const Ray &ray, bool cascadeToNeighbours=false, Real distanceLimit=0) |
Test for intersection of a given ray with the terrain. | |
Terrain * | raySelectNeighbour (const Ray &ray, Real distanceLimit=0) |
Utility method to pick a neighbour based on a ray. | |
void | removeQueryFlags (uint32 flags) |
void | save (const String &filename) |
Save terrain data in native form to a standalone file. | |
void | save (StreamSerialiser &stream) |
Save terrain data in native form to a serializing stream. | |
void | sceneManagerDestroyed (SceneManager *source) override |
Overridden from SceneManager::Listener. | |
void | setGlobalColourMapEnabled (bool enabled, uint16 size=0) |
Set whether a global colour map is enabled. | |
void | setGpuBufferAllocator (GpuBufferAllocator *alloc) |
Tell this instance to use the given GpuBufferAllocator. | |
void | setHeightAtPoint (uint32 x, uint32 y, float h) |
Set the height data for a given terrain point. | |
void | setNeighbour (NeighbourIndex index, Terrain *neighbour, bool recalculate=false, bool notifyOther=true) |
Set a terrain's neighbour, or null to detach one. | |
void | setPosition (const Vector3 &pos) |
Set the position of the terrain centre in world coordinates. | |
void | setQueryFlags (uint32 flags) |
Set the query flags for this terrain. | |
void | setRenderQueueGroup (uint8 grp) |
Set the render queue group that this terrain will be rendered into. | |
void | setResourceGroup (const String &resGroup) |
Set the resource group to use when loading / saving. | |
void | setSize (uint16 newSize) |
Set the size of terrain in vertices along one side. | |
void | setVisibilityFlags (uint32 flags) |
Set the visibility flags for this terrain. | |
void | setWorldSize (Real newWorldSize) |
Set the world size of terrain. | |
void | unload () |
Unload the terrain and free GPU resources. | |
void | unprepare () |
Free CPU resources created during prepare methods. | |
void | update (bool synchronous=false) |
Trigger the update process for the terrain. | |
void | updateCompositeMap () |
Performs an update on the terrain composite map based on its dirty region. | |
void | updateCompositeMapWithDelay (Real delay=2) |
Performs an update on the terrain composite map based on its dirty region, but only at a maximum frequency. | |
void | updateDerivedData (bool synchronous=false, uint8 typeMask=0xFF) |
Updates derived data for the terrain (LOD, lighting) to reflect changed height data, in a separate thread if threading is enabled (OGRE_THREAD_SUPPORT). | |
void | updateGeometry () |
Performs an update on the terrain geometry based on the dirty region. | |
void | updateGeometryWithoutNotifyNeighbours () |
Performs an update on the terrain geometry based on the dirty region. | |
void | waitForDerivedProcesses () |
void | widenRectByVector (const Vector3 &vec, const Rect &inRect, Real minHeight, Real maxHeight, Rect &outRect) |
Widen a rectangular area of terrain to take into account an extrusion vector, but specify the min / max heights to extrude manually. | |
void | widenRectByVector (const Vector3 &vec, const Rect &inRect, Rect &outRect) |
Widen a rectangular area of terrain to take into account an extrusion vector. | |
Layers | |
uint8 | getLayerCount () const |
Get the number of layers in this terrain. | |
const TerrainLayerDeclaration & | getLayerDeclaration () const |
Get the declaration which describes the layers in this terrain. | |
void | addLayer (Real worldSize=0, const StringVector *textureNames=0) |
Add a new layer to this terrain. | |
void | addLayer (uint8 index, Real worldSize=0, const StringVector *textureNames=0) |
Add a new layer to this terrain at a specific index. | |
void | removeLayer (uint8 index) |
Remove a layer from the terrain. | |
void | replaceLayer (uint8 index, bool keepBlends, Real worldSize=0, const StringVector *textureNames=0) |
Replace an existing terrain layer, optionally preserving all other layer blend maps. | |
uint8 | getMaxLayers () const |
Get the maximum number of layers supported with the current options. | |
Real | getLayerWorldSize (uint8 index) const |
How large an area in world space the texture in a terrain layer covers before repeating. | |
void | setLayerWorldSize (uint8 index, Real size) |
How large an area in world space the texture in a terrain layer covers before repeating. | |
Real | getLayerUVMultiplier (uint8 index) const |
Get the layer UV multiplier. | |
const String & | getLayerTextureName (uint8 layerIndex, uint8 samplerIndex) const |
Get the name of the texture bound to a given index within a given layer. | |
void | setLayerTextureName (uint8 layerIndex, uint8 samplerIndex, const String &textureName) |
Set the name of the texture bound to a given index within a given layer. | |
uint16 | getLayerBlendMapSize () const |
Get the requested size of the blend maps used to blend between layers for this terrain. | |
Internal implementation options for the terrain material | |
The TerrainMaterialGenerator should call this methods to specify the options it would like to use when creating a material. Not all the data is guaranteed to be up to date on return from this method - for example some maps may be generated in the background. However, on return from this method all the features that are requested will be referenceable by materials, the data may just take a few frames to be fully populated. | |
void | _setMorphRequired (bool morph) |
Request vertex morphing information. | |
bool | _getMorphRequired () const |
Get whether LOD morphing is needed. | |
void | _setNormalMapRequired (bool normalMap) |
Request a terrain-wide normal map. | |
void | _setLightMapRequired (bool lightMap, bool shadowsOnly=false) |
Request a terrain-wide light map. | |
void | _setCompositeMapRequired (bool compositeMap) |
Request a terrain-wide composite map. | |
Public Member Functions inherited from Ogre::SceneManager::Listener | |
Listener () | |
virtual | ~Listener () |
virtual void | postFindVisibleObjects (SceneManager *source, IlluminationRenderStage irs, Viewport *v) |
Called after searching for visible objects in this SceneManager. | |
virtual void | postUpdateSceneGraph (SceneManager *source, Camera *camera) |
Called after updating the scene graph in this SceneManager. | |
virtual void | preUpdateSceneGraph (SceneManager *source, Camera *camera) |
Called prior to updating the scene graph in this SceneManager. | |
Static Public Member Functions | |
static uint16 | _calcSkirtVertexIndex (uint16 mainIndex, uint16 vdatasize, bool isCol, uint16 numSkirtRowsCols, uint16 skirtRowColSkip) |
Utility method to calculate the skirt index for a given original vertex index. | |
static size_t | _getNumIndexesForBatchSize (uint16 batchSize) |
Utility method to get the number of indexes required to render a given batch. | |
static void | _populateIndexBuffer (uint16 *pIndexes, uint16 batchSize, uint16 vdatasize, uint16 vertexIncrement, uint16 xoffset, uint16 yoffset, uint16 numSkirtRowsCols, uint16 skirtRowColSkip) |
Utility method to populate a (locked) index buffer. | |
static void | convertTerrainToWorldAxes (Alignment align, const Vector3 &terrainVec, Vector3 *worldVec) |
Utility method to convert axes from terrain space (xy terrain, z up) tp world space. | |
static void | convertWorldToTerrainAxes (Alignment align, const Vector3 &worldVec, Vector3 *terrainVec) |
Utility method to convert axes from world space to terrain space (xy terrain, z up) | |
static uint8 | getBlendTextureCount (uint8 numLayers) |
Get the number of blend textures needed for a given number of layers. | |
static NeighbourIndex | getNeighbourIndex (long offsetx, long offsety) |
Get the neighbour enum for a given offset in a grid (signed). | |
static NeighbourIndex | getOppositeNeighbour (NeighbourIndex index) |
Get the opposite neighbour relationship (useful for finding the neighbour index from the perspective of the tile the other side of the boundary). | |
static bool | readLayerDeclaration (StreamSerialiser &ser, TerrainLayerDeclaration &targetdecl) |
Utility method to read a layer declaration from a stream. | |
static bool | readLayerInstanceList (StreamSerialiser &ser, size_t numSamplers, Terrain::LayerInstanceList &targetlst) |
Utility method to read a layer instance list from a stream. | |
static void | writeLayerDeclaration (const TerrainLayerDeclaration &decl, StreamSerialiser &ser) |
Utility method to write a layer declaration to a stream. | |
static void | writeLayerInstanceList (const Terrain::LayerInstanceList &lst, StreamSerialiser &ser) |
Utility method to write a layer instance list to a stream. | |
The main containing class for a chunk of terrain.
Name | Type | Description |
Terrain orientation | uint8 | The orientation of the terrain; XZ = 0, XY = 1, YZ = 2 |
Terrain size | uint16 | The number of vertices along one side of the terrain |
Terrain world size | Real | The world size of one side of the terrain |
Max batch size | uint16 | The maximum batch size in vertices along one side |
Min batch size | uint16 | The minimum batch size in vertices along one side |
Position | Vector3 | The location of the centre of the terrain |
Height data | float[size*size] | List of floating point heights |
LayerDeclaration | LayerDeclaration* | The layer declaration for this terrain (see below) |
Layer count | uint8 | The number of layers in this terrain |
LayerInstance list | LayerInstance* | A number of LayerInstance definitions based on layer count (see below) |
Layer blend map size | uint16 | The size of the layer blend maps as stored in this file |
Packed blend texture data | uint8* | layerCount-1 sets of blend texture data interleaved as RGBA |
Optional derived map data | TerrainDerivedMap list | 0 or more sets of map data derived from the original terrain |
Delta data | float[size*size] | At each vertex, delta information for the LOD at which this vertex disappears |
Quadtree delta data | float[quadtrees*lods] | At each quadtree node, for each lod a record of the max delta value in the region |
Name | Type | Description |
TerrainLayerSampler Count | uint8 | Number of samplers in this declaration |
TerrainLayerSampler List | TerrainLayerSampler* | List of TerrainLayerSampler structures |
Sampler Element Count | uint8 | Number of sampler elements in this declaration |
TerrainLayerSamplerElement List | TerrainLayerSamplerElement* | List of TerrainLayerSamplerElement structures |
Name | Type | Description |
Alias | String | Alias name of this sampler |
Format | uint8 | Desired pixel format |
Name | Type | Description |
Source | uint8 | Sampler source index |
Semantic | uint8 | Semantic interpretation of this element |
Element start | uint8 | Start of this element in the sampler |
Element count | uint8 | Number of elements in the sampler used by this entry |
Name | Type | Description |
World size | Real | The world size of this layer (determines UV scaling) |
Texture list | String* | List of texture names corresponding to the number of samplers in the layer declaration |
Name | Type | Description |
Derived data type name | String | Name of the derived data type ('normalmap', 'lightmap', 'colourmap', 'compositemap') |
Size | uint16 | Size of the data along one edge |
Data | varies based on type | The data |
typedef std::vector<Real> Ogre::Terrain::RealVector |
typedef std::vector<LayerInstance> Ogre::Terrain::LayerInstanceList |
Enumeration of relative spaces that you might want to use to address the terrain.
Ogre::Terrain::Terrain | ( | SceneManager * | sm | ) |
Constructor.
sm | The SceneManager to use. |
|
virtual |
|
inline |
void Ogre::Terrain::setGpuBufferAllocator | ( | GpuBufferAllocator * | alloc | ) |
Tell this instance to use the given GpuBufferAllocator.
May only be called when the terrain is not loaded.
GpuBufferAllocator * Ogre::Terrain::getGpuBufferAllocator | ( | ) |
Get the current buffer allocator.
Utility method to get the number of indexes required to render a given batch.
|
static |
Utility method to populate a (locked) index buffer.
pIndexes | Pointer to an index buffer to populate |
batchSize | The number of vertices down one side of the batch |
vdatasize | The number of vertices down one side of the vertex data being referenced |
vertexIncrement | The number of vertices to increment for each new indexed row / column |
xoffset | The x offset from the start of the vertex data being referenced |
yoffset | The y offset from the start of the vertex data being referenced |
numSkirtRowsCols | Number of rows and columns of skirts |
skirtRowColSkip | The number of rows / cols to skip in between skirts |
|
static |
Utility method to calculate the skirt index for a given original vertex index.
void Ogre::Terrain::convertPosition | ( | Space | inSpace, |
const Vector3 & | inPos, | ||
Space | outSpace, | ||
Vector3 & | outPos | ||
) | const |
Convert a position from one space to another with respect to this terrain.
inSpace | The space that inPos is expressed as |
inPos | The incoming position |
outSpace | The space which outPos should be expressed as |
outPos | The output position to be populated |
Vector3 Ogre::Terrain::convertPosition | ( | Space | inSpace, |
const Vector3 & | inPos, | ||
Space | outSpace | ||
) | const |
Convert a position from one space to another with respect to this terrain.
inSpace | The space that inPos is expressed as |
inPos | The incoming position |
outSpace | The space which outPos should be expressed as |
void Ogre::Terrain::convertDirection | ( | Space | inSpace, |
const Vector3 & | inDir, | ||
Space | outSpace, | ||
Vector3 & | outDir | ||
) | const |
Convert a direction from one space to another with respect to this terrain.
inSpace | The space that inDir is expressed as |
inDir | The incoming direction |
outSpace | The space which outDir should be expressed as |
outDir | The output direction to be populated |
Vector3 Ogre::Terrain::convertDirection | ( | Space | inSpace, |
const Vector3 & | inDir, | ||
Space | outSpace | ||
) | const |
Convert a direction from one space to another with respect to this terrain.
inSpace | The space that inDir is expressed as |
inDir | The incoming direction |
outSpace | The space which outDir should be expressed as |
Set the resource group to use when loading / saving.
resGroup | Resource group name - you can set this to blank to use the default in TerrainGlobalOptions. |
Get the resource group to use when loading / saving.
If this is blank, the default in TerrainGlobalOptions will be used.
Get the final resource group to use when loading / saving.
Save terrain data in native form to a standalone file.
filename | The name of the file to save to. If this is a filename with no path elements, then it is saved in the first writeable location available in the resource group you have chosen to use for this terrain. If the filename includes path specifiers then it is saved directly instead (but note that it may not be reloadable via the resource system if the location is not on the path). |
void Ogre::Terrain::save | ( | StreamSerialiser & | stream | ) |
Save terrain data in native form to a serializing stream.
If you want complete control over where the terrain data goes, use this form.
Prepare the terrain from a standalone file.
bool Ogre::Terrain::prepare | ( | DataStreamPtr & | stream | ) |
Prepare terrain data from saved data.
This is safe to do in a background thread as it creates no GPU resources. It reads data from a native terrain data chunk.
bool Ogre::Terrain::prepare | ( | StreamSerialiser & | stream | ) |
Prepare terrain data from saved data.
This is safe to do in a background thread as it creates no GPU resources. It reads data from a native terrain data chunk.
bool Ogre::Terrain::prepare | ( | const ImportData & | importData | ) |
Prepare the terrain from some import data rather than loading from native data.
This method may be called in a background thread.
Prepare and load the terrain in one simple call from a standalone file.
void Ogre::Terrain::load | ( | StreamSerialiser & | stream | ) |
Prepare and load the terrain in one simple call from a stream.
Load the terrain based on the data already populated via prepare methods.
This method must be called in the main render thread.
lodLevel | Load the specified LOD level |
synchronous | Load type |
|
inline |
Return whether the terrain is loaded.
Should only be called from the render thread really, since this is where the loaded state changes.
|
inline |
Returns whether this terrain has been modified since it was first loaded / defined.
This flag is reset on save().
|
inline |
Returns whether terrain heights have been modified since the terrain was first loaded / defined.
This flag is reset on save().
void Ogre::Terrain::unload | ( | ) |
Unload the terrain and free GPU resources.
This method must be called in the main render thread.
void Ogre::Terrain::unprepare | ( | ) |
Free CPU resources created during prepare methods.
This is safe to do in a background thread after calling unload().
float * Ogre::Terrain::getHeightData | ( | ) | const |
Get a pointer to all the height data for this terrain.
The height data is in world coordinates, relative to the position of the terrain.
Get a pointer to the height data for a given point.
Get the height data for a given terrain point.
x,y | Discrete coordinates in terrain vertices, values from 0 to size-1, left/right bottom/top |
Set the height data for a given terrain point.
x,y | Discrete coordinates in terrain vertices, values from 0 to size-1, left/right bottom/top |
h | The new height |
Get the height data for a given terrain position.
x,y | Position in terrain space, values from 0 to 1 left/right bottom/top |
Get the height data for a given world position (projecting the point down on to the terrain).
x,y,z | Position in world space. Positions will be clamped to the edge of the terrain |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Get a pointer to all the delta data for this terrain.
The delta data is a measure at a given vertex of by how much vertically a vertex will have to move to reach the point at which it will be removed in the next lower LOD.
Get a pointer to the delta data for a given point.
Get a Vector3 of the world-space point on the terrain, aligned as per options.
Get a Vector3 of the world-space point on the terrain, aligned as per options.
Cascades into neighbours if out of bounds.
Get a Vector3 of the world-space point on the terrain, supplying the height data manually (can be more optimal).
Affine3 Ogre::Terrain::getPointTransform | ( | ) | const |
Get a transform which converts Vector4(xindex, yindex, height, 1) into an object-space position including scalings and alignment.
Translate a vector from world space to local terrain space based on the alignment options.
inVec | The vector in basis space, where x/y represents the terrain plane and z represents the up vector | |
[out] | outVec |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Ogre::Terrain::getTerrainVectorAlign | ( | const Vector3 & | inVec, |
Alignment | align, | ||
Vector3 * | outVec | ||
) | const |
Translate a vector from world space to local terrain space based on a specified alignment.
inVec | The vector in basis space, where x/y represents the terrain plane and z represents the up vector | |
[out] | outVec | |
align | The alignment of the terrain |
void Ogre::Terrain::getTerrainVectorAlign | ( | Real | x, |
Real | y, | ||
Real | z, | ||
Alignment | align, | ||
Vector3 * | outVec | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Translate a vector into world space based on the alignment options.
inVec | The vector in basis space, where x/y represents the terrain plane and z represents the up vector | |
[out] | outVec |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Ogre::Terrain::getVectorAlign | ( | const Vector3 & | inVec, |
Alignment | align, | ||
Vector3 * | outVec | ||
) | const |
Translate a vector into world space based on a specified alignment.
inVec | The vector in basis space, where x/y represents the terrain plane and z represents the up vector | |
[out] | outVec | |
align | The alignment of the terrain |
void Ogre::Terrain::getVectorAlign | ( | Real | x, |
Real | y, | ||
Real | z, | ||
Alignment | align, | ||
Vector3 * | outVec | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Convert a position from terrain basis space to world space.
TSpos | Terrain space position, where (0,0) is the bottom-left of the terrain, and (1,1) is the top-right. The Z coordinate is in absolute height units. |
outWSpos | World space output position (setup according to current alignment). |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Convert a position from world space to terrain basis space.
WSpos | World space position (setup according to current alignment). |
outTSpos | Terrain space output position, where (0,0) is the bottom-left of the terrain, and (1,1) is the top-right. The Z coordinate is in absolute height units. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Ogre::Terrain::getPositionAlign | ( | const Vector3 & | TSpos, |
Alignment | align, | ||
Vector3 * | outWSpos | ||
) | const |
Convert a position from terrain basis space to world space based on a specified alignment.
TSpos | Terrain space position, where (0,0) is the bottom-left of the terrain, and (1,1) is the top-right. The Z coordinate is in absolute height units. |
outWSpos | World space output position (setup according to alignment). |
align | The alignment of the terrain |
void Ogre::Terrain::getPositionAlign | ( | Real | x, |
Real | y, | ||
Real | z, | ||
Alignment | align, | ||
Vector3 * | outWSpos | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Ogre::Terrain::getTerrainPositionAlign | ( | const Vector3 & | WSpos, |
Alignment | align, | ||
Vector3 * | outTSpos | ||
) | const |
Convert a position from world space to terrain basis space based on a specified alignment.
WSpos | World space position (setup according to alignment). |
outTSpos | Terrain space output position, where (0,0) is the bottom-left of the terrain, and (1,1) is the top-right. The Z coordinate is in absolute height units. |
align | The alignment of the terrain |
void Ogre::Terrain::getTerrainPositionAlign | ( | Real | x, |
Real | y, | ||
Real | z, | ||
Alignment | align, | ||
Vector3 * | outTSpos | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Alignment Ogre::Terrain::getAlignment | ( | ) | const |
Get the alignment of the terrain.
uint16 Ogre::Terrain::getSize | ( | ) | const |
Get the size of the terrain in vertices along one side.
Set the size of terrain in vertices along one side.
newSize | the new size of the terrain |
uint16 Ogre::Terrain::getMaxBatchSize | ( | ) | const |
Get the maximum size in vertices along one side of a batch.
uint16 Ogre::Terrain::getMinBatchSize | ( | ) | const |
Get the minimum size in vertices along one side of a batch.
Real Ogre::Terrain::getWorldSize | ( | ) | const |
Get the size of the terrain in world units.
Set the world size of terrain.
newWorldSize | the new world size of the terrain |
|
inline |
Get the number of layers in this terrain.
|
inline |
Get the declaration which describes the layers in this terrain.
void Ogre::Terrain::addLayer | ( | Real | worldSize = 0 , |
const StringVector * | textureNames = 0 |
||
) |
Add a new layer to this terrain.
worldSize | The size of the texture in this layer in world units. Default to zero to use the default |
textureNames | A list of textures to assign to the samplers in this layer. Leave blank to provide these later. |
void Ogre::Terrain::addLayer | ( | uint8 | index, |
Real | worldSize = 0 , |
||
const StringVector * | textureNames = 0 |
||
) |
Add a new layer to this terrain at a specific index.
index | The index at which to insert this layer (existing layers are shifted forwards) |
worldSize | The size of the texture in this layer in world units. Default to zero to use the default |
textureNames | A list of textures to assign to the samplers in this layer. Leave blank to provide these later. |
void Ogre::Terrain::replaceLayer | ( | uint8 | index, |
bool | keepBlends, | ||
Real | worldSize = 0 , |
||
const StringVector * | textureNames = 0 |
||
) |
Replace an existing terrain layer, optionally preserving all other layer blend maps.
index | The 0 based index of the terrain layer to replace |
keepBlends | True to keep using the existing blend maps. False to reset the blend map for the layer. Irrelevant if index == 0 |
worldSize | The size of the texture in this layer in world units. Default to zero to use the default |
textureNames | A list of textures to assign to the samplers in this layer. Leave blank to provide these later. |
uint8 Ogre::Terrain::getMaxLayers | ( | ) | const |
Get the maximum number of layers supported with the current options.
How large an area in world space the texture in a terrain layer covers before repeating.
index | The layer index. |
How large an area in world space the texture in a terrain layer covers before repeating.
index | The layer index. |
size | The world size of the texture before repeating |
Get the layer UV multiplier.
This is derived from the texture world size. The base UVs in the terrain vary from 0 to 1 and this multiplier is used (in a fixed-function texture coord scaling or a shader parameter) to translate it to the final value.
index | The layer index. |
Get the name of the texture bound to a given index within a given layer.
See the LayerDeclaration for a list of sampelrs within a layer.
layerIndex | The layer index. |
samplerIndex | The sampler index within a layer |
void Ogre::Terrain::setLayerTextureName | ( | uint8 | layerIndex, |
uint8 | samplerIndex, | ||
const String & | textureName | ||
) |
Set the name of the texture bound to a given index within a given layer.
See the LayerDeclaration for a list of sampelrs within a layer.
layerIndex | The layer index. |
samplerIndex | The sampler index within a layer |
textureName | The name of the texture to use |
|
inline |
Get the requested size of the blend maps used to blend between layers for this terrain.
Note that where hardware limits this, the actual blend maps may be lower resolution. This option is derived from TerrainGlobalOptions when the terrain is created.
|
inline |
Get the requested size of lightmap for this terrain.
Note that where hardware limits this, the actual lightmap may be lower resolution. This option is derived from TerrainGlobalOptions when the terrain is created.
|
inline |
Get access to the lightmap, if enabled (as requested by the material generator)
|
inline |
Get the requested size of composite map for this terrain.
Note that where hardware limits this, the actual texture may be lower resolution. This option is derived from TerrainGlobalOptions when the terrain is created.
|
inline |
Get access to the composite map, if enabled (as requested by the material generator)
Get the world position of the terrain centre.
Set the position of the terrain centre in world coordinates.
SceneNode * Ogre::Terrain::_getRootSceneNode | ( | ) | const |
Get the root scene node for the terrain (internal use only)
void Ogre::Terrain::dirty | ( | ) |
Mark the entire terrain as dirty.
By marking a section of the terrain as dirty, you are stating that you have changed the height data within this rectangle. This rectangle will be merged with any existing outstanding changes. To finalise the changes, you must call update(), updateGeometry(), or updateDerivedData().
Mark a region of the terrain as dirty.
By marking a section of the terrain as dirty, you are stating that you have changed the height data within this rectangle. This rectangle will be merged with any existing outstanding changes. To finalise the changes, you must call update(), updateGeometry(), or updateDerivedData().
rect | A rectangle expressed in vertices describing the dirty region; left < right, top < bottom, left & top are inclusive, right & bottom exclusive |
Mark a region of the terrain composite map as dirty.
You don't usually need to call this directly, it is inferred from changing the other data on the terrain.
Mark a region of the lightmap as dirty.
You only need to call this if you need to tell the terrain to update the lightmap data for some reason other than the terrain geometry has changed. Changing terrain geometry automatically dirties the correct lightmap areas.
void Ogre::Terrain::dirtyLightmap | ( | ) |
Mark a the entire lightmap as dirty.
You only need to call this if you need to tell the terrain to update the lightmap data for some reason other than the terrain geometry has changed. Changing terrain geometry automatically dirties the correct lightmap areas.
Trigger the update process for the terrain.
Updating the terrain will process any dirty sections of the terrain. This may affect many things:
If threading is enabled, only item 1 (the geometry) will be updated synchronously, ie will be fully up to date when this method returns. The other elements are more expensive to compute, and will be queued for processing in a background thread, in the order shown above. As these updates complete, the effects will be shown.
You can also separate the timing of updating the geometry, LOD and the lighting information if you want, by calling updateGeometry() and updateDerivedData() separately.
synchronous | If true, all updates will happen immediately and not in a separate thread. |
void Ogre::Terrain::updateGeometry | ( | ) |
Performs an update on the terrain geometry based on the dirty region.
Terrain geometry will be updated when this method returns.
void Ogre::Terrain::updateGeometryWithoutNotifyNeighbours | ( | ) |
Performs an update on the terrain geometry based on the dirty region.
Terrain geometry will be updated when this method returns, and no neighbours will be notified.
Updates derived data for the terrain (LOD, lighting) to reflect changed height data, in a separate thread if threading is enabled (OGRE_THREAD_SUPPORT).
If threading is enabled, on return from this method the derived data will not necessarily be updated immediately, the calculation may be done in the background. Only one update will run in the background at once. This derived data can typically survive being out of sync for a few frames which is why it is not done synchronously
synchronous | If true, the update will happen immediately and not in a separate thread. |
typeMask | Mask indicating the types of data we should generate |
void Ogre::Terrain::updateCompositeMap | ( | ) |
Performs an update on the terrain composite map based on its dirty region.
Rather than calling this directly, call updateDerivedData, which will also call it after the other derived data has been updated (there is no point updating the composite map until lighting has been updated). However the blend maps may call this directly when only the blending information has been updated.
Performs an update on the terrain composite map based on its dirty region, but only at a maximum frequency.
Rather than calling this directly, call updateDerivedData, which will also call it after the other derived data has been updated (there is no point updating the composite map until lighting has been updated). However the blend maps may call this directly when only the blending information has been updated.
|
inline |
The default size of 'skirts' used to hide terrain cracks (default 10, set for new Terrain using TerrainGlobalOptions)
|
inline |
Get the total number of LOD levels in the terrain.
|
inline |
Get the number of LOD levels in a leaf of the terrain quadtree.
Calculate (or recalculate) the delta values of heights between a vertex in its recorded position, and the place it will end up in the LOD in which it is removed.
rect | Rectangle describing the area in which heights have altered |
Finalise the height deltas.
Calculated height deltas are kept in a separate calculation field to make them safe to perform in a background thread. This call promotes those calculations to the runtime values, and must be called in the main thread.
rect | Rectangle describing the area to finalise |
cpuData | When updating vertex data, update the CPU copy (background) |
Calculate (or recalculate) the normals on the terrain.
rect | Rectangle describing the area of heights that were changed |
outFinalRect | Output rectangle describing the area updated |
Finalise the normals.
Calculated normals are kept in a separate calculation area to make them safe to perform in a background thread. This call promotes those calculations to the runtime values, and must be called in the main thread.
rect | Rectangle describing the area to finalise |
normalsBox | Pointer to a PixelBox full of normals |
PixelBox * Ogre::Terrain::calculateLightmap | ( | const Rect & | rect, |
const Rect & | extraTargetRect, | ||
Rect & | outFinalRect | ||
) |
Calculate (or recalculate) the terrain lightmap.
rect | Rectangle describing the area of heights that were changed |
extraTargetRect | Rectangle describing a target area of the terrain that needs to be calculated additionally (e.g. from a neighbour) |
outFinalRect | Output rectangle describing the area updated in the lightmap |
Finalise the lightmap.
Calculating lightmaps is kept in a separate calculation area to make it safe to perform in a background thread. This call promotes those calculations to the runtime values, and must be called in the main thread.
rect | Rectangle describing the area to finalise |
lightmapBox | Pointer to a PixelBox full of normals |
Gets the resolution of the entire terrain (down one edge) at a given LOD level.
std::pair< bool, Vector3 > Ogre::Terrain::rayIntersects | ( | const Ray & | ray, |
bool | cascadeToNeighbours = false , |
||
Real | distanceLimit = 0 |
||
) |
Test for intersection of a given ray with the terrain.
If the ray hits the terrain, the point of intersection is returned.
ray | The ray to test for intersection |
cascadeToNeighbours | Whether the ray will be projected onto neighbours if no intersection is found |
distanceLimit | The distance from the ray origin at which we will stop looking, 0 indicates no limit |
const AxisAlignedBox & Ogre::Terrain::getAABB | ( | ) | const |
Get the AABB (local coords) of the entire terrain.
AxisAlignedBox Ogre::Terrain::getWorldAABB | ( | ) | const |
Get the AABB (world coords) of the entire terrain.
Real Ogre::Terrain::getMinHeight | ( | ) | const |
Get the minimum height of the terrain.
Real Ogre::Terrain::getMaxHeight | ( | ) | const |
Get the maximum height of the terrain.
Real Ogre::Terrain::getBoundingRadius | ( | ) | const |
Get the bounding radius of the entire terrain.
const MaterialPtr & Ogre::Terrain::getMaterial | ( | ) | const |
Get the material being used for the terrain.
|
inline |
Internal getting of material.
const MaterialPtr & Ogre::Terrain::getCompositeMapMaterial | ( | ) | const |
Get the material being used for the terrain composite map.
|
inline |
Internal getting of material for the terrain composite map.
Get the name of the material being used for the terrain.
|
overridevirtual |
Overridden from SceneManager::Listener.
Reimplemented from Ogre::SceneManager::Listener.
|
overridevirtual |
Overridden from SceneManager::Listener.
Reimplemented from Ogre::SceneManager::Listener.
Get the render queue group that this terrain will be rendered into.
Set the render queue group that this terrain will be rendered into.
Get the visibility flags for this terrain.
Set the visibility flags for this terrain.
Set the query flags for this terrain.
As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object.
TerrainLayerBlendMap * Ogre::Terrain::getLayerBlendMap | ( | uint8 | layerIndex | ) |
Retrieve the layer blending map for a given layer, which may be used to edit the blending information for that layer.
layerIndex | The layer index, which should be 1 or higher (since the bottom layer has no blending). |
Get the index of the blend texture that a given layer uses.
layerIndex | The layer index, must be >= 1 and less than the number of layers |
uint8 Ogre::Terrain::getBlendTextureCount | ( | ) | const |
Get the number of blend textures needed for a given number of layers.
|
inline |
Get the packed blend textures.
Set whether a global colour map is enabled.
A global colour map can add variation to your terrain and reduce the perceived tiling effect you might get in areas of continuous lighting and the same texture. The global colour map is only used when the material generator chooses to use it.
enabled | Whether the global colour map is enabled or not |
size | The resolution of the colour map. A value of zero means 'no change' and the default is set in TerrainGlobalOptions. |
|
inline |
Get whether a global colour map is enabled on this terrain.
|
inline |
Get the size of the global colour map (if used)
|
inline |
Get access to the global colour map, if enabled.
Widen a rectangular area of terrain to take into account an extrusion vector.
vec | A vector in world space |
inRect | Input rectangle |
outRect | Output rectangle |
void Ogre::Terrain::widenRectByVector | ( | const Vector3 & | vec, |
const Rect & | inRect, | ||
Real | minHeight, | ||
Real | maxHeight, | ||
Rect & | outRect | ||
) |
Widen a rectangular area of terrain to take into account an extrusion vector, but specify the min / max heights to extrude manually.
vec | A vector in world space |
inRect | Input rectangle |
minHeight,maxHeight | The extents of the height to extrude |
outRect | Output rectangle |
void Ogre::Terrain::freeTemporaryResources | ( | ) |
Free as many resources as possible for optimal run-time memory use.
This class keeps some temporary storage around in order to make certain actions (such as editing) possible more quickly. Calling this method will cause as many of those resources as possible to be freed. You might want to do this for example when you are finished editing a particular terrain and want to have optimal runtime efficiency.
const TexturePtr & Ogre::Terrain::getLayerBlendTexture | ( | uint8 | index | ) | const |
Get a blend texture with a given index.
index | The blend texture index (note: not layer index; derive the texture index from getLayerBlendTextureIndex) |
Get the texture index and colour channel of the blend information for a given layer.
layerIndex | The index of the layer (1 or higher, layer 0 has no blend data) |
Request vertex morphing information.
morph | Whether LOD morphing information is required to be calculated |
|
inline |
Get whether LOD morphing is needed.
Request a terrain-wide normal map.
normalMap | Whether a terrain-wide normal map is requested. This is usually mutually exclusive with the lightmap option. |
Request a terrain-wide light map.
lightMap | Whether a terrain-wide lightmap including precalculated lighting is required (light direction in TerrainGlobalOptions) |
shadowsOnly | If true, the lightmap contains only shadows, no directional lighting intensity |
Request a terrain-wide composite map.
A composite map is a texture with all of the blending and lighting baked in, such that at distance this texture can be used as an approximation of the multi-layer blended material. It is actually up to the material generator to render this composite map, because obviously precisely what it looks like depends on what the main material looks like. For this reason, the composite map is one piece of derived terrain data that is always calculated in the render thread, and usually on the GPU. It is expected that if this option is requested, the material generator will use it to construct distant LOD techniques.
compositeMap | Whether a terrain-wide composite map is needed. |
bool Ogre::Terrain::_getUseVertexCompression | ( | ) | const |
Whether we're using vertex compression or not.
Utility method, get the first LOD Level at which this vertex is no longer included.
Utility method, get the first LOD Level at which this vertex is no longer included.
|
inline |
Get the top level of the quad tree which is used to divide up the terrain.
|
inline |
Get the (global) normal map texture.
Terrain * Ogre::Terrain::getNeighbour | ( | NeighbourIndex | index | ) | const |
Retrieve the terrain's neighbour, or null if not present.
Terrains only know about their neighbours if they are notified via setNeighbour. This information is not saved with the terrain since every tile must be able to be independent.
index | The index of the neighbour |
void Ogre::Terrain::setNeighbour | ( | NeighbourIndex | index, |
Terrain * | neighbour, | ||
bool | recalculate = false , |
||
bool | notifyOther = true |
||
) |
Set a terrain's neighbour, or null to detach one.
This information is not saved with the terrain since every tile must be able to be independent. However if modifications are made to a tile which can affect its neighbours, while connected the changes will be propagated.
index | The index of the neighbour |
neighbour | The terrain instance to become the neighbour, or null to reset. |
recalculate | If true, this terrain instance will recalculate elements that could be affected by the connection of this tile (e.g. matching heights, calcaulting normals, calculating shadows crossing the boundary). If false, this terrain's state is assumed to be up to date already (e.g. was calculated with this tile present before and the state saved). |
notifyOther | Whether the neighbour should also be notified (recommended to leave this at the default so relationships are up to date before background updates are triggered) |
|
static |
Get the opposite neighbour relationship (useful for finding the neighbour index from the perspective of the tile the other side of the boundary).
|
static |
Get the neighbour enum for a given offset in a grid (signed).
void Ogre::Terrain::notifyNeighbours | ( | ) |
Tell this instance to notify all neighbours that will be affected by a height change that has taken place.
This method will determine which neighbours need notification and call their neighbourModified method. It is called automatically by updateGeometry().
void Ogre::Terrain::neighbourModified | ( | NeighbourIndex | index, |
const Rect & | edgerect, | ||
const Rect & | shadowrect | ||
) |
Notify that a neighbour has just finished updating and that this change affects this tile.
index | The neighbour index (from this tile's perspective) |
edgerect | The area at the edge of this tile that needs height / normal recalculation (may be null) |
shadowrect | The area on this tile where shadows need recalculating (may be null) |
Utility method to pick a neighbour based on a ray.
ray | The ray in world space |
distanceLimit | Limit beyond which we want to ignore neighbours (0 for infinite) |
Dump textures to files.
This is a debugging method.
|
inline |
Query whether a derived data update is in progress or not.
|
static |
Utility method to convert axes from world space to terrain space (xy terrain, z up)
|
static |
Utility method to convert axes from terrain space (xy terrain, z up) tp world space.
|
static |
Utility method to write a layer declaration to a stream.
|
static |
Utility method to read a layer declaration from a stream.
|
static |
Utility method to write a layer instance list to a stream.
|
static |
Utility method to read a layer instance list from a stream.
Ogre::Terrain::OGRE_RW_MUTEX | ( | mNeighbourMutex | ) |
void Ogre::Terrain::waitForDerivedProcesses | ( | ) |
Increase Terrain's LOD level by 1.
synchronous | Run synchronously |
void Ogre::Terrain::decreaseLodLevel | ( | ) |
Removes highest LOD level loaded.
|
inline |
|
inline |
|
inline |