Abstract class which describes the interface which a source of terrain pages must implement.
More...
#include <OgreTerrainPageSource.h>
|
| TerrainPageSource () |
|
virtual | ~TerrainPageSource () |
|
virtual void | expirePage (ushort x, ushort z)=0 |
| This notifies the tile source that the specified page of tiles has been automatically detached. More...
|
|
virtual void | initialise (TerrainSceneManager *tsm, ushort tileSize, ushort pageSize, bool asyncLoading, TerrainPageSourceOptionList &optionList) |
| Initialise this tile source based on a series of options as dictated by the scene manager. More...
|
|
void | operator delete (void *ptr) |
|
void | operator delete (void *ptr, void *) |
|
void | operator delete (void *ptr, const char *, int, const char *) |
|
void | operator delete[] (void *ptr) |
|
void | operator delete[] (void *ptr, const char *, int, const char *) |
|
void * | operator new (size_t sz, const char *file, int line, const char *func) |
| operator new, with debug line info More...
|
|
void * | operator new (size_t sz) |
|
void * | operator new (size_t sz, void *ptr) |
| placement operator new More...
|
|
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
| array operator new, with debug line info More...
|
|
void * | operator new[] (size_t sz) |
|
virtual void | requestPage (ushort x, ushort z)=0 |
| Requests a new page of tiles from the source. More...
|
|
virtual void | shutdown (void) |
| Shut down this tile source, freeing all it's memory ready for decommissioning. More...
|
|
Abstract class which describes the interface which a source of terrain pages must implement.
- The overall sequence of events is this:
-
TerrainSceneManager is created as usual, and options such as tile size etc are set.
-
CustomTerrainPageSource is registered with TerrainSceneManager by calling registerPageSource(), registering a particular named type of source data with this tile source.
-
-
TerrainSceneManager::setWorldGeometry is called. Depending on the configuration, this will call one of the page source classes initialise methods, when the scene manager will communicate it's preferred options. It does not have to load anything immediately on this call (especially if the terrain options include paging). It will also set this tile source as the primary.
-
-
As and when TerrainSceneManager requires more tiles (and this will either be done all up-front, or progressively depending on paging settings) it will call the primary tile source's requestPage() method, with the page it requires.
-
It is then the responsibility of the tile source to prepare TerrainRenderable instances for the page(s) requested, and to attach them to the TerrainSceneManager. Note that preparing the tiles does not involve modifying any shared data so may be done in an alternate thread, if required. Attaching them must be done synchronously though.
-
When paging, the TerrainSceneManager will request tiles in advance, within it's 'buffer zone' so some delay in loading is acceptable. It will also indicate when tiles are no longer required (and will detach them); it is up to the tile source whether that memory is actually freed or held for a while longer.
- Note
- The comments on paging above are in principle, the implementation of paging in this manager is not present yet but the system is designed to extend to it. For now, all tiles are requested up-front.
Definition at line 136 of file OgreTerrainPageSource.h.
Ogre::TerrainPageSource::TerrainPageSource |
( |
| ) |
|
virtual Ogre::TerrainPageSource::~TerrainPageSource |
( |
| ) |
|
|
inlinevirtual |
Register a class which will be called back whenever a new page is available.
Utility method for building a page of tiles based on some source data, wherever that may have come from.
virtual void Ogre::TerrainPageSource::expirePage |
( |
ushort |
x, |
|
|
ushort |
z |
|
) |
| |
|
pure virtual |
This notifies the tile source that the specified page of tiles has been automatically detached.
- Parameters
-
x | The x index of the page expired |
z | The z index of the page expired |
Implemented in Ogre::HeightmapTerrainPageSource.
void Ogre::TerrainPageSource::firePageConstructed |
( |
size_t |
pagex, |
|
|
size_t |
pagez, |
|
|
Real * |
heightData |
|
) |
| |
|
protected |
Internal method for firing pageContructed events.
Initialise this tile source based on a series of options as dictated by the scene manager.
- Parameters
-
tsm | The TerrainSceneManager doing the initialising. This should be allowed NULL, for use by external tools if they want to read data generically without necessarily having a real scene manager involved |
tileSize | The number of horizontal (and hence also vertical) vertices in a single tile (which is a TerrainRenderable). This will always be (2^n)+1. |
pageSize | The number of horizontal (and hence also vertical) vertices in a single page. This will always be (2^n)+1. |
asyncLoading | True if the scene manager would like the tile source to load tiles asynchronously. It does not have to do this, although if it does not when requested, it will likely result in stalls in the terrain rendering. |
optionList | A list of name/value pairs describing custom options for this particular page source. The expected convention for option names is "TypeName.OptionName", where TypeName is the type under which this page source has been registered. |
Reimplemented in Ogre::HeightmapTerrainPageSource.
Definition at line 185 of file OgreTerrainPageSource.h.
template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new |
( |
size_t |
sz, |
|
|
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
func |
|
) |
| |
|
inlineinherited |
template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] |
( |
size_t |
sz, |
|
|
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
func |
|
) |
| |
|
inlineinherited |
Unregister a class which will be called back whenever a new page is available.
virtual void Ogre::TerrainPageSource::requestPage |
( |
ushort |
x, |
|
|
ushort |
z |
|
) |
| |
|
pure virtual |
Requests a new page of tiles from the source.
- Now, the tile source does not necessarily need to do all that before the return of this method. If it likes, and particularly if asynchronous loading is enabled, it can merely queue this request, and process it either in another thread, or over a series of frames. The key thing is that attaching the new page has to be done synchronously with the main rendering loop in order to avoid concurrency issues; other than that, you are free to load and prepare new tiles in a concurrent fashion if you like.
- Typically the scene manager will request at least one page up-front, with the possibility of requesting more if paging is enabled.
- Parameters
-
x | The x index of the page requested |
z | The z index of the page requested |
Implemented in Ogre::HeightmapTerrainPageSource.
virtual void Ogre::TerrainPageSource::shutdown |
( |
void |
| ) |
|
|
inlinevirtual |
bool Ogre::TerrainPageSource::mAsyncLoading |
|
protected |
unsigned short Ogre::TerrainPageSource::mPageSize |
|
protected |
unsigned short Ogre::TerrainPageSource::mTileSize |
|
protected |
The documentation for this class was generated from the following file: