OGRE  13.6
Object-Oriented Graphics Rendering Engine
Ogre::TerrainGroup Class Reference

Helper class to assist you in managing multiple terrain instances that are connected to each other. More...

#include <OgreTerrainGroup.h>

+ Inheritance diagram for Ogre::TerrainGroup:

Classes

struct  RayResult
 Result from a terrain ray intersection with the terrain group. More...
 
struct  TerrainSlot
 Slot for a terrain instance, together with its definition. More...
 
struct  TerrainSlotDefinition
 Definition of how to populate a 'slot' in the terrain group. More...
 

Public Types

typedef ConstMapIterator< TerrainSlotMapConstTerrainIterator
 
typedef MapIterator< TerrainSlotMapTerrainIterator
 
typedef std::vector< Terrain * > TerrainList
 
typedef std::map< uint32, TerrainSlot * > TerrainSlotMap
 Packed map, signed 16 bits for each axis from -32767 to +32767. More...
 

Public Member Functions

 TerrainGroup (SceneManager *sm)
 Alternate constructor. More...
 
 TerrainGroup (SceneManager *sm, Terrain::Alignment align, uint16 terrainSize, Real terrainWorldSize)
 Constructor. More...
 
virtual ~TerrainGroup ()
 
void autoUpdateLod (long x, long y, bool synchronous, const Any &data)
 Automatically checks if terrain's LOD level needs to be updated. More...
 
void autoUpdateLodAll (bool synchronous, const Any &data)
 
void boxIntersects (const AxisAlignedBox &box, TerrainList *resultList) const
 Test intersection of a box with the terrain. More...
 
bool canHandleRequest (const WorkQueue::Request *req, const WorkQueue *srcQ) override
 WorkQueue::RequestHandler override. More...
 
bool canHandleResponse (const WorkQueue::Response *res, const WorkQueue *srcQ) override
 WorkQueue::ResponseHandler override. More...
 
void convertTerrainSlotToWorldPosition (long x, long y, Vector3 *pos) const
 Convert a slot location to a world position at the centre. More...
 
void convertWorldPositionToTerrainSlot (const Vector3 &pos, long *x, long *y) const
 Convert a world position to terrain slot coordinates. More...
 
void decreaseLodLevel (long x, long y)
 Removes terrain's highest LOD level. More...
 
virtual void defineTerrain (long x, long y)
 Define a 'slot' in the terrain grid - in this case to be loaded from a generated file name. More...
 
virtual void defineTerrain (long x, long y, const float *pFloat, const Terrain::LayerInstanceList *layers=0)
 Define the content of a 'slot' in the terrain grid. More...
 
virtual void defineTerrain (long x, long y, const Image *img, const Terrain::LayerInstanceList *layers=0)
 Define the content of a 'slot' in the terrain grid. More...
 
virtual void defineTerrain (long x, long y, const String &filename)
 Define the content of a 'slot' in the terrain grid. More...
 
virtual void defineTerrain (long x, long y, const Terrain::ImportData *importData)
 Define the content of a 'slot' in the terrain grid. More...
 
virtual void defineTerrain (long x, long y, float constantHeight)
 Define a 'slot' in the terrain grid - in this case a flat terrain. More...
 
void freeTemporaryResources ()
 Free as many resources as possible for optimal run-time memory use for all terrain tiles. More...
 
String generateFilename (long x, long y) const
 Generate a file name based on the current naming convention. More...
 
virtual Terrain::Alignment getAlignment () const
 Retrieve the alignment of the grid of terrain (cannot be modified after construction). More...
 
virtual Terrain::ImportDatagetDefaultImportSettings ()
 Retrieve a shared structure which will provide the base settings for all terrains created via this group. More...
 
const StringgetFilenameExtension () const
 
const StringgetFilenamePrefix () const
 
float getHeightAtWorldPosition (const Vector3 &pos, Terrain **ppTerrain=0)
 Get the height data for a given world position (projecting the point down on to the terrain). More...
 
float getHeightAtWorldPosition (Real x, Real y, Real z, Terrain **ppTerrain=0)
 Get the height data for a given world position (projecting the point down on to the terrain underneath). More...
 
size_t getNumTerrainPrepareRequests () const
 Get the number of terrains that are still waiting for the Terrain::prepare() to be called. More...
 
virtual const Vector3getOrigin () const
 Retrieve the centre position of the grid of terrain. More...
 
const StringgetResourceGroup () const
 Get the resource group in which files will be located. More...
 
virtual SceneManagergetSceneManager () const
 Retrieve the SceneManager being used for this group. More...
 
virtual TerraingetTerrain (long x, long y) const
 Get the terrain instance at a given slot, if loaded. More...
 
virtual TerrainSlotDefinitiongetTerrainDefinition (long x, long y) const
 Get the definition of a slot in the terrain. More...
 
TerrainIterator getTerrainIterator ()
 
ConstTerrainIterator getTerrainIterator () const
 
virtual uint16 getTerrainSize () const
 Retrieve the size of each terrain instance in number of vertices down one side. More...
 
const TerrainSlotMapgetTerrainSlots () const
 Get the defined terrains. More...
 
virtual Real getTerrainWorldSize () const
 Retrieve the world size of each terrain instance. More...
 
WorkQueue::ResponsehandleRequest (const WorkQueue::Request *req, const WorkQueue *srcQ) override
 WorkQueue::RequestHandler override. More...
 
void handleResponse (const WorkQueue::Response *res, const WorkQueue *srcQ) override
 WorkQueue::ResponseHandler override. More...
 
void increaseLodLevel (long x, long y, bool synchronous=false)
 Loads terrain's next LOD level. More...
 
bool isDerivedDataUpdateInProgress () const
 Calls Terrain::isDerivedDataUpdateInProgress on each loaded instance and returns true if any of them are undergoing a derived update. More...
 
virtual void loadAllTerrains (bool synchronous=false)
 Load any terrain instances that have been defined but not loaded yet. More...
 
void loadGroupDefinition (const String &filename)
 Load the group definition only in native form from a file. More...
 
void loadGroupDefinition (StreamSerialiser &stream)
 Load the group definition only in native form from a serializing stream. More...
 
void loadLegacyTerrain (const ConfigFile &cfg, long x=0, long y=0, bool synchronous=true)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void loadLegacyTerrain (const String &cfgFilename, long x=0, long y=0, bool synchronous=true)
 Load a terrain.cfg as used by the terrain scene manager into a single terrain slot. More...
 
virtual void loadTerrain (long x, long y, bool synchronous=false)
 Load a specific terrain slot based on the definition that has already been supplied. More...
 
uint32 packIndex (long x, long y) const
 Convert coordinates to a packed integer index. More...
 
RayResult rayIntersects (const Ray &ray, Real distanceLimit=0) const
 Test for intersection of a given ray with any terrain in the group. More...
 
void removeAllTerrains ()
 Remove all terrain instances. More...
 
virtual void removeTerrain (long x, long y)
 Remove a specific terrain slot. More...
 
void saveAllTerrains (bool onlyIfModified, bool replaceManualFilenames=true)
 Save all terrain instances using the assigned file names, or via the filename convention. More...
 
void saveGroupDefinition (const String &filename)
 Save the group data only in native form to a file. More...
 
void saveGroupDefinition (StreamSerialiser &stream)
 Save the group data only in native form to a serializing stream. More...
 
void setAutoUpdateLod (TerrainAutoUpdateLod *updater)
 
void setFilenameConvention (const String &prefix, const String &extension)
 Set the naming convention for file names in this terrain group. More...
 
void setFilenameExtension (const String &extension)
 
void setFilenamePrefix (const String &prefix)
 
virtual void setOrigin (const Vector3 &pos)
 Define the centre position of the grid of terrain. More...
 
void setResourceGroup (const String &grp)
 Set the resource group in which files will be located. More...
 
virtual void setTerrainSize (uint16 newTerrainSize)
 Set the size of each terrain instance in number of vertices down one side. More...
 
virtual void setTerrainWorldSize (Real newWorldSize)
 Set the world size of terrain. More...
 
void sphereIntersects (const Sphere &sphere, TerrainList *resultList) const
 Test intersection of a sphere with the terrain. More...
 
virtual void unloadTerrain (long x, long y)
 Unload a specific terrain slot. More...
 
void unpackIndex (uint32 key, long *x, long *y)
 Convert a packed integer index to coordinates. More...
 
void update (bool synchronous=false)
 Trigger the update process for all terrain instances. More...
 
void updateDerivedData (bool synchronous=false, uint8 typeMask=0xFF)
 Updates derived data for all terrains (LOD, lighting) to reflect changed height data. More...
 
void updateGeometry ()
 Performs an update on all terrain geometry. More...
 
- Public Member Functions inherited from Ogre::WorkQueue::RequestHandler
 RequestHandler ()
 
virtual ~RequestHandler ()
 
- Public Member Functions inherited from Ogre::WorkQueue::ResponseHandler
 ResponseHandler ()
 
virtual ~ResponseHandler ()
 

Static Public Attributes

static const uint32 CHUNK_ID
 
static const uint16 CHUNK_VERSION
 
static const uint16 WORKQUEUE_LOAD_REQUEST
 

Detailed Description

Helper class to assist you in managing multiple terrain instances that are connected to each other.

Remarks
This class makes it easy to specify the same options for a group of terrain instances and have them positioned relative to each other and associated via each other's neighbour connections. You can do all this manually but this class just makes things easier, so that you only have to specify most options once.
Terrains are maintained in a grid of entries, and for simplicity the grid cells are indexed from 0 as a 'centre' slot, supporting both positive and negative values. so (0,0) is the centre slot, (1,0) is the slot to the right of the centre, (1,0) is the slot above the centre, (-2,1) is the slot two to the left of the centre and one up, etc. The maximum extent of each axis is -32768 to +32767, so in other words enough for over 4 billion entries. That should be enough for anyone!
Note that this is not a 'paging' class as such. It's simply a way to make it easier to perform common tasks with multiple terrain instances, which you choose when to define, load and remove. Automatic paging is handled separately by the Paging component.

Member Typedef Documentation

◆ TerrainList

◆ TerrainSlotMap

Packed map, signed 16 bits for each axis from -32767 to +32767.

◆ TerrainIterator

◆ ConstTerrainIterator

Constructor & Destructor Documentation

◆ TerrainGroup() [1/2]

Ogre::TerrainGroup::TerrainGroup ( SceneManager sm,
Terrain::Alignment  align,
uint16  terrainSize,
Real  terrainWorldSize 
)

Constructor.

Parameters
smThe SceneManager which will parent the terrain instances.
alignThe alignment that all terrain instances will use
terrainSizeThe size of each terrain down one edge in vertices (2^n+1)
terrainWorldSizeThe world size of each terrain instance

◆ TerrainGroup() [2/2]

Ogre::TerrainGroup::TerrainGroup ( SceneManager sm)

Alternate constructor.

Remarks
You can ONLY use this constructor if you subsequently call loadGroupDefinition or loadLegacyTerrain to populate the rest.

◆ ~TerrainGroup()

virtual Ogre::TerrainGroup::~TerrainGroup ( )
virtual

Member Function Documentation

◆ getDefaultImportSettings()

virtual Terrain::ImportData& Ogre::TerrainGroup::getDefaultImportSettings ( )
inlinevirtual

Retrieve a shared structure which will provide the base settings for all terrains created via this group.

Remarks
All neighbouring terrains should have the same basic settings (particularly the size parameters) - to avoid having to set the terrain import information more than once, you can retrieve the standard settings for this group here and modify them to your needs. Once you've done that you can use the shortcut methods in this class to create new terrain instances using these base settings (plus any per-instance settings you might want to use).
Note
The structure returned from this method is intended for in-place modification, that's why it is not const and there is no equivalent 'set' method. You should not, however, change the alignment or any of the size parameters after you start constructing instances, since neighbouring terrains should have the same size & alignment.

◆ setOrigin()

virtual void Ogre::TerrainGroup::setOrigin ( const Vector3 pos)
virtual

Define the centre position of the grid of terrain.

◆ getOrigin()

virtual const Vector3& Ogre::TerrainGroup::getOrigin ( ) const
inlinevirtual

Retrieve the centre position of the grid of terrain.

◆ getAlignment()

virtual Terrain::Alignment Ogre::TerrainGroup::getAlignment ( ) const
inlinevirtual

Retrieve the alignment of the grid of terrain (cannot be modified after construction).

◆ getTerrainWorldSize()

virtual Real Ogre::TerrainGroup::getTerrainWorldSize ( ) const
inlinevirtual

Retrieve the world size of each terrain instance.

◆ setTerrainWorldSize()

virtual void Ogre::TerrainGroup::setTerrainWorldSize ( Real  newWorldSize)
virtual

Set the world size of terrain.

Note
This will cause the terrains to change position due to their size change
Parameters
newWorldSizethe new world size of each terrain instance

◆ getTerrainSize()

virtual uint16 Ogre::TerrainGroup::getTerrainSize ( ) const
inlinevirtual

Retrieve the size of each terrain instance in number of vertices down one side.

◆ setTerrainSize()

virtual void Ogre::TerrainGroup::setTerrainSize ( uint16  newTerrainSize)
virtual

Set the size of each terrain instance in number of vertices down one side.

Note
This will cause the height data in each nested terrain to be bilinear filtered to fit the new data size.
Parameters
newTerrainSizethe new map size of each terrain instance

◆ getSceneManager()

virtual SceneManager* Ogre::TerrainGroup::getSceneManager ( ) const
inlinevirtual

Retrieve the SceneManager being used for this group.

◆ setFilenameConvention()

void Ogre::TerrainGroup::setFilenameConvention ( const String prefix,
const String extension 
)

Set the naming convention for file names in this terrain group.

Remarks
You can more easily generate file names for saved / loaded terrain slots if you define a naming prefix. When you call saveAllTerrains(), all the terrain instances currently loaded will be saved to a file named <prefix>_<index>.<extension>, where <index> is given by packing the x and y coordinates of the entry into a 32-bit index (
See also
packIndex).

◆ setFilenamePrefix()

void Ogre::TerrainGroup::setFilenamePrefix ( const String prefix)

◆ setFilenameExtension()

void Ogre::TerrainGroup::setFilenameExtension ( const String extension)

◆ getFilenamePrefix()

const String& Ogre::TerrainGroup::getFilenamePrefix ( ) const
inline

◆ getFilenameExtension()

const String& Ogre::TerrainGroup::getFilenameExtension ( ) const
inline

◆ setResourceGroup()

void Ogre::TerrainGroup::setResourceGroup ( const String grp)
inline

Set the resource group in which files will be located.

◆ getResourceGroup()

const String& Ogre::TerrainGroup::getResourceGroup ( ) const
inline

Get the resource group in which files will be located.

◆ defineTerrain() [1/6]

virtual void Ogre::TerrainGroup::defineTerrain ( long  x,
long  y 
)
virtual

Define a 'slot' in the terrain grid - in this case to be loaded from a generated file name.

Remarks
At this stage the terrain instance isn't actually present in the grid, you're merely expressing an intention for it to take its place there once it's loaded. The reason we do it like this is to support background preparation of this terrain instance.
Note
This method assumes that you want a file name to be generated from the naming convention that you have supplied (
See also
setFilenameConvention). If a file of that name isn't found during loading, then a flat terrain is created instead at height 0.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).

Referenced by Ogre::TerrainPagedWorldSection::TerrainDefiner::define().

◆ defineTerrain() [2/6]

virtual void Ogre::TerrainGroup::defineTerrain ( long  x,
long  y,
float  constantHeight 
)
virtual

Define a 'slot' in the terrain grid - in this case a flat terrain.

Remarks
At this stage the terrain instance isn't actually present in the grid, you're merely expressing an intention for it to take its place there once it's loaded. The reason we do it like this is to support background preparation of this terrain instance.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
constantHeightThe constant, uniform height that you want the terrain to start at

◆ defineTerrain() [3/6]

virtual void Ogre::TerrainGroup::defineTerrain ( long  x,
long  y,
const Terrain::ImportData importData 
)
virtual

Define the content of a 'slot' in the terrain grid.

Remarks
At this stage the terrain instance isn't actually present in the grid, you're merely expressing an intention for it to take its place there once it's loaded. The reason we do it like this is to support background preparation of this terrain instance.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
importDataImport data - this data is copied during the call so you may destroy your copy afterwards.

◆ defineTerrain() [4/6]

virtual void Ogre::TerrainGroup::defineTerrain ( long  x,
long  y,
const Image img,
const Terrain::LayerInstanceList layers = 0 
)
virtual

Define the content of a 'slot' in the terrain grid.

Remarks
At this stage the terrain instance isn't actually present in the grid, you're merely expressing an intention for it to take its place there once it's loaded. The reason we do it like this is to support background preparation of this terrain instance.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
imgHeightfield image - this data is copied during the call so you may destroy your copy afterwards.
layersOptional texture layers to use (if not supplied, default import data layers will be used) - this data is copied during the call so you may destroy your copy afterwards.

◆ defineTerrain() [5/6]

virtual void Ogre::TerrainGroup::defineTerrain ( long  x,
long  y,
const float *  pFloat,
const Terrain::LayerInstanceList layers = 0 
)
virtual

Define the content of a 'slot' in the terrain grid.

Remarks
At this stage the terrain instance isn't actually present in the grid, you're merely expressing an intention for it to take its place there once it's loaded. The reason we do it like this is to support background preparation of this terrain instance.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
pFloatHeights array
layersOptional texture layers to use (if not supplied, default import data layers will be used) - this data is copied during the call so you may destroy your copy afterwards.

◆ defineTerrain() [6/6]

virtual void Ogre::TerrainGroup::defineTerrain ( long  x,
long  y,
const String filename 
)
virtual

Define the content of a 'slot' in the terrain grid.

Remarks
At this stage the terrain instance isn't actually present in the grid, you're merely expressing an intention for it to take its place there once it's loaded. The reason we do it like this is to support background preparation of this terrain instance.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
filenameThe name of a file which fully defines the terrain (as written by Terrain::save). Size settings from all files must agree.

◆ loadAllTerrains()

virtual void Ogre::TerrainGroup::loadAllTerrains ( bool  synchronous = false)
virtual

Load any terrain instances that have been defined but not loaded yet.

Parameters
synchronousWhether we should force this to happen entirely in the primary thread

◆ loadTerrain()

virtual void Ogre::TerrainGroup::loadTerrain ( long  x,
long  y,
bool  synchronous = false 
)
virtual

Load a specific terrain slot based on the definition that has already been supplied.

Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
synchronousWhether we should force this to happen entirely in the primary thread

◆ loadLegacyTerrain() [1/2]

void Ogre::TerrainGroup::loadLegacyTerrain ( const String cfgFilename,
long  x = 0,
long  y = 0,
bool  synchronous = true 
)

Load a terrain.cfg as used by the terrain scene manager into a single terrain slot.

automatically configures the SM2Profile if it is used.

Attention
not all of the legacy parameters/ parameter combinations are supported
Parameters
cfgFilename.cfg file that specifices what textures/scale/mipmaps/etc to use.
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
synchronousWhether we should force this to happen entirely in the primary thread

◆ loadLegacyTerrain() [2/2]

void Ogre::TerrainGroup::loadLegacyTerrain ( const ConfigFile cfg,
long  x = 0,
long  y = 0,
bool  synchronous = true 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ unloadTerrain()

virtual void Ogre::TerrainGroup::unloadTerrain ( long  x,
long  y 
)
virtual

Unload a specific terrain slot.

Remarks
This destroys the Terrain instance but retains the slot definition (so it would be reloaded next time you call loadAllTerrains() if you did not remove it beforehand).
Note
While the definition of the terrain is kept, if you used import data to populate it, this will have been lost so repeat loading cannot occur. The only way to support repeat loading is via the 'filename' option of defineTerrain instead.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).

◆ removeTerrain()

virtual void Ogre::TerrainGroup::removeTerrain ( long  x,
long  y 
)
virtual

Remove a specific terrain slot.

Remarks
This destroys any Terrain instance at this position and also removes the definition, so it essentially no longer exists.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).

◆ removeAllTerrains()

void Ogre::TerrainGroup::removeAllTerrains ( )

Remove all terrain instances.

◆ saveAllTerrains()

void Ogre::TerrainGroup::saveAllTerrains ( bool  onlyIfModified,
bool  replaceManualFilenames = true 
)

Save all terrain instances using the assigned file names, or via the filename convention.

See also
setFilenameConvention
setResourceGroup
Parameters
onlyIfModifiedIf true, only terrains that have been modified since load(), or since the last save(), will be saved. You want to set this to true if you loaded the terrain from these same files, but false if you defined them using some other input data since the files wouldn't exist.
replaceManualFilenamesIf true, replaces any manually defined filenames in the TerrainSlotDefinition with the generated names from the convention. This is recommended since it makes everything more consistent, although you might want to use manual filenames in the original definition to import previously separate data.

◆ getTerrainDefinition()

virtual TerrainSlotDefinition* Ogre::TerrainGroup::getTerrainDefinition ( long  x,
long  y 
) const
virtual

Get the definition of a slot in the terrain.

Remarks
Definitions exist before the actual instances to allow background loading.
Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
Returns
The definition, or null if nothing is in this slot. While this return value is not const, you should be careful about modifying it; it will have no effect unless you load the terrain afterwards, and can cause a race condition if you modify it while a background load is in progress.

◆ getTerrain()

virtual Terrain* Ogre::TerrainGroup::getTerrain ( long  x,
long  y 
) const
virtual

Get the terrain instance at a given slot, if loaded.

Parameters
x,yThe coordinates of the terrain slot relative to the centre slot (signed).
Returns
The terrain, or null if no terrain is loaded in this slot (call getTerrainDefinition if you want to access the definition before it is loaded).

◆ freeTemporaryResources()

void Ogre::TerrainGroup::freeTemporaryResources ( )

Free as many resources as possible for optimal run-time memory use for all terrain tiles.

See also
Terrain::freeTemporaryResources

◆ update()

void Ogre::TerrainGroup::update ( bool  synchronous = false)

Trigger the update process for all terrain instances.

See also
Terrain::update

◆ updateGeometry()

void Ogre::TerrainGroup::updateGeometry ( )

Performs an update on all terrain geometry.

See also
Terrain::updateGeometry

◆ updateDerivedData()

void Ogre::TerrainGroup::updateDerivedData ( bool  synchronous = false,
uint8  typeMask = 0xFF 
)

Updates derived data for all terrains (LOD, lighting) to reflect changed height data.

See also
Terrain::updateDerivedData

◆ getHeightAtWorldPosition() [1/2]

float Ogre::TerrainGroup::getHeightAtWorldPosition ( Real  x,
Real  y,
Real  z,
Terrain **  ppTerrain = 0 
)

Get the height data for a given world position (projecting the point down on to the terrain underneath).

Parameters
x,y,zPosition in world space. Positions will be clamped to the edge of the terrain
ppTerrainPointer to a pointer to a terrain which will be completed with the terrain that was found to resolve this query, or null if none were

◆ getHeightAtWorldPosition() [2/2]

float Ogre::TerrainGroup::getHeightAtWorldPosition ( const Vector3 pos,
Terrain **  ppTerrain = 0 
)

Get the height data for a given world position (projecting the point down on to the terrain).

Parameters
posPosition in world space. Positions will be clamped to the edge of the terrain
ppTerrainPointer to a pointer to a terrain which will be completed with the terrain that was found to resolve this query, or null if none were

◆ rayIntersects()

RayResult Ogre::TerrainGroup::rayIntersects ( const Ray ray,
Real  distanceLimit = 0 
) const

Test for intersection of a given ray with any terrain in the group.

If the ray hits a terrain, the point of intersection and terrain instance is returned.

Parameters
rayThe ray to test for intersection
distanceLimitThe distance from the ray origin at which we will stop looking, 0 indicates no limit
Returns
A result structure which contains whether the ray hit a terrain and if so, where.
Remarks
This can be called from any thread as long as no parallel write to the terrain data occurs.

◆ boxIntersects()

void Ogre::TerrainGroup::boxIntersects ( const AxisAlignedBox box,
TerrainList resultList 
) const

Test intersection of a box with the terrain.

Remarks
Tests an AABB for overlap with a terrain bounding box. Note that this does not mean that the box touches the terrain itself, just the bounding box for the terrain. You can use this to get region results for further testing or use (e.g. painting areas).
Parameters
boxThe AABB you want to test in world units
resultListPointer to a list of terrain pointers which will be updated to include just the terrains that overlap

◆ sphereIntersects()

void Ogre::TerrainGroup::sphereIntersects ( const Sphere sphere,
TerrainList resultList 
) const

Test intersection of a sphere with the terrain.

Remarks
Tests a sphere for overlap with a terrain bounding box. Note that this does not mean that the sphere touches the terrain itself, just the bounding box for the terrain. You can use this to get region results for further testing or use (e.g. painting areas).
Parameters
sphereThe sphere you want to test in world units
resultListPointer to a list of terrain pointers which will be updated to include just the terrains that overlap

◆ convertWorldPositionToTerrainSlot()

void Ogre::TerrainGroup::convertWorldPositionToTerrainSlot ( const Vector3 pos,
long *  x,
long *  y 
) const

Convert a world position to terrain slot coordinates.

Parameters
posThe world position
x,yPointers to the coordinates to be completed.

◆ convertTerrainSlotToWorldPosition()

void Ogre::TerrainGroup::convertTerrainSlotToWorldPosition ( long  x,
long  y,
Vector3 pos 
) const

Convert a slot location to a world position at the centre.

Parameters
x,yThe slot coordinates
posPointer to the world position to be completed

◆ isDerivedDataUpdateInProgress()

bool Ogre::TerrainGroup::isDerivedDataUpdateInProgress ( ) const

Calls Terrain::isDerivedDataUpdateInProgress on each loaded instance and returns true if any of them are undergoing a derived update.

◆ getTerrainIterator() [1/2]

TerrainIterator Ogre::TerrainGroup::getTerrainIterator ( )

◆ getTerrainIterator() [2/2]

ConstTerrainIterator Ogre::TerrainGroup::getTerrainIterator ( ) const

◆ getTerrainSlots()

const TerrainSlotMap& Ogre::TerrainGroup::getTerrainSlots ( ) const
inline

Get the defined terrains.

◆ canHandleRequest()

bool Ogre::TerrainGroup::canHandleRequest ( const WorkQueue::Request req,
const WorkQueue srcQ 
)
overridevirtual

◆ handleRequest()

WorkQueue::Response* Ogre::TerrainGroup::handleRequest ( const WorkQueue::Request req,
const WorkQueue srcQ 
)
overridevirtual

◆ canHandleResponse()

bool Ogre::TerrainGroup::canHandleResponse ( const WorkQueue::Response res,
const WorkQueue srcQ 
)
overridevirtual

◆ handleResponse()

void Ogre::TerrainGroup::handleResponse ( const WorkQueue::Response res,
const WorkQueue srcQ 
)
overridevirtual

◆ packIndex()

uint32 Ogre::TerrainGroup::packIndex ( long  x,
long  y 
) const

Convert coordinates to a packed integer index.

◆ unpackIndex()

void Ogre::TerrainGroup::unpackIndex ( uint32  key,
long *  x,
long *  y 
)

Convert a packed integer index to coordinates.

◆ generateFilename()

String Ogre::TerrainGroup::generateFilename ( long  x,
long  y 
) const

Generate a file name based on the current naming convention.

◆ saveGroupDefinition() [1/2]

void Ogre::TerrainGroup::saveGroupDefinition ( const String filename)

Save the group data only in native form to a file.

◆ saveGroupDefinition() [2/2]

void Ogre::TerrainGroup::saveGroupDefinition ( StreamSerialiser stream)

Save the group data only in native form to a serializing stream.

◆ loadGroupDefinition() [1/2]

void Ogre::TerrainGroup::loadGroupDefinition ( const String filename)

Load the group definition only in native form from a file.

◆ loadGroupDefinition() [2/2]

void Ogre::TerrainGroup::loadGroupDefinition ( StreamSerialiser stream)

Load the group definition only in native form from a serializing stream.

◆ increaseLodLevel()

void Ogre::TerrainGroup::increaseLodLevel ( long  x,
long  y,
bool  synchronous = false 
)

Loads terrain's next LOD level.

◆ decreaseLodLevel()

void Ogre::TerrainGroup::decreaseLodLevel ( long  x,
long  y 
)

Removes terrain's highest LOD level.

◆ setAutoUpdateLod()

void Ogre::TerrainGroup::setAutoUpdateLod ( TerrainAutoUpdateLod updater)

◆ autoUpdateLod()

void Ogre::TerrainGroup::autoUpdateLod ( long  x,
long  y,
bool  synchronous,
const Any data 
)

Automatically checks if terrain's LOD level needs to be updated.

◆ autoUpdateLodAll()

void Ogre::TerrainGroup::autoUpdateLodAll ( bool  synchronous,
const Any data 
)

◆ getNumTerrainPrepareRequests()

size_t Ogre::TerrainGroup::getNumTerrainPrepareRequests ( ) const

Get the number of terrains that are still waiting for the Terrain::prepare() to be called.

Note
Terrain::prepare() happens in background thread so the actual call will be completed a bit before this returns the reduced number.
Returns
Amount of terrain prepare requests pending.

Member Data Documentation

◆ WORKQUEUE_LOAD_REQUEST

const uint16 Ogre::TerrainGroup::WORKQUEUE_LOAD_REQUEST
static

◆ CHUNK_ID

const uint32 Ogre::TerrainGroup::CHUNK_ID
static

◆ CHUNK_VERSION

const uint16 Ogre::TerrainGroup::CHUNK_VERSION
static

The documentation for this class was generated from the following file: