Loading...
Searching...
No Matches
Ogre::PageManager Class Reference
Optional Components » Paging

The PageManager is the entry point through which you load all PagedWorld instances, and the place where PageStrategy instances and factory classes are registered to customise the paging behaviour. More...

`#include <OgrePageManager.h>`

Inheritance diagram for Ogre::PageManager:
[legend]

## Public Types

typedef std::vector< Camera * > | CameraList
typedef std::map< String, PageContentCollectionFactory * > | ContentCollectionFactoryMap
typedef std::map< String, PageContentFactory * > | ContentFactoryMap
typedef std::map< String, PageStrategy * > | StrategyMap
typedef std::map< String, PagedWorld * > | WorldMap
typedef std::map< String, PagedWorldSectionFactory * > | WorldSectionFactoryMap

## Public Member Functions

| PageManager ()
virtual | ~PageManager ()
virtual bool | _loadProceduralPage (Page *page, PagedWorldSection *section)
| Give a provider the opportunity to prepare page content procedurally.
virtual bool | _prepareProceduralPage (Page *page, PagedWorldSection *section)
| Give a provider the opportunity to prepare page content procedurally.
StreamSerialiser * | _readPageStream (PageID pageID, PagedWorldSection *section)
| Get a serialiser set up to read Page data for the given PageID.
StreamSerialiser * | _readWorldStream (const String &filename)
| Get a serialiser set up to read PagedWorld data for the given world name.
virtual bool | _unloadProceduralPage (Page *page, PagedWorldSection *section)
| Give a manager the opportunity to unload page content procedurally.
virtual bool | _unprepareProceduralPage (Page *page, PagedWorldSection *section)
| Give a manager the opportunity to unprepare page content procedurally.
StreamSerialiser * | _writePageStream (PageID pageID, PagedWorldSection *section)
| Get a serialiser set up to write Page data for the given PageID.
StreamSerialiser * | _writeWorldStream (const String &filename)
| Get a serialiser set up to write PagedWorld data.
void | addCamera (Camera *c)
| Tells the paging system to start tracking a given camera.
void | addContentCollectionFactory (PageContentCollectionFactory *f)
| Add a new PageContentCollectionFactory implementation.
void | addContentFactory (PageContentFactory *f)
| Add a new PageContentFactory implementation.
void | addStrategy (PageStrategy *strategy)
| Add a new PageStrategy implementation.
void | addWorldSectionFactory (PagedWorldSectionFactory *f)
| Add a new PagedWorldSectionFactory implementation.
PageContent * | createContent (const String &typeName)
| Create a new instance of PageContent using the registered factories.
PageContentCollection * | createContentCollection (const String &typeName)
| Create a new instance of PageContentCollection using the registered factories.
PagedWorld * | createWorld (const String &name=BLANKSTRING)
| Create a new PagedWorld instance.
PagedWorldSection * | createWorldSection (const String &typeName, const String &name, PagedWorld *parent, SceneManager *sm)
| Create a new instance of PagedWorldSection using the registered factories.
void | destroyContent (PageContent *c)
| Destroy an instance of PageContent.
void | destroyContentCollection (PageContentCollection *coll)
| Destroy an instance of PageContentCollection.
void | destroyWorld (const String &name)
| Destroy a world.
void | destroyWorld (PagedWorld *world)
| Destroy a world.
void | destroyWorldSection (PagedWorldSection *s)
| Destroy an instance of PagedWorldSection.
const CameraList & | getCameraList () const
| Returns a list of cameras being tracked.
const ContentCollectionFactoryMap & | getContentCollectionFactories () const
| Get a reference to the registered strategies.
PageContentCollectionFactory * | getContentCollectionFactory (const String &name)
| Get a PageContentCollectionFactory.
const ContentFactoryMap & | getContentFactories () const
| Get a reference to the registered strategies.
PageContentFactory * | getContentFactory (const String &name)
| Get a PageContentFactory.
uint8 | getDebugDisplayLevel () const
| Get the debug display level.
PageProvider * | getPageProvider () const
| Get the PageProvider which can provide streams for any Page.
const String & | getPageResourceGroup () const
| Get the resource group that will be used to read/write files when the default load routines are used.
bool | getPagingOperationsEnabled () const
| Get whether paging operations are currently allowed to happen.
const StrategyMap & | getStrategies () const
| Get a reference to the registered strategies.
PageStrategy * | getStrategy (const String &name)
| Get a PageStrategy.
PagedWorld * | getWorld (const String &name)
| Get a named world.
const WorldMap & | getWorlds () const
| Get a reference to the worlds that are currently loaded.
const WorldSectionFactoryMap & | getWorldSectionFactories () const
| Get a reference to the registered strategies.
PagedWorldSectionFactory * | getWorldSectionFactory (const String &name)
| Get a PagedWorldSectionFactory.
bool | hasCamera (Camera *c) const
| Returns whether or not a given camera is being watched by the paging system.
PagedWorld * | loadWorld (const DataStreamPtr &stream, const String &name=BLANKSTRING)
| Load a new PagedWorld from a stream.
PagedWorld * | loadWorld (const String &filename, const String &name=BLANKSTRING)
| Load a new PagedWorld from a file.
void | removeCamera (Camera *c)
| Tells the paging system to stop tracking a given camera.
void | removeContentCollectionFactory (PageContentCollectionFactory *f)
| Remove a PageContentCollectionFactory implementation.
void | removeContentFactory (PageContentFactory *f)
| Remove a PageContentFactory implementation.
void | removeStrategy (PageStrategy *strategy)
| Remove a PageStrategy implementation.
void | removeWorldSectionFactory (PagedWorldSectionFactory *f)
| Remove a PagedWorldSectionFactory implementation.
void | saveWorld (PagedWorld *world, const DataStreamPtr &stream)
| Save a PagedWorld instance to a file.
void | saveWorld (PagedWorld *world, const String &filename)
| Save a PagedWorld instance to a file.
void | setDebugDisplayLevel (uint8 lvl)
| Set the debug display level.
void | setPageProvider (PageProvider *provider)
| Set the PageProvider which can provide streams for any Page.
void | setPageResourceGroup (const String &g)
| Set the resource group that will be used to read/write files when the default load routines are used.
void | setPagingOperationsEnabled (bool enabled)
| Pause or unpause all paging operations.

## Detailed Description

The PageManager is the entry point through which you load all PagedWorld instances, and the place where PageStrategy instances and factory classes are registered to customise the paging behaviour.

To get started, the minimum you need is a PagedWorld with at least one PagedWorldSection within it, and at least one Camera being tracked (see addCamera).

## Member Typedef Documentation

## WorldMap

typedef std::map<String, PagedWorld*> Ogre::PageManager::WorldMap

## StrategyMap

typedef std::map<String, PageStrategy*> Ogre::PageManager::StrategyMap

## ContentCollectionFactoryMap

typedef std::map<String, PageContentCollectionFactory*> Ogre::PageManager::ContentCollectionFactoryMap

## ContentFactoryMap

typedef std::map<String, PageContentFactory*> Ogre::PageManager::ContentFactoryMap

## WorldSectionFactoryMap

typedef std::map<String, PagedWorldSectionFactory*> Ogre::PageManager::WorldSectionFactoryMap

## CameraList

typedef std::vector<Camera*> Ogre::PageManager::CameraList

## Constructor & Destructor Documentation

## PageManager()

Ogre::PageManager::PageManager | ( |  | ) |

## ~PageManager()

virtual Ogre::PageManager::~PageManager | ( |  | ) |

virtual

## Member Function Documentation

## createWorld()

PagedWorld * Ogre::PageManager::createWorld | ( | const String & | name = BLANKSTRING | ) |

Create a new PagedWorld instance.

Parameters

  name | Optionally give a name to the world (if no name is given, one will be generated).

References Ogre::BLANKSTRING.

## destroyWorld() [1/2]

void Ogre::PageManager::destroyWorld | ( | const String & | name | ) |

Destroy a world.

## destroyWorld() [2/2]

void Ogre::PageManager::destroyWorld | ( | PagedWorld * | world | ) |

Destroy a world.

## loadWorld() [1/2]

PagedWorld * Ogre::PageManager::loadWorld | ( | const String & | filename,
|  | const String & | name = BLANKSTRING )

Load a new PagedWorld from a file.

Parameters

  filename | The name of the file to load (standard is .world)
  name | Optionally give a name to the world (if no name is given, one will be generated).

References Ogre::BLANKSTRING.

## loadWorld() [2/2]

PagedWorld * Ogre::PageManager::loadWorld | ( | const DataStreamPtr & | stream,
|  | const String & | name = BLANKSTRING )

Load a new PagedWorld from a stream.

Parameters

  stream | A stream from which to load the world data
  name | Optionally give a name to the world (if no name is given, one will be generated).

References Ogre::BLANKSTRING.

## saveWorld() [1/2]

void Ogre::PageManager::saveWorld | ( | PagedWorld * | world,
|  | const String & | filename )

Save a PagedWorld instance to a file.

Parameters

  world | The world to be saved
  filename | The filename to save the data to

## saveWorld() [2/2]

void Ogre::PageManager::saveWorld | ( | PagedWorld * | world,
|  | const DataStreamPtr & | stream )

Save a PagedWorld instance to a file.

Parameters

  world | The world to be saved
  stream | The stream to save the data to

## getWorld()

PagedWorld * Ogre::PageManager::getWorld | ( | const String & | name | ) |

Get a named world.

Parameters

  name | The name of the world (not a filename, the identifying name)

Returns
  The world, or null if the world doesn't exist.

## getWorlds()

const WorldMap & Ogre::PageManager::getWorlds | ( |  | ) | const

inline

Get a reference to the worlds that are currently loaded.

## addStrategy()

void Ogre::PageManager::addStrategy | ( | PageStrategy * | strategy | ) |

Add a new PageStrategy implementation.

The caller remains resonsible for destruction of this instance.

## removeStrategy()

void Ogre::PageManager::removeStrategy | ( | PageStrategy * | strategy | ) |

Remove a PageStrategy implementation.

## getStrategy()

PageStrategy * Ogre::PageManager::getStrategy | ( | const String & | name | ) |

Get a PageStrategy.

Parameters

  name | The name of the strategy to retrieve

Returns
  Pointer to a PageStrategy, or null if the strategy was not found.

## getStrategies()

const StrategyMap & Ogre::PageManager::getStrategies | ( |  | ) | const

Get a reference to the registered strategies.

## addContentCollectionFactory()

void Ogre::PageManager::addContentCollectionFactory | ( | PageContentCollectionFactory * | f | ) |

Add a new PageContentCollectionFactory implementation.

The caller remains resonsible for destruction of this instance.

## removeContentCollectionFactory()

void Ogre::PageManager::removeContentCollectionFactory | ( | PageContentCollectionFactory * | f | ) |

Remove a PageContentCollectionFactory implementation.

## getContentCollectionFactory()

PageContentCollectionFactory * Ogre::PageManager::getContentCollectionFactory | ( | const String & | name | ) |

Get a PageContentCollectionFactory.

Parameters

  name | The name of the factory to retrieve

Returns
  Pointer to a PageContentCollectionFactory, or null if the ContentCollection was not found.

## createContentCollection()

PageContentCollection * Ogre::PageManager::createContentCollection | ( | const String & | typeName | ) |

Create a new instance of PageContentCollection using the registered factories.

Parameters

  typeName | The name of the type of collection to create

## destroyContentCollection()

void Ogre::PageManager::destroyContentCollection | ( | PageContentCollection * | coll | ) |

Destroy an instance of PageContentCollection.

## getContentCollectionFactories()

const ContentCollectionFactoryMap & Ogre::PageManager::getContentCollectionFactories | ( |  | ) | const

Get a reference to the registered strategies.

## addContentFactory()

void Ogre::PageManager::addContentFactory | ( | PageContentFactory * | f | ) |

Add a new PageContentFactory implementation.

The caller remains resonsible for destruction of this instance.

## removeContentFactory()

void Ogre::PageManager::removeContentFactory | ( | PageContentFactory * | f | ) |

Remove a PageContentFactory implementation.

## getContentFactory()

PageContentFactory * Ogre::PageManager::getContentFactory | ( | const String & | name | ) |

Get a PageContentFactory.

Parameters

  name | The name of the factory to retrieve

Returns
  Pointer to a PageContentFactory, or null if the Content was not found.

## getContentFactories()

const ContentFactoryMap & Ogre::PageManager::getContentFactories | ( |  | ) | const

Get a reference to the registered strategies.

## createContent()

PageContent * Ogre::PageManager::createContent | ( | const String & | typeName | ) |

Create a new instance of PageContent using the registered factories.

Parameters

  typeName | The name of the type of content to create

## destroyContent()

void Ogre::PageManager::destroyContent | ( | PageContent * | c | ) |

Destroy an instance of PageContent.

## addWorldSectionFactory()

void Ogre::PageManager::addWorldSectionFactory | ( | PagedWorldSectionFactory * | f | ) |

Add a new PagedWorldSectionFactory implementation.

The caller remains resonsible for destruction of this instance.

## removeWorldSectionFactory()

void Ogre::PageManager::removeWorldSectionFactory | ( | PagedWorldSectionFactory * | f | ) |

Remove a PagedWorldSectionFactory implementation.

## getWorldSectionFactory()

PagedWorldSectionFactory * Ogre::PageManager::getWorldSectionFactory | ( | const String & | name | ) |

Get a PagedWorldSectionFactory.

Parameters

  name | The name of the factory to retrieve

Returns
  Pointer to a PagedWorldSectionFactory, or null if the WorldSection was not found.

## createWorldSection()

PagedWorldSection * Ogre::PageManager::createWorldSection | ( | const String & | typeName,
|  | const String & | name,
|  | PagedWorld * | parent,
|  | SceneManager * | sm )

Create a new instance of PagedWorldSection using the registered factories.

Parameters

  typeName | The name of the type of collection to create
  name | The instance name
  parent | The parent world
  sm | The SceneManager to use (can be null if this is to be loaded)

## destroyWorldSection()

void Ogre::PageManager::destroyWorldSection | ( | PagedWorldSection * | s | ) |

Destroy an instance of PagedWorldSection.

## getWorldSectionFactories()

const WorldSectionFactoryMap & Ogre::PageManager::getWorldSectionFactories | ( |  | ) | const

Get a reference to the registered strategies.

## setPageProvider()

void Ogre::PageManager::setPageProvider | ( | PageProvider * | provider | ) |

inline

Set the PageProvider which can provide streams for any Page.

This is the top-level way that you can direct how Page data is loaded. When data for a Page is requested for a PagedWorldSection, the following sequence of classes will be checked to see if they have a provider willing to supply the stream: PagedWorldSection, PagedWorld, PageManager. If none of these do, then the default behaviour is to look for a file called worldname_sectionname_pageID.page.

Note
  The caller remains responsible for the destruction of the provider.

## getPageProvider()

PageProvider * Ogre::PageManager::getPageProvider | ( |  | ) | const

inline

Get the PageProvider which can provide streams for any Page.

## _prepareProceduralPage()

virtual bool Ogre::PageManager::_prepareProceduralPage | ( | Page * | page,
|  | PagedWorldSection * | section )

virtual

Give a provider the opportunity to prepare page content procedurally.

You should not call this method directly. This call may well happen in a separate thread so it should not access GPU resources, use _loadProceduralPage for that

Returns
  true if the page was populated, false otherwise

## _loadProceduralPage()

virtual bool Ogre::PageManager::_loadProceduralPage | ( | Page * | page,
|  | PagedWorldSection * | section )

virtual

Give a provider the opportunity to prepare page content procedurally.

You should not call this method directly. This call will happen in the main render thread so it can access GPU resources. Use _prepareProceduralPage for background preparation.

Returns
  true if the page was populated, false otherwise

## _unloadProceduralPage()

virtual bool Ogre::PageManager::_unloadProceduralPage | ( | Page * | page,
|  | PagedWorldSection * | section )

virtual

Give a manager the opportunity to unload page content procedurally.

You should not call this method directly. This call will happen in the main render thread so it can access GPU resources. Use _unprepareProceduralPage for background preparation.

Returns
  true if the page was populated, false otherwise

## _unprepareProceduralPage()

virtual bool Ogre::PageManager::_unprepareProceduralPage | ( | Page * | page,
|  | PagedWorldSection * | section )

virtual

Give a manager the opportunity to unprepare page content procedurally.

You should not call this method directly. This call may well happen in a separate thread so it should not access GPU resources, use _unloadProceduralPage for that

Returns
  true if the page was unpopulated, false otherwise

## _readPageStream()

StreamSerialiser * Ogre::PageManager::_readPageStream | ( | PageID | pageID,
|  | PagedWorldSection * | section )

Get a serialiser set up to read Page data for the given PageID.

Parameters

  pageID | The ID of the page being requested
  section | The parent section to which this page will belong

The StreamSerialiser returned is the responsibility of the caller to delete.

## _writePageStream()

StreamSerialiser * Ogre::PageManager::_writePageStream | ( | PageID | pageID,
|  | PagedWorldSection * | section )

Get a serialiser set up to write Page data for the given PageID.

Parameters

  pageID | The ID of the page being requested
  section | The parent section to which this page will belong

The StreamSerialiser returned is the responsibility of the caller to delete.

## _readWorldStream()

StreamSerialiser * Ogre::PageManager::_readWorldStream | ( | const String & | filename | ) |

Get a serialiser set up to read PagedWorld data for the given world name.

The StreamSerialiser returned is the responsibility of the caller to delete.

## _writeWorldStream()

StreamSerialiser * Ogre::PageManager::_writeWorldStream | ( | const String & | filename | ) |

Get a serialiser set up to write PagedWorld data.

The StreamSerialiser returned is the responsibility of the caller to delete.

## getPageResourceGroup()

const String & Ogre::PageManager::getPageResourceGroup | ( |  | ) | const

inline

Get the resource group that will be used to read/write files when the default load routines are used.

## setPageResourceGroup()

void Ogre::PageManager::setPageResourceGroup | ( | const String & | g | ) |

inline

Set the resource group that will be used to read/write files when the default load routines are used.

## addCamera()

void Ogre::PageManager::addCamera | ( | Camera * | c | ) |

Tells the paging system to start tracking a given camera.

In order for the paging system to function it needs to know which Cameras to track. You may not want to have all your cameras affect the paging system, so just add the cameras you want it to keep track of here.

## removeCamera()

void Ogre::PageManager::removeCamera | ( | Camera * | c | ) |

Tells the paging system to stop tracking a given camera.

## hasCamera()

bool Ogre::PageManager::hasCamera | ( | Camera * | c | ) | const

Returns whether or not a given camera is being watched by the paging system.

## getCameraList()

const CameraList & Ogre::PageManager::getCameraList | ( |  | ) | const

Returns a list of cameras being tracked.

## setDebugDisplayLevel()

void Ogre::PageManager::setDebugDisplayLevel | ( | uint8 | lvl | ) |

inline

Set the debug display level.

This setting controls how much debug information is displayed in the scene. The exact interpretation of this value depends on the PageStrategy you're using, and whether the PageContent decides to also display debug information. Generally speaking, 0 means no debug display, 1 means simple debug display (usually the PageStrategy) and anything more than that is up to the classes involved.

## getDebugDisplayLevel()

uint8 Ogre::PageManager::getDebugDisplayLevel | ( |  | ) | const

inline

Get the debug display level.

## setPagingOperationsEnabled()

void Ogre::PageManager::setPagingOperationsEnabled | ( | bool | enabled | ) |

inline

Pause or unpause all paging operations.

Using this method you can stop pages being loaded or unloaded for a period of time, 'freezing' the current page state as it is.

Parameters

  enabled | True to proceed with normal paging operations, false to pause.

## getPagingOperationsEnabled()

bool Ogre::PageManager::getPagingOperationsEnabled | ( |  | ) | const

inline

Get whether paging operations are currently allowed to happen.

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

- OgrePageManager.h