OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
This class represents a collection of pages which make up a world. More...
#include <OgrePagedWorld.h>
Public Types | |
typedef std::map< String, PagedWorldSection * > | SectionMap |
Public Member Functions | |
PagedWorld (const String &name, PageManager *manager) | |
Constructor. | |
virtual | ~PagedWorld () |
virtual bool | _loadProceduralPage (Page *page, PagedWorldSection *section) |
Give a world the opportunity to prepare page content procedurally. | |
virtual bool | _prepareProceduralPage (Page *page, PagedWorldSection *section) |
Give a world 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. | |
virtual bool | _unloadProceduralPage (Page *page, PagedWorldSection *section) |
Give a world the opportunity to unload page content procedurally. | |
virtual bool | _unprepareProceduralPage (Page *page, PagedWorldSection *section) |
Give a world the opportunity to unprepare page content procedurally. | |
StreamSerialiser * | _writePageStream (PageID pageID, PagedWorldSection *section) |
Get a serialiser set up to read Page data for the given PageID. | |
PagedWorldSection * | createSection (const String &strategyName, SceneManager *sceneMgr, const String §ionName=BLANKSTRING) |
Create a new manually defined section of the world. | |
PagedWorldSection * | createSection (PageStrategy *strategy, SceneManager *sceneMgr, const String §ionName=BLANKSTRING) |
Create a manually defined new section of the world. | |
PagedWorldSection * | createSection (SceneManager *sceneMgr, const String &typeName, const String §ionName=BLANKSTRING) |
Create a new section of the world based on a specialised type. | |
void | destroyAllSections () |
Destroy all world sections. | |
void | destroySection (const String &name) |
Destroy a section of world. | |
void | destroySection (PagedWorldSection *sec) |
Destroy a section of world. | |
virtual void | frameEnd (Real timeElapsed) |
Called when the frame ends. | |
virtual void | frameStart (Real timeSinceLastFrame) |
Called when the frame starts. | |
PageManager * | getManager () const |
Get the manager of this world. | |
const String & | getName () const |
PageProvider * | getPageProvider () const |
Get the PageProvider which can provide streams for Pages in this world. | |
PagedWorldSection * | getSection (const String &name) |
Retrieve a section of the world. | |
size_t | getSectionCount () const |
Get the number of sections this world has. | |
const SectionMap & | getSections () const |
Retrieve a const reference to all the sections in this world. | |
void | load (const DataStreamPtr &stream) |
Load world data from a stream. | |
void | load (const String &filename) |
Load world data from a file. | |
bool | load (StreamSerialiser &stream) |
Load world data from a serialiser (returns true if successful) | |
virtual void | notifyCamera (Camera *cam) |
Notify a world of the current camera. | |
void | save (const DataStreamPtr &stream) |
Save world data to a stream. | |
void | save (const String &filename) |
Save world data to a file. | |
void | save (StreamSerialiser &stream) |
Save world data to a serialiser. | |
void | setPageProvider (PageProvider *provider) |
Set the PageProvider which can provide streams for Pages in this world. | |
Static Public Attributes | |
static const uint32 | CHUNK_ID |
static const uint32 | CHUNK_SECTIONDECLARATION_ID |
static const uint16 | CHUNK_VERSION |
This class represents a collection of pages which make up a world.
It's important to bear in mind that the PagedWorld only delineates the world and knows how to find out about the contents of it. It does not, by design, contain all elements of the world, in memory, at once.
typedef std::map<String, PagedWorldSection*> Ogre::PagedWorld::SectionMap |
Ogre::PagedWorld::PagedWorld | ( | const String & | name, |
PageManager * | manager | ||
) |
Constructor.
name | The name of the world, which must be enough to identify the place where data for it can be loaded from (doesn't have to be a filename necessarily). |
manager | The PageManager that is in charge of providing this world with services such as related object factories. |
|
virtual |
|
inline |
Get the manager of this world.
void Ogre::PagedWorld::load | ( | const DataStreamPtr & | stream | ) |
Load world data from a stream.
bool Ogre::PagedWorld::load | ( | StreamSerialiser & | stream | ) |
Load world data from a serialiser (returns true if successful)
Save world data to a file.
filename | The name of the file to create; this can either be an absolute filename or |
void Ogre::PagedWorld::save | ( | const DataStreamPtr & | stream | ) |
Save world data to a stream.
void Ogre::PagedWorld::save | ( | StreamSerialiser & | stream | ) |
Save world data to a serialiser.
PagedWorldSection * Ogre::PagedWorld::createSection | ( | SceneManager * | sceneMgr, |
const String & | typeName, | ||
const String & | sectionName = BLANKSTRING |
||
) |
Create a new section of the world based on a specialised type.
World sections are areas of the world that use a particular PageStrategy, with a certain set of parameters specific to that strategy, and potentially some other rules. So you would have more than one section in a world only if you needed different simultaneous paging strategies, or you wanted the same strategy but parameterised differently.
sceneMgr | The SceneManager to use for this section. |
typeName | The type of section to use (must be registered with PageManager), or blank to use the default type (simple grid) |
sectionName | An optional name to give the section (if none is provided, one will be generated) |
PagedWorldSection * Ogre::PagedWorld::createSection | ( | const String & | strategyName, |
SceneManager * | sceneMgr, | ||
const String & | sectionName = BLANKSTRING |
||
) |
Create a new manually defined section of the world.
World sections are areas of the world that use a particular PageStrategy, with a certain set of parameters specific to that strategy. So you would have more than one section in a world only if you needed different simultaneous paging strategies, or you wanted the same strategy but parameterised differently.
strategyName | The name of the strategy to use (must be registered with PageManager) |
sceneMgr | The SceneManager to use for this section |
sectionName | An optional name to give the section (if none is provided, one will be generated) |
PagedWorldSection * Ogre::PagedWorld::createSection | ( | PageStrategy * | strategy, |
SceneManager * | sceneMgr, | ||
const String & | sectionName = BLANKSTRING |
||
) |
Create a manually defined new section of the world.
World sections are areas of the world that use a particular PageStrategy, with a certain set of parameters specific to that strategy. So you would have more than one section in a world only if you needed different simultaneous paging strategies, or you wanted the same strategy but parameterised differently.
strategy | The strategy to use |
sceneMgr | The SceneManager to use for this section |
sectionName | An optional name to give the section (if none is provided, one will be generated) |
void Ogre::PagedWorld::destroySection | ( | PagedWorldSection * | sec | ) |
Destroy a section of world.
void Ogre::PagedWorld::destroyAllSections | ( | ) |
Destroy all world sections.
|
inline |
Get the number of sections this world has.
PagedWorldSection * Ogre::PagedWorld::getSection | ( | const String & | name | ) |
Retrieve a section of the world.
|
inline |
Retrieve a const reference to all the sections in this world.
|
inline |
Set the PageProvider which can provide streams for Pages in this world.
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.
|
inline |
Get the PageProvider which can provide streams for Pages in this world.
|
virtual |
Give a world 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
|
virtual |
Give a world 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.
|
virtual |
Give a world 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.
|
virtual |
Give a world 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
StreamSerialiser * Ogre::PagedWorld::_readPageStream | ( | PageID | pageID, |
PagedWorldSection * | section | ||
) |
Get a serialiser set up to read Page data for the given PageID.
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.
StreamSerialiser * Ogre::PagedWorld::_writePageStream | ( | PageID | pageID, |
PagedWorldSection * | section | ||
) |
Get a serialiser set up to read Page data for the given PageID.
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.
Called when the frame starts.
Notify a world of the current camera.