OgrePageManager.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __Ogre_PageManager_H__
#define __Ogre_PageManager_H__
#include "OgrePagingPrerequisites.h"
#include "OgreString.h"
#include "OgreResourceGroupManager.h"
#include "OgreCommon.h"
#include "OgreCamera.h"
#include "OgreFrameListener.h"
#include "OgreNameGenerator.h"
namespace Ogre
{
class PagedWorldSection;
class PagedWorldSectionFactory;
class PageProvider
{
public:
PageProvider() {}
virtual ~PageProvider() {}
virtual bool prepareProceduralPage(Page* page, PagedWorldSection* section) { return false; }
virtual bool loadProceduralPage(Page* page, PagedWorldSection* section) { return false; }
virtual bool unloadProceduralPage(Page* page, PagedWorldSection* section) { return false; }
virtual bool unprepareProceduralPage(Page* page, PagedWorldSection* section) { return false; }
virtual StreamSerialiser* readWorldStream(const String& filename) { return 0; }
virtual StreamSerialiser* writeWorldStream(const String& filename) { return 0; }
virtual StreamSerialiser* readPageStream(PageID pageID, PagedWorldSection* section) { return 0; }
virtual StreamSerialiser* writePageStream(PageID pageID, PagedWorldSection* section) { return 0; }
};
class _OgrePagingExport PageManager : public PageAlloc
{
public:
PageManager();
virtual ~PageManager();
PagedWorld* createWorld(const String& name = StringUtil::BLANK);
void destroyWorld(const String& name);
void destroyWorld(PagedWorld* world);
PagedWorld* loadWorld(const String& filename, const String& name = StringUtil::BLANK);
PagedWorld* loadWorld(const DataStreamPtr& stream, const String& name = StringUtil::BLANK);
void saveWorld(PagedWorld* world, const String& filename);
void saveWorld(PagedWorld* world, const DataStreamPtr& stream);
PagedWorld* getWorld(const String& name);
typedef map<String, PagedWorld*>::type WorldMap;
const WorldMap& getWorlds() const { return mWorlds; }
typedef map<String, PageStrategy*>::type StrategyMap;
void addStrategy(PageStrategy* strategy);
void removeStrategy(PageStrategy* strategy);
PageStrategy* getStrategy(const String& name);
const StrategyMap& getStrategies() const;
typedef map<String, PageContentCollectionFactory*>::type ContentCollectionFactoryMap;
void addContentCollectionFactory(PageContentCollectionFactory* f);
void removeContentCollectionFactory(PageContentCollectionFactory* f);
PageContentCollectionFactory* getContentCollectionFactory(const String& name);
PageContentCollection* createContentCollection(const String& typeName);
void destroyContentCollection(PageContentCollection* coll);
const ContentCollectionFactoryMap& getContentCollectionFactories() const;
typedef map<String, PageContentFactory*>::type ContentFactoryMap;
void addContentFactory(PageContentFactory* f);
void removeContentFactory(PageContentFactory* f);
PageContentFactory* getContentFactory(const String& name);
const ContentFactoryMap& getContentFactories() const;
PageContent* createContent(const String& typeName);
void destroyContent(PageContent* c);
typedef map<String, PagedWorldSectionFactory*>::type WorldSectionFactoryMap;
void addWorldSectionFactory(PagedWorldSectionFactory* f);
void removeWorldSectionFactory(PagedWorldSectionFactory* f);
PagedWorldSectionFactory* getWorldSectionFactory(const String& name);
PagedWorldSection* createWorldSection(const String& typeName,
const String& name, PagedWorld* parent, SceneManager* sm);
void destroyWorldSection(PagedWorldSection* s);
const WorldSectionFactoryMap& getWorldSectionFactories() const;
void setPageProvider(PageProvider* provider) { mPageProvider = provider; }
PageProvider* getPageProvider() const { return mPageProvider; }
virtual bool _prepareProceduralPage(Page* page, PagedWorldSection* section);
virtual bool _loadProceduralPage(Page* page, PagedWorldSection* section);
virtual bool _unloadProceduralPage(Page* page, PagedWorldSection* section);
virtual bool _unprepareProceduralPage(Page* page, PagedWorldSection* section);
StreamSerialiser* _readPageStream(PageID pageID, PagedWorldSection* section);
StreamSerialiser* _writePageStream(PageID pageID, PagedWorldSection* section);
StreamSerialiser* _readWorldStream(const String& filename);
StreamSerialiser* _writeWorldStream(const String& filename);
const String& getPageResourceGroup() const { return mPageResourceGroup; }
void setPageResourceGroup(const String& g) { mPageResourceGroup = g; }
void addCamera(Camera* c);
void removeCamera(Camera* c);
bool hasCamera(Camera* c) const;
typedef vector<Camera*>::type CameraList;
const CameraList& getCameraList() const;
void setDebugDisplayLevel(uint8 lvl) { mDebugDisplayLvl = lvl; }
uint8 getDebugDisplayLevel() const { return mDebugDisplayLvl; }
void setPagingOperationsEnabled(bool enabled) { mPagingEnabled = enabled; }
bool getPagingOperationsEnabled() const { return mPagingEnabled; }
protected:
class EventRouter : public Camera::Listener, public FrameListener
{
public:
PageManager* pManager;
WorldMap* pWorldMap;
CameraList* pCameraList;
EventRouter() : pManager(0), pWorldMap(0), pCameraList(0) {}
~EventRouter() {}
void cameraPreRenderScene(Camera* cam);
void cameraDestroyed(Camera* cam);
bool frameStarted(const FrameEvent& evt);
bool frameEnded(const FrameEvent& evt);
};
void createStandardStrategies();
void createStandardContentFactories();
WorldMap mWorlds;
StrategyMap mStrategies;
ContentCollectionFactoryMap mContentCollectionFactories;
ContentFactoryMap mContentFactories;
WorldSectionFactoryMap mWorldSectionFactories;
NameGenerator mWorldNameGenerator;
PageProvider* mPageProvider;
String mPageResourceGroup;
CameraList mCameraList;
EventRouter mEventRouter;
uint8 mDebugDisplayLvl;
bool mPagingEnabled;
Grid2DPageStrategy* mGrid2DPageStrategy;
Grid3DPageStrategy* mGrid3DPageStrategy;
SimplePageContentCollectionFactory* mSimpleCollectionFactory;
};
}
#endif
Ogre::PageManager::mGrid2DPageStrategy
Grid2DPageStrategy * mGrid2DPageStrategy
Definition: OgrePageManager.h:472
Ogre::PageProvider::unloadProceduralPage
virtual bool unloadProceduralPage(Page *page, PagedWorldSection *section)
Give a provider the opportunity to unload page content procedurally.
Definition: OgrePageManager.h:86
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72
Ogre::PageManager::WorldSectionFactoryMap
map< String, PagedWorldSectionFactory * >::type WorldSectionFactoryMap
Definition: OgrePageManager.h:269
Ogre::PageManager::mWorldSectionFactories
WorldSectionFactoryMap mWorldSectionFactories
Definition: OgrePageManager.h:463
Ogre::Grid3DPageStrategy
Page strategy which loads new pages based on a regular 3D grid.
Definition: OgreGrid3DPageStrategy.h:203
Ogre::PageManager::setPagingOperationsEnabled
void setPagingOperationsEnabled(bool enabled)
Pause or unpause all paging operations.
Definition: OgrePageManager.h:432
Ogre::PageManager::ContentFactoryMap
map< String, PageContentFactory * >::type ContentFactoryMap
Definition: OgrePageManager.h:238
Ogre::PageManager::WorldMap
map< String, PagedWorld * >::type WorldMap
Definition: OgrePageManager.h:181
Ogre::Page
Page class.
Definition: OgrePage.h:49
Ogre::PageContent
Interface definition for a unit of content within a page.
Definition: OgrePageContent.h:49
Ogre::NameGenerator
Utility class to generate a sequentially numbered series of names.
Definition: OgreNameGenerator.h:56
Ogre::PagedWorldSectionFactory
A factory class for creating types of world section.
Definition: OgrePagedWorldSection.h:301
Ogre::PageContentCollectionFactory
Define the interface to a factory class that will create subclasses of PageContentCollection.
Definition: OgrePageContentCollectionFactory.h:47
OgreString.h
OgrePagingPrerequisites.h
Ogre::PageManager::getDebugDisplayLevel
uint8 getDebugDisplayLevel() const
Get the debug display level.
Definition: OgrePageManager.h:424
Ogre::PagedWorldSection
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
Definition: OgrePagedWorldSection.h:69
Ogre::PageManager::EventRouter::pWorldMap
WorldMap * pWorldMap
Definition: OgrePageManager.h:444
Ogre::PageManager::mDebugDisplayLvl
uint8 mDebugDisplayLvl
Definition: OgrePageManager.h:469
Ogre::PageManager::ContentCollectionFactoryMap
map< String, PageContentCollectionFactory * >::type ContentCollectionFactoryMap
Definition: OgrePageManager.h:208
Ogre::PageProvider::loadProceduralPage
virtual bool loadProceduralPage(Page *page, PagedWorldSection *section)
Give a provider the opportunity to load page content procedurally.
Definition: OgrePageManager.h:78
Ogre::PageManager::mSimpleCollectionFactory
SimplePageContentCollectionFactory * mSimpleCollectionFactory
Definition: OgrePageManager.h:474
OgreFrameListener.h
Ogre::PageManager::mPagingEnabled
bool mPagingEnabled
Definition: OgrePageManager.h:470
Ogre::PageManager::mContentFactories
ContentFactoryMap mContentFactories
Definition: OgrePageManager.h:462
Ogre::PageManager::mWorldNameGenerator
NameGenerator mWorldNameGenerator
Definition: OgrePageManager.h:464
Ogre::PageManager::StrategyMap
map< String, PageStrategy * >::type StrategyMap
Definition: OgrePageManager.h:186
Ogre::PageProvider::readWorldStream
virtual StreamSerialiser * readWorldStream(const String &filename)
Get a serialiser set up to read PagedWorld data for the given world filename.
Definition: OgrePageManager.h:101
OgreCommon.h
Ogre::PageManager::setPageProvider
void setPageProvider(PageProvider *provider)
Set the PageProvider which can provide streams for any Page.
Definition: OgrePageManager.h:315
Ogre::PageManager::mGrid3DPageStrategy
Grid3DPageStrategy * mGrid3DPageStrategy
Definition: OgrePageManager.h:473
Ogre::PageProvider::PageProvider
PageProvider()
Definition: OgrePageManager.h:62
OgreCamera.h
Ogre::PageManager::mPageResourceGroup
String mPageResourceGroup
Definition: OgrePageManager.h:466
Ogre::PageManager::CameraList
vector< Camera * >::type CameraList
Definition: OgrePageManager.h:409
Ogre::PageManager::mCameraList
CameraList mCameraList
Definition: OgrePageManager.h:467
Ogre::PageProvider::unprepareProceduralPage
virtual bool unprepareProceduralPage(Page *page, PagedWorldSection *section)
Give a provider the opportunity to unprepare page content procedurally.
Definition: OgrePageManager.h:94
Ogre::uint8
unsigned char uint8
Definition: OgrePlatform.h:361
Ogre::PageManager
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.
Definition: OgrePageManager.h:136
Ogre::FrameEvent
Struct containing information about a frame event.
Definition: OgreFrameListener.h:44
Ogre::PageManager::setDebugDisplayLevel
void setDebugDisplayLevel(uint8 lvl)
Set the debug display level.
Definition: OgrePageManager.h:422
Ogre::PageProvider::readPageStream
virtual StreamSerialiser * readPageStream(PageID pageID, PagedWorldSection *section)
Get a serialiser set up to read Page data for the given PageID, or null if this provider cannot suppl...
Definition: OgrePageManager.h:116
Ogre::PageManager::EventRouter::~EventRouter
~EventRouter()
Definition: OgrePageManager.h:448
Ogre::PageContentCollection
Definition of the interface for a collection of PageContent instances.
Definition: OgrePageContentCollection.h:55
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::PageManager::mContentCollectionFactories
ContentCollectionFactoryMap mContentCollectionFactories
Definition: OgrePageManager.h:461
Ogre::PageManager::EventRouter::pManager
PageManager * pManager
Definition: OgrePageManager.h:443
Ogre::PageManager::EventRouter
Definition: OgrePageManager.h:440
Ogre::PagedWorld
This class represents a collection of pages which make up a world.
Definition: OgrePagedWorld.h:57
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream...
Definition: OgreStreamSerialiser.h:66
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Ogre::Grid2DPageStrategy
Page strategy which loads new pages based on a regular 2D grid.
Definition: OgreGrid2DPageStrategy.h:231
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::PageManager::EventRouter::EventRouter
EventRouter()
Definition: OgrePageManager.h:447
Ogre::SharedPtr< DataStream >
Ogre::PageProvider::~PageProvider
virtual ~PageProvider()
Definition: OgrePageManager.h:63
Ogre::PageManager::mPageProvider
PageProvider * mPageProvider
Definition: OgrePageManager.h:465
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::PageProvider::writePageStream
virtual StreamSerialiser * writePageStream(PageID pageID, PagedWorldSection *section)
Get a serialiser set up to write Page data for the given PageID, or null if this provider cannot supp...
Definition: OgrePageManager.h:126
Ogre::PageManager::mEventRouter
EventRouter mEventRouter
Definition: OgrePageManager.h:468
Ogre::PageManager::getPageResourceGroup
const String & getPageResourceGroup() const
Get the resource group that will be used to read/write files when the default load routines are used...
Definition: OgrePageManager.h:386
Ogre::PageManager::EventRouter::pCameraList
CameraList * pCameraList
Definition: OgrePageManager.h:445
Ogre::PageProvider
Abstract class that can be implemented by the user application to provide a way to retrieve or genera...
Definition: OgrePageManager.h:59
OgreResourceGroupManager.h
Ogre::PageProvider::prepareProceduralPage
virtual bool prepareProceduralPage(Page *page, PagedWorldSection *section)
Give a provider the opportunity to prepare page content procedurally.
Definition: OgrePageManager.h:71
Ogre::map
Definition: OgrePrerequisites.h:533
Ogre::SimplePageContentCollectionFactory
Factory class for SimplePageContentCollection.
Definition: OgreSimplePageContentCollection.h:111
OgreNameGenerator.h
Ogre::PageProvider::writeWorldStream
virtual StreamSerialiser * writeWorldStream(const String &filename)
Get a serialiser set up to write PagedWorld data for the given world filename.
Definition: OgrePageManager.h:107
Ogre::PageContentFactory
Define the interface to a factory class that will create subclasses of PageContent.
Definition: OgrePageContentFactory.h:50
Ogre::Camera::Listener
Listener interface so you can be notified of Camera events.
Definition: OgreCamera.h:91
Ogre::SceneManager
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Definition: OgreSceneManager.h:143
Ogre::PageManager::mStrategies
StrategyMap mStrategies
Definition: OgrePageManager.h:460
Ogre::PageManager::getPagingOperationsEnabled
bool getPagingOperationsEnabled() const
Get whether paging operations are currently allowed to happen.
Definition: OgrePageManager.h:435
Ogre::PageManager::mWorlds
WorldMap mWorlds
Definition: OgrePageManager.h:459
Ogre::PageManager::getWorlds
const WorldMap & getWorlds() const
Get a reference to the worlds that are currently loaded.
Definition: OgrePageManager.h:183
Ogre::StringUtil::BLANK
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
Definition: OgreString.h:196
Ogre::PageManager::setPageResourceGroup
void setPageResourceGroup(const String &g)
Set the resource group that will be used to read/write files when the default load routines are used...
Definition: OgrePageManager.h:390
Ogre::FrameListener
A interface class defining a listener which can be used to receive notifications of frame events...
Definition: OgreFrameListener.h:79
Ogre::PageStrategy
Defines the interface to a strategy class which is responsible for deciding when Page instances are r...
Definition: OgrePageStrategy.h:73
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::PageManager::getPageProvider
PageProvider * getPageProvider() const
Get the PageProvider which can provide streams for any Page.
Definition: OgrePageManager.h:318

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.