Go to the documentation of this file.
29 #ifndef __Ogre_TerrainGroup_H__
30 #define __Ogre_TerrainGroup_H__
81 Real terrainWorldSize);
257 virtual void loadTerrain(
long x,
long y,
bool synchronous =
false);
387 : hit(_hit), terrain(_terrain), position(_pos) {}
virtual Terrain::Alignment getAlignment() const
Retrieve the alignment of the grid of terrain (cannot be modified after construction).
bool isDerivedDataUpdateInProgress() const
Calls Terrain::isDerivedDataUpdateInProgress on each loaded instance and returns true if any of them ...
void saveAllTerrains(bool onlyIfModified, bool replaceManualFilenames=true)
Save all terrain instances using the assigned file names, or via the filename convention.
virtual void defineTerrain(long x, long y, const Terrain::ImportData *importData)
Define the content of a 'slot' in the terrain grid.
const String & getFilenameExtension() const
Terrain::DefaultGpuBufferAllocator mBufferAllocator
Terrain::Alignment mAlignment
RayResult rayIntersects(const Ray &ray, Real distanceLimit=0) const
Test for intersection of a given ray with any terrain in the group.
RayResult(bool _hit, Terrain *_terrain, const Vector3 &_pos)
Terrain::ImportData * importData
Import data, if this is to be defined based on importing.
Helper class to assist you in managing multiple terrain instances that are connected to each other.
static const uint32 CHUNK_ID
void handleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
WorkQueue::ResponseHandler override.
Alignment
The alignment of the terrain.
Interface to a general purpose request / response style background work queue.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
General purpose request structure.
String mFilenameExtension
void decreaseLodLevel(long x, long y)
Removes terrain's highest LOD level.
Terrain * terrain
Which terrain instance was hit, if any.
virtual void removeTerrain(long x, long y)
Remove a specific terrain slot.
static const uint16 WORKQUEUE_LOAD_REQUEST
void connectNeighbour(TerrainSlot *slot, long offsetx, long offsety)
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.
TerrainIterator getTerrainIterator()
Get an iterator over the defined terrains.
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.
const String & getResourceGroup() const
Get the resource group in which files will be located.
void removeAllTerrains()
Remove all terrain instances.
TerrainSlot * getTerrainSlot(long x, long y, bool createIfMissing)
Retrieve a slot, potentially allocate one.
Vector3 position
Position at which the intersection occurred.
void saveGroupDefinition(StreamSerialiser &stream)
Save the group data only in native form to a serializing stream.
virtual SceneManager * getSceneManager() const
Retrieve the SceneManager being used for this group.
TerrainSlotDefinition def
Definition used to load the terrain.
void loadTerrainImpl(TerrainSlot *slot, bool synchronous)
TerrainSlot * getTerrainSlot(long x, long y) const
Class representing an image file.
#define _OgreTerrainExport
TerrainSlotMap mTerrainSlots
const String & getFilenamePrefix() const
void unpackIndex(uint32 key, long *x, long *y)
Convert a packed integer index to coordinates.
void convertTerrainSlotToWorldPosition(long x, long y, Vector3 *pos) const
Convert a slot location to a world position at the centre.
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).
virtual TerrainSlotDefinition * getTerrainDefinition(long x, long y) const
Get the definition of a slot in the terrain.
The main containing class for a chunk of terrain.
bool canHandleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
WorkQueue::ResponseHandler override.
Variant type that can hold Any other type.
void autoUpdateLod(long x, long y, bool synchronous, const Any &data)
Automatically checks if terrain's LOD level needs to be updated.
void update(bool synchronous=false)
Trigger the update process for all terrain instances.
General purpose response structure.
TerrainSlot(long _x, long _y)
SceneManager * mSceneManager
String filename
Filename, if this is to be loaded from a file.
void updateGeometry()
Performs an update on all terrain geometry.
virtual void loadTerrain(long x, long y, bool synchronous=false)
Load a specific terrain slot based on the definition that has already been supplied.
bool canHandleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
WorkQueue::RequestHandler override.
virtual void loadAllTerrains(bool synchronous=false)
Load any terrain instances that have been defined but not loaded yet.
void setAutoUpdateLod(TerrainAutoUpdateLod *updater)
TerrainGroup(SceneManager *sm, Terrain::Alignment align, uint16 terrainSize, Real terrainWorldSize)
Constructor.
void increaseLodLevel(long x, long y, bool synchronous=false)
Loads terrain's next LOD level.
_OgreTerrainExport friend std::ostream & operator<<(std::ostream &o, const LoadRequest &r)
void boxIntersects(const AxisAlignedBox &box, TerrainList *resultList) const
Test intersection of a box with the terrain.
Manages the organisation and rendering of a 'scene' i.e.
virtual const Vector3 & getOrigin() const
Retrieve the centre position of the grid of terrain.
Result from a terrain ray intersection with the terrain group.
Structure for holding the load request.
Interface definition for a handler of responses.
virtual void setOrigin(const Vector3 &pos)
Define the centre position of the grid of terrain.
void convertWorldPositionToTerrainSlot(const Vector3 &pos, long *x, long *y) const
Convert a world position to terrain slot coordinates.
static uint loadingTaskNum
void updateDerivedData(bool synchronous=false, uint8 typeMask=0xFF)
Updates derived data for all terrains (LOD, lighting) to reflect changed height data.
String generateFilename(long x, long y) const
Generate a file name based on the current naming convention.
void sphereIntersects(const Sphere &sphere, TerrainList *resultList) const
Test intersection of a sphere with the terrain.
Standard implementation of a buffer allocator which re-uses buffers.
void saveGroupDefinition(const String &filename)
Save the group data only in native form to a file.
Terrain::ImportData mDefaultImportData
void useFilename()
Set to use file name.
A 3D box aligned with the x/y/z axes.
void useImportData()
Set to use import data.
void freeTemporaryResources()
Free as many resources as possible for optimal run-time memory use for all terrain tiles.
vector< Terrain * >::type TerrainList
void setResourceGroup(const String &grp)
Set the resource group in which files will be located.
A sphere primitive, mostly used for bounds checking.
void freeImportData()
Destroy temp import resources.
virtual Terrain * getTerrain(long x, long y) const
Get the terrain instance at a given slot, if loaded.
virtual void defineTerrain(long x, long y, float constantHeight)
Define a 'slot' in the terrain grid - in this case a flat terrain.
void loadGroupDefinition(StreamSerialiser &stream)
Load the group definition only in native form from a serializing stream.
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
Vector3 getTerrainSlotPosition(long x, long y)
Get the position of a terrain instance.
Utility class providing helper methods for reading / writing structured data held in a DataStream.
virtual void setTerrainWorldSize(Real newWorldSize)
Set the world size of terrain.
void setFilenameExtension(const String &extension)
virtual void defineTerrain(long x, long y, const String &filename)
Define the content of a 'slot' in the terrain grid.
virtual void unloadTerrain(long x, long y)
Unload a specific terrain slot.
void setFilenamePrefix(const String &prefix)
TerrainGroup(SceneManager *sm)
Alternate constructor.
vector< LayerInstance >::type LayerInstanceList
ConstMapIterator< TerrainSlotMap > ConstTerrainIterator
virtual Real getTerrainWorldSize() const
Retrieve the world size of each terrain instance.
Slot for a terrain instance, together with its definition.
virtual Terrain::ImportData & getDefaultImportSettings()
Retrieve a shared structure which will provide the base settings for all terrains created via this gr...
Interface definition for a handler of requests.
float Real
Software floating point type.
Concrete IteratorWrapper for const access to the underlying key-value container.
uint32 packIndex(long x, long y) const
Convert coordinates to a packed integer index.
Terrain automatic LOD loading.
void setFilenameConvention(const String &prefix, const String &extension)
Set the naming convention for file names in this terrain group.
map< uint32, TerrainSlot * >::type TerrainSlotMap
Packed map, signed 16 bits for each axis from -32767 to +32767.
static const uint16 CHUNK_VERSION
virtual uint16 getTerrainSize() const
Retrieve the size of each terrain instance in number of vertices down one side.
TerrainAutoUpdateLod * mAutoUpdateLod
Representation of a ray in space, i.e.
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 underneat...
WorkQueue::Response * handleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
WorkQueue::RequestHandler override.
Terrain * instance
Actual terrain instance.
bool hit
Whether an intersection occurred.
virtual void setTerrainSize(uint16 newTerrainSize)
Set the size of each terrain instance in number of vertices down one side.
ConstTerrainIterator getTerrainIterator() const
Get an iterator over the defined terrains (const)
void autoUpdateLodAll(bool synchronous, const Any &data)
void loadGroupDefinition(const String &filename)
Load the group definition only in native form from a file.
Standard 3-dimensional vector.
Definition of how to populate a 'slot' in the terrain group.
MapIterator< TerrainSlotMap > TerrainIterator
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.
Structure encapsulating import data that you may use to bootstrap the terrain without loading from a ...
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.