OgrePagedWorld.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_PagedWorld_H__
#define __Ogre_PagedWorld_H__
#include "OgrePagingPrerequisites.h"
#include "OgreString.h"
#include "OgreDataStream.h"
#include "OgreCommon.h"
#include "OgreNameGenerator.h"
namespace Ogre
{
class PageManager;
class _OgrePagingExport PagedWorld : public PageAlloc
{
protected:
String mName;
PageManager* mManager;
PageProvider* mPageProvider;
public:
static const uint32 CHUNK_ID;
static const uint16 CHUNK_VERSION;
static const uint32 CHUNK_SECTIONDECLARATION_ID;
PagedWorld(const String& name, PageManager* manager);
virtual ~PagedWorld();
const String& getName() const { return mName; }
PageManager* getManager() const { return mManager; }
void load(const String& filename);
void load(const DataStreamPtr& stream);
bool load(StreamSerialiser& stream);
void save(const String& filename);
void save(const DataStreamPtr& stream);
void save(StreamSerialiser& stream);
PagedWorldSection* createSection(SceneManager* sceneMgr,
const String& typeName,
const String& sectionName = StringUtil::BLANK);
PagedWorldSection* createSection(const String& strategyName, SceneManager* sceneMgr,
const String& sectionName = StringUtil::BLANK);
PagedWorldSection* createSection(PageStrategy* strategy, SceneManager* sceneMgr,
const String& sectionName = StringUtil::BLANK);
void destroySection(const String& name);
void destroySection(PagedWorldSection* sec);
void destroyAllSections();
size_t getSectionCount() const { return mSections.size(); }
PagedWorldSection* getSection(const String& name);
typedef map<String, PagedWorldSection*>::type SectionMap;
const SectionMap& getSections() const { return mSections; }
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);
virtual void frameStart(Real timeSinceLastFrame);
virtual void frameEnd(Real timeElapsed);
virtual void notifyCamera(Camera* cam);
_OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorld& p );
protected:
SectionMap mSections;
NameGenerator mSectionNameGenerator;
};
}
#endif
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72
Ogre::PagedWorld::mSections
SectionMap mSections
Definition: OgrePagedWorld.h:244
Ogre::PagedWorld::getName
const String & getName() const
Definition: OgrePagedWorld.h:78
Ogre::PagedWorld::SectionMap
map< String, PagedWorldSection * >::type SectionMap
Definition: OgrePagedWorld.h:161
Ogre::Page
Page class.
Definition: OgrePage.h:49
Ogre::NameGenerator
Utility class to generate a sequentially numbered series of names.
Definition: OgreNameGenerator.h:56
Ogre::PagedWorld::getSections
const SectionMap & getSections() const
Retrieve a const reference to all the sections in this world.
Definition: OgrePagedWorld.h:163
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
OgreString.h
OgrePagingPrerequisites.h
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::PagedWorld::mPageProvider
PageProvider * mPageProvider
Definition: OgrePagedWorld.h:62
OgreDataStream.h
Ogre::PagedWorld::mName
String mName
Definition: OgrePagedWorld.h:60
Ogre::PagedWorld::CHUNK_VERSION
static const uint16 CHUNK_VERSION
Definition: OgrePagedWorld.h:66
OgreCommon.h
Ogre::PagedWorld::CHUNK_SECTIONDECLARATION_ID
static const uint32 CHUNK_SECTIONDECLARATION_ID
Definition: OgrePagedWorld.h:67
Ogre::PagedWorld::getManager
PageManager * getManager() const
Get the manager of this world.
Definition: OgrePagedWorld.h:80
Ogre::PagedWorld::getSectionCount
size_t getSectionCount() const
Get the number of sections this world has.
Definition: OgrePagedWorld.h:156
Ogre::operator<<
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
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::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::PagedWorld::setPageProvider
void setPageProvider(PageProvider *provider)
Set the PageProvider which can provide streams for Pages in this world.
Definition: OgrePagedWorld.h:176
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::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::PagedWorld::mSectionNameGenerator
NameGenerator mSectionNameGenerator
Definition: OgrePagedWorld.h:245
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::PagedWorld::getPageProvider
PageProvider * getPageProvider() const
Get the PageProvider which can provide streams for Pages in this world.
Definition: OgrePagedWorld.h:179
Ogre::SharedPtr< DataStream >
Ogre::PagedWorld::mManager
PageManager * mManager
Definition: OgrePagedWorld.h:61
Ogre::PageProvider
Abstract class that can be implemented by the user application to provide a way to retrieve or genera...
Definition: OgrePageManager.h:59
Ogre::map
Definition: OgrePrerequisites.h:533
OgreNameGenerator.h
Ogre::SceneManager
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Definition: OgreSceneManager.h:143
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::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
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::PagedWorld::CHUNK_ID
static const uint32 CHUNK_ID
Definition: OgrePagedWorld.h:65

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