Loading...
Searching...
No Matches
Ogre::TerrainPagedWorldSection Class Reference
Optional Components » Terrain

A world section which includes paged terrain. More...

`#include <OgreTerrainPagedWorldSection.h>`

Inheritance diagram for Ogre::TerrainPagedWorldSection:
[legend]

## Classes

class | TerrainDefiner

## Public Member Functions

| TerrainPagedWorldSection (const String &name, PagedWorld *parent, SceneManager *sm)
| Constructor.
virtual | ~TerrainPagedWorldSection ()
virtual Grid2DPageStrategy * | getGridStrategy () const
| Convenience method - this section always uses a grid strategy.
virtual Grid2DPageStrategyData * | getGridStrategyData () const
| Convenience method - this section always uses a grid strategy.
virtual Real | getHoldRadius ()
| Get the Holding radius.
virtual uint32 | getLoadingIntervalMs () const
| Get the interval between the loading of single pages in milliseconds (ms).
virtual Real | getLoadRadius () const
| Get the loading radius.
virtual int32 | getPageRangeMaxX () const
| get the index range of all Pages (values outside this will be ignored)
virtual int32 | getPageRangeMaxY () const
| get the index range of all Pages (values outside this will be ignored)
virtual int32 | getPageRangeMinX () const
| get the index range of all Pages (values outside this will be ignored)
virtual int32 | getPageRangeMinY () const
| get the index range of all Pages (values outside this will be ignored)
virtual TerrainGroup * | getTerrainGroup ()
| Get the TerrainGroup which this world section is using.
virtual void | init (TerrainGroup *grp)
| Initialise this section from an existing TerrainGroup instance.
void | loadPage (PageID pageID, bool forceSynchronous=false) override
| Overridden from PagedWorldSection.
void | setDefiner (TerrainDefiner *terrainDefiner)
virtual void | setHoldRadius (Real sz)
| Set the Holding radius.
virtual void | setLoadingIntervalMs (uint32 loadingIntervalMs)
| Set the interval between the loading of single pages in milliseconds (ms).
virtual void | setLoadRadius (Real sz)
| Set the loading radius.
virtual void | setPageRange (int32 minX, int32 minY, int32 maxX, int32 maxY)
| Set the index range of all Pages (values outside this will be ignored).
virtual void | setPageRangeMaxX (int32 maxX)
| Set the index range of all Pages (values outside this will be ignored).
virtual void | setPageRangeMaxY (int32 maxY)
| Set the index range of all Pages (values outside this will be ignored).
virtual void | setPageRangeMinX (int32 minX)
| Set the index range of all Pages (values outside this will be ignored).
virtual void | setPageRangeMinY (int32 minY)
| Set the index range of all Pages (values outside this will be ignored).
void | unloadPage (PageID pageID, bool forceSynchronous=false) override
| Overridden from PagedWorldSection.
Public Member Functions inherited from Ogre::PagedWorldSection
| PagedWorldSection (const String &name, PagedWorld *parent, SceneManager *sm)
| Construct a new instance, specifying the parent and scene manager.
virtual | ~PagedWorldSection ()
virtual bool | _loadProceduralPage (Page *page)
| Give a section the opportunity to prepare page content procedurally.
virtual bool | _prepareProceduralPage (Page *page)
| Give a section the opportunity to prepare page content procedurally.
virtual StreamSerialiser * | _readPageStream (PageID pageID)
| Get a serialiser set up to read Page data for the given PageID.
virtual bool | _unloadProceduralPage (Page *page)
| Give a section the opportunity to unload page content procedurally.
virtual bool | _unprepareProceduralPage (Page *page)
| Give a section the opportunity to unprepare page content procedurally.
virtual StreamSerialiser * | _writePageStream (PageID pageID)
| Get a serialiser set up to write Page data for the given PageID.
virtual void | frameEnd (Real timeElapsed)
| Called when the frame ends.
virtual void | frameStart (Real timeSinceLastFrame)
| Called when the frame starts.
virtual const AxisAlignedBox & | getBoundingBox () const
| Get the bounds of this section.
PageManager * | getManager () const
virtual const String & | getName () const
| Get the name of this section.
virtual Page * | getPage (PageID pageID)
| Retrieves a Page.
virtual PageID | getPageID (const Vector3 &worldPos)
| Get the page ID for a given world position.
virtual PageProvider * | getPageProvider () const
| Get the PageProvider which can provide streams for Pages in this section.
virtual SceneManager * | getSceneManager () const
| Get the current SceneManager.
virtual PageStrategy * | getStrategy () const
| Get the page strategy which this section is using.
virtual PageStrategyData * | getStrategyData () const
| Get the data required by the PageStrategy which is specific to this world section.
virtual const String & | getType ()
| Get the type name of this section.
virtual PagedWorld * | getWorld () const
| Get the parent world.
virtual void | holdPage (PageID pageID)
| Ask for a page to be kept in memory if it's loaded.
virtual bool | load (StreamSerialiser &stream)
| Load this section from a stream (returns true if successful).
virtual Page * | loadOrCreatePage (const Vector3 &worldPos)
| Load or create a page against this section covering the given world space position.
virtual void | notifyCamera (Camera *cam)
| Notify a section of the current camera.
virtual void | removeAllPages ()
| Remove all pages immediately.
virtual void | save (StreamSerialiser &stream)
| Save this section to a stream.
virtual void | setBoundingBox (const AxisAlignedBox &box)
| Set the bounds of this section.
virtual void | setPageProvider (PageProvider *provider)
| Set the PageProvider which can provide streams Pages in this section.
virtual void | setSceneManager (const String &smName)
| Change the SceneManager.
virtual void | setSceneManager (SceneManager *sm)
| Change the SceneManager.
virtual void | setStrategy (const String &stratName)
| Change the page strategy.
virtual void | setStrategy (PageStrategy *strat)
| Change the page strategy.
virtual void | unloadPage (Page *p, bool forceSynchronous=false)
| Ask for a page to be unloaded with the given (section-relative) PageID.

## Additional Inherited Members

Public Types inherited from Ogre::PagedWorldSection
typedef std::map< PageID, Page * > | PageMap
Static Public Attributes inherited from Ogre::PagedWorldSection
static const uint32 | CHUNK_ID
static const uint16 | CHUNK_VERSION

## Detailed Description

A world section which includes paged terrain.

Rather than implement terrain paging as a PageContent subclass, because terrain benefits from direct knowledge of neighbour arrangements and the tight coupling between that and the paging strategy, instead we use a PagedWorldSection subclass. This automatically provides a PageStrategy subclass of the correct type (Grid2DPageStrategy) and derives the correct settings for it compared to the terrain being used. This frees the user from having to try to match all these up through the generic interfaces.

  When creating this in code, the user should make use of the helper functions on the TerrainPaging class. The basic sequence is that you define your terrain settings in a TerrainGroup, and then create an instance of TerrainPagedWorldSection via TerrainPaging::createWorldSection. That's basically all there is to it - the normal rules of TerrainGroup apply, it's just that instead of having to choose when to try to load / unload pages from the TerrainGroup, that is automatically done by the paging system. You can also create other types of content in this PagedWorldSection other than terrain, it's just that this comes with terrain handling built-in.

  When this world data is saved, you basically get 3 sets of data - firstly the top-level 'world data' which is where the definition of the world sections are stored (and hence, the definition of this class, although none of the terrain instance content is included). Secondly, you get a number of .page files which include any other content that you might have inserted into the pages. Lastly, you get the standard terrain data files which are saved as per TerrainGroup.

## Constructor & Destructor Documentation

## TerrainPagedWorldSection()

Ogre::TerrainPagedWorldSection::TerrainPagedWorldSection | ( | const String & | name,
|  | PagedWorld * | parent,
|  | SceneManager * | sm )

Constructor.

Parameters

  name | The name of the section
  parent | The parent world
  sm | The SceneManager to use (can be left as null if to be loaded)

## ~TerrainPagedWorldSection()

virtual Ogre::TerrainPagedWorldSection::~TerrainPagedWorldSection | ( |  | ) |

virtual

## Member Function Documentation

## init()

virtual void Ogre::TerrainPagedWorldSection::init | ( | TerrainGroup * | grp | ) |

virtual

Initialise this section from an existing TerrainGroup instance.

This is the route you will take if you're defining this world section from scratch in code. The other alternative is that you'll be loading this section from a file, in which case all the settings will be derived from that.

Parameters

  grp | The TerrainGroup which will form the basis of this world section. The instance will be owned by this class from now on and will be destroyed by it.

## getTerrainGroup()

virtual TerrainGroup * Ogre::TerrainPagedWorldSection::getTerrainGroup | ( |  | ) |

inline virtual

Get the TerrainGroup which this world section is using.

Remarks
  For information, you can use the returned TerrainGroup to convert to/from x/y locations and the pageID, since the grid strategy is the same.

## setLoadRadius()

virtual void Ogre::TerrainPagedWorldSection::setLoadRadius | ( | Real | sz | ) |

virtual

Set the loading radius.

## getLoadRadius()

virtual Real Ogre::TerrainPagedWorldSection::getLoadRadius | ( |  | ) | const

virtual

Get the loading radius.

## setHoldRadius()

virtual void Ogre::TerrainPagedWorldSection::setHoldRadius | ( | Real | sz | ) |

virtual

Set the Holding radius.

## getHoldRadius()

virtual Real Ogre::TerrainPagedWorldSection::getHoldRadius | ( |  | ) |

virtual

Get the Holding radius.

## setPageRange()

virtual void Ogre::TerrainPagedWorldSection::setPageRange | ( | int32 | minX,
|  | int32 | minY,
|  | int32 | maxX,
|  | int32 | maxY )

virtual

Set the index range of all Pages (values outside this will be ignored).

## setPageRangeMinX()

virtual void Ogre::TerrainPagedWorldSection::setPageRangeMinX | ( | int32 | minX | ) |

virtual

Set the index range of all Pages (values outside this will be ignored).

## setPageRangeMinY()

virtual void Ogre::TerrainPagedWorldSection::setPageRangeMinY | ( | int32 | minY | ) |

virtual

Set the index range of all Pages (values outside this will be ignored).

## setPageRangeMaxX()

virtual void Ogre::TerrainPagedWorldSection::setPageRangeMaxX | ( | int32 | maxX | ) |

virtual

Set the index range of all Pages (values outside this will be ignored).

## setPageRangeMaxY()

virtual void Ogre::TerrainPagedWorldSection::setPageRangeMaxY | ( | int32 | maxY | ) |

virtual

Set the index range of all Pages (values outside this will be ignored).

## getPageRangeMinX()

virtual int32 Ogre::TerrainPagedWorldSection::getPageRangeMinX | ( |  | ) | const

virtual

get the index range of all Pages (values outside this will be ignored)

## getPageRangeMinY()

virtual int32 Ogre::TerrainPagedWorldSection::getPageRangeMinY | ( |  | ) | const

virtual

get the index range of all Pages (values outside this will be ignored)

## getPageRangeMaxX()

virtual int32 Ogre::TerrainPagedWorldSection::getPageRangeMaxX | ( |  | ) | const

virtual

get the index range of all Pages (values outside this will be ignored)

## getPageRangeMaxY()

virtual int32 Ogre::TerrainPagedWorldSection::getPageRangeMaxY | ( |  | ) | const

virtual

get the index range of all Pages (values outside this will be ignored)

## getGridStrategy()

virtual Grid2DPageStrategy * Ogre::TerrainPagedWorldSection::getGridStrategy | ( |  | ) | const

virtual

Convenience method - this section always uses a grid strategy.

## getGridStrategyData()

virtual Grid2DPageStrategyData * Ogre::TerrainPagedWorldSection::getGridStrategyData | ( |  | ) | const

virtual

Convenience method - this section always uses a grid strategy.

## setLoadingIntervalMs()

virtual void Ogre::TerrainPagedWorldSection::setLoadingIntervalMs | ( | uint32 | loadingIntervalMs | ) |

virtual

Set the interval between the loading of single pages in milliseconds (ms).

## getLoadingIntervalMs()

virtual uint32 Ogre::TerrainPagedWorldSection::getLoadingIntervalMs | ( |  | ) | const

virtual

Get the interval between the loading of single pages in milliseconds (ms).

## loadPage()

void Ogre::TerrainPagedWorldSection::loadPage | ( | PageID | pageID,
|  | bool | forceSynchronous = false )

override virtual

Overridden from PagedWorldSection.

Reimplemented from Ogre::PagedWorldSection.

## unloadPage()

void Ogre::TerrainPagedWorldSection::unloadPage | ( | PageID | pageID,
|  | bool | forceSynchronous = false )

override virtual

Overridden from PagedWorldSection.

Reimplemented from Ogre::PagedWorldSection.

## setDefiner()

void Ogre::TerrainPagedWorldSection::setDefiner | ( | TerrainDefiner * | terrainDefiner | ) |

inline

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

- OgreTerrainPagedWorldSection.h