Ogre::PagedWorld Class Reference
[Paging]

This class represents a collection of pages which make up a world. More...

#include <OgrePagedWorld.h>

Inheritance diagram for Ogre::PagedWorld:
Inheritance graph
[legend]

List of all members.

Public Types

typedef map< String,
PagedWorldSection * >::type 
SectionMap

Public Member Functions

 PagedWorld (const String &name, PageManager *manager)
 Constructor.
virtual ~PagedWorld ()
const StringgetName () const
PageManagergetManager () const
 Get the manager of this world.
void load (const String &filename)
 Load world data from a file.
void load (const DataStreamPtr &stream)
 Load world data from a stream.
bool load (StreamSerialiser &stream)
 Load world data from a serialiser (returns true if successful).
void save (const String &filename)
 Save world data to a file.
void save (const DataStreamPtr &stream)
 Save world data to a stream.
void save (StreamSerialiser &stream)
 Save world data to a serialiser.
PagedWorldSectioncreateSection (SceneManager *sceneMgr, const String &typeName, const String &sectionName=StringUtil::BLANK)
 Create a new section of the world based on a specialised type.
PagedWorldSectioncreateSection (const String &strategyName, SceneManager *sceneMgr, const String &sectionName=StringUtil::BLANK)
 Create a new manually defined section of the world.
PagedWorldSectioncreateSection (PageStrategy *strategy, SceneManager *sceneMgr, const String &sectionName=StringUtil::BLANK)
 Create a manually defined new section of the world.
void destroySection (const String &name)
 Destroy a section of world.
void destroySection (PagedWorldSection *sec)
 Destroy a section of world.
void destroyAllSections ()
 Destroy all world sections.
size_t getSectionCount () const
 Get the number of sections this world has.
PagedWorldSectiongetSection (const String &name)
 Retrieve a section of the world.
const SectionMapgetSections () const
 Retrieve a const reference to all the sections in this world.
void setPageProvider (PageProvider *provider)
 Set the PageProvider which can provide streams for Pages in this world.
PageProvidergetPageProvider () const
 Get the PageProvider which can provide streams for Pages in this world.
virtual bool _prepareProceduralPage (Page *page, PagedWorldSection *section)
 Give a world the opportunity to prepare page content procedurally.
virtual bool _loadProceduralPage (Page *page, PagedWorldSection *section)
 Give a world the opportunity to prepare page content procedurally.
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_readPageStream (PageID pageID, PagedWorldSection *section)
 Get a serialiser set up to read Page data for the given PageID.
StreamSerialiser_writePageStream (PageID pageID, PagedWorldSection *section)
 Get a serialiser set up to read Page data for the given PageID.
virtual void frameStart (Real timeSinceLastFrame)
 Called when the frame starts.
virtual void frameEnd (Real timeElapsed)
 Called when the frame ends.
virtual void notifyCamera (Camera *cam)
 Notify a world of the current camera.
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
void * operator new (size_t sz)
void * operator new (size_t sz, void *ptr)
 placement operator new
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
void * operator new[] (size_t sz)
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 *)

Static Public Attributes

static const uint32 CHUNK_ID
static const uint16 CHUNK_VERSION
static const uint32 CHUNK_SECTIONDECLARATION_ID

Protected Attributes

String mName
PageManagermManager
PageProvidermPageProvider
SectionMap mSections
NameGenerator mSectionNameGenerator

Friends

_OgrePagingExport friend
std::ostream & 
operator<< (std::ostream &o, const PagedWorld &p)
 Function for writing to a stream.

Detailed Description

This class represents a collection of pages which make up a world.

Remarks:
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.

Definition at line 56 of file OgrePagedWorld.h.


Member Typedef Documentation

Definition at line 160 of file OgrePagedWorld.h.


Constructor & Destructor Documentation

Ogre::PagedWorld::PagedWorld ( const String name,
PageManager manager 
)

Constructor.

Parameters:
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 Ogre::PagedWorld::~PagedWorld (  )  [virtual]

Member Function Documentation

virtual bool Ogre::PagedWorld::_loadProceduralPage ( Page page,
PagedWorldSection section 
) [virtual]

Give a world the opportunity to prepare page content procedurally.

Remarks:
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
virtual bool Ogre::PagedWorld::_prepareProceduralPage ( Page page,
PagedWorldSection section 
) [virtual]

Give a world the opportunity to prepare page content procedurally.

Remarks:
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
StreamSerialiser* Ogre::PagedWorld::_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
Remarks:
The StreamSerialiser returned is the responsibility of the caller to delete.
virtual bool Ogre::PagedWorld::_unloadProceduralPage ( Page page,
PagedWorldSection section 
) [virtual]

Give a world the opportunity to unload page content procedurally.

Remarks:
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
virtual bool Ogre::PagedWorld::_unprepareProceduralPage ( Page page,
PagedWorldSection section 
) [virtual]

Give a world the opportunity to unprepare page content procedurally.

Remarks:
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
StreamSerialiser* Ogre::PagedWorld::_writePageStream ( 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
Remarks:
The StreamSerialiser returned is the responsibility of the caller to delete.
PagedWorldSection* Ogre::PagedWorld::createSection ( PageStrategy strategy,
SceneManager sceneMgr,
const String sectionName = StringUtil::BLANK 
)

Create a manually defined new section of the world.

Remarks:
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.
Parameters:
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)
PagedWorldSection* Ogre::PagedWorld::createSection ( const String strategyName,
SceneManager sceneMgr,
const String sectionName = StringUtil::BLANK 
)

Create a new manually defined section of the world.

Remarks:
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.
Parameters:
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 ( SceneManager sceneMgr,
const String typeName,
const String sectionName = StringUtil::BLANK 
)

Create a new section of the world based on a specialised type.

Remarks:
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.
Parameters:
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)
void Ogre::PagedWorld::destroyAllSections (  ) 

Destroy all world sections.

void Ogre::PagedWorld::destroySection ( PagedWorldSection sec  ) 

Destroy a section of world.

void Ogre::PagedWorld::destroySection ( const String name  ) 

Destroy a section of world.

virtual void Ogre::PagedWorld::frameEnd ( Real  timeElapsed  )  [virtual]

Called when the frame ends.

virtual void Ogre::PagedWorld::frameStart ( Real  timeSinceLastFrame  )  [virtual]

Called when the frame starts.

PageManager* Ogre::PagedWorld::getManager (  )  const

Get the manager of this world.

Definition at line 79 of file OgrePagedWorld.h.

const String& Ogre::PagedWorld::getName ( void   )  const

Definition at line 77 of file OgrePagedWorld.h.

PageProvider* Ogre::PagedWorld::getPageProvider (  )  const

Get the PageProvider which can provide streams for Pages in this world.

Definition at line 178 of file OgrePagedWorld.h.

PagedWorldSection* Ogre::PagedWorld::getSection ( const String name  ) 

Retrieve a section of the world.

size_t Ogre::PagedWorld::getSectionCount (  )  const

Get the number of sections this world has.

Definition at line 155 of file OgrePagedWorld.h.

const SectionMap& Ogre::PagedWorld::getSections (  )  const

Retrieve a const reference to all the sections in this world.

Definition at line 162 of file OgrePagedWorld.h.

bool Ogre::PagedWorld::load ( StreamSerialiser stream  ) 

Load world data from a serialiser (returns true if successful).

void Ogre::PagedWorld::load ( const DataStreamPtr stream  ) 

Load world data from a stream.

void Ogre::PagedWorld::load ( const String filename  ) 

Load world data from a file.

virtual void Ogre::PagedWorld::notifyCamera ( Camera cam  )  [virtual]

Notify a world of the current camera.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
) [inherited]

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
) [inherited]

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr  )  [inherited]

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
) [inherited]

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr  )  [inherited]

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
) [inherited]

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz  )  [inherited]

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
) [inherited]

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz  )  [inherited]

Definition at line 90 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
) [inherited]

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

void Ogre::PagedWorld::save ( StreamSerialiser stream  ) 

Save world data to a serialiser.

void Ogre::PagedWorld::save ( const DataStreamPtr stream  ) 

Save world data to a stream.

void Ogre::PagedWorld::save ( const String filename  ) 

Save world data to a file.

Parameters:
filename The name of the file to create; this can either be an absolute filename or
void Ogre::PagedWorld::setPageProvider ( PageProvider provider  ) 

Set the PageProvider which can provide streams for Pages in this world.

Remarks:
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.

Definition at line 175 of file OgrePagedWorld.h.


Friends And Related Function Documentation

_OgrePagingExport friend std::ostream& operator<< ( std::ostream &  o,
const PagedWorld p 
) [friend]

Function for writing to a stream.


Member Data Documentation

Definition at line 64 of file OgrePagedWorld.h.

Definition at line 66 of file OgrePagedWorld.h.

Definition at line 65 of file OgrePagedWorld.h.

Definition at line 60 of file OgrePagedWorld.h.

Definition at line 59 of file OgrePagedWorld.h.

Definition at line 61 of file OgrePagedWorld.h.

Definition at line 244 of file OgrePagedWorld.h.

Definition at line 243 of file OgrePagedWorld.h.


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

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:41:46 2012