OgrePagedWorldSection.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_PagedWorldSection_H__
#define __Ogre_PagedWorldSection_H__
#include "OgrePagingPrerequisites.h"
#include "OgreAxisAlignedBox.h"
namespace Ogre
{
class _OgrePagingExport PagedWorldSection : public PageAlloc
{
public:
typedef map<PageID, Page*>::type PageMap;
protected:
String mName;
AxisAlignedBox mAABB;
PagedWorld* mParent;
PageStrategy* mStrategy;
PageStrategyData* mStrategyData;
PageMap mPages;
PageProvider* mPageProvider;
SceneManager* mSceneMgr;
virtual void loadSubtypeData(StreamSerialiser& ser) {}
virtual void saveSubtypeData(StreamSerialiser& ser) {}
public:
static const uint32 CHUNK_ID;
static const uint16 CHUNK_VERSION;
PagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm);
virtual ~PagedWorldSection();
PageManager* getManager() const;
virtual const String& getName() const { return mName; }
virtual PageStrategy* getStrategy() const { return mStrategy; }
virtual void setStrategy(PageStrategy* strat);
virtual void setStrategy(const String& stratName);
virtual void setSceneManager(SceneManager* sm);
virtual void setSceneManager(const String& smName);
virtual SceneManager* getSceneManager() const { return mSceneMgr; }
virtual PagedWorld* getWorld() const { return mParent; }
virtual PageStrategyData* getStrategyData() const { return mStrategyData; }
virtual void setBoundingBox(const AxisAlignedBox& box);
virtual const AxisAlignedBox& getBoundingBox() const;
virtual bool load(StreamSerialiser& stream);
virtual void save(StreamSerialiser& stream);
virtual void frameStart(Real timeSinceLastFrame);
virtual void frameEnd(Real timeElapsed);
virtual void notifyCamera(Camera* cam);
virtual Page* loadOrCreatePage(const Vector3& worldPos);
virtual PageID getPageID(const Vector3& worldPos);
virtual void loadPage(PageID pageID, bool forceSynchronous = false);
virtual void unloadPage(PageID pageID, bool forceSynchronous = false);
virtual void unloadPage(Page* p, bool forceSynchronous = false);
virtual bool _prepareProceduralPage(Page* page);
virtual bool _loadProceduralPage(Page* page);
virtual bool _unloadProceduralPage(Page* page);
virtual bool _unprepareProceduralPage(Page* page);
virtual void holdPage(PageID pageID);
virtual Page* getPage(PageID pageID);
virtual void removeAllPages();
virtual void setPageProvider(PageProvider* provider) { mPageProvider = provider; }
virtual PageProvider* getPageProvider() const { return mPageProvider; }
virtual StreamSerialiser* _readPageStream(PageID pageID);
virtual StreamSerialiser* _writePageStream(PageID pageID);
_OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorldSection& p );
virtual const String& getType();
};
class _OgrePagingExport PagedWorldSectionFactory : public PageAlloc
{
public:
virtual ~PagedWorldSectionFactory() {}
virtual const String& getName() const = 0;
virtual PagedWorldSection* createInstance(const String& name, PagedWorld* parent, SceneManager* sm) = 0;
virtual void destroyInstance(PagedWorldSection*) = 0;
};
}
#endif
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72
Ogre::PagedWorldSection::getPageProvider
virtual PageProvider * getPageProvider() const
Get the PageProvider which can provide streams for Pages in this section.
Definition: OgrePagedWorldSection.h:271
OgreAxisAlignedBox.h
Ogre::Page
Page class.
Definition: OgrePage.h:49
Ogre::PagedWorldSectionFactory
A factory class for creating types of world section.
Definition: OgrePagedWorldSection.h:301
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::PagedWorldSection::CHUNK_VERSION
static const uint16 CHUNK_VERSION
Definition: OgrePagedWorldSection.h:90
Ogre::PagedWorldSection::mStrategy
PageStrategy * mStrategy
Definition: OgrePagedWorldSection.h:77
OgrePagingPrerequisites.h
Ogre::PagedWorldSection::saveSubtypeData
virtual void saveSubtypeData(StreamSerialiser &ser)
Definition: OgrePagedWorldSection.h:85
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::PagedWorldSection::getName
virtual const String & getName() const
Get the name of this section.
Definition: OgrePagedWorldSection.h:99
Ogre::PagedWorldSection::mStrategyData
PageStrategyData * mStrategyData
Definition: OgrePagedWorldSection.h:78
Ogre::Vector3
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Ogre::PagedWorldSection::setPageProvider
virtual void setPageProvider(PageProvider *provider)
Set the PageProvider which can provide streams Pages in this section.
Definition: OgrePagedWorldSection.h:268
Ogre::PageStrategyData
Abstract marker class representing the data held against the PagedWorldSection which is specifically ...
Definition: OgrePageStrategy.h:49
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
This class represents a collection of pages which make up a world.
Definition: OgrePagedWorld.h:57
Ogre::PagedWorldSection::mAABB
AxisAlignedBox mAABB
Definition: OgrePagedWorldSection.h:75
Ogre::PagedWorldSection::PageMap
map< PageID, Page * >::type PageMap
Definition: OgrePagedWorldSection.h:72
Ogre::PagedWorldSection::mPages
PageMap mPages
Definition: OgrePagedWorldSection.h:79
Ogre::PagedWorldSection::mName
String mName
Definition: OgrePagedWorldSection.h:74
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::PagedWorldSection::CHUNK_ID
static const uint32 CHUNK_ID
Definition: OgrePagedWorldSection.h:89
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::PagedWorldSection::mSceneMgr
SceneManager * mSceneMgr
Definition: OgrePagedWorldSection.h:81
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::PagedWorldSection::getWorld
virtual PagedWorld * getWorld() const
Get the parent world.
Definition: OgrePagedWorldSection.h:133
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::PagedWorldSection::mParent
PagedWorld * mParent
Definition: OgrePagedWorldSection.h:76
Ogre::PagedWorldSectionFactory::~PagedWorldSectionFactory
virtual ~PagedWorldSectionFactory()
Definition: OgrePagedWorldSection.h:304
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
Ogre::PagedWorldSection::getStrategyData
virtual PageStrategyData * getStrategyData() const
Get the data required by the PageStrategy which is specific to this world section.
Definition: OgrePagedWorldSection.h:135
Ogre::AxisAlignedBox
A 3D box aligned with the x/y/z axes.
Definition: OgreAxisAlignedBox.h:54
Ogre::SceneManager
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Definition: OgreSceneManager.h:143
Ogre::PagedWorldSection::getSceneManager
virtual SceneManager * getSceneManager() const
Get the current SceneManager.
Definition: OgrePagedWorldSection.h:130
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::PagedWorldSection::mPageProvider
PageProvider * mPageProvider
Definition: OgrePagedWorldSection.h:80
Ogre::PagedWorldSection::loadSubtypeData
virtual void loadSubtypeData(StreamSerialiser &ser)
Load data specific to a subtype of this class (if any)
Definition: OgrePagedWorldSection.h:84
Ogre::PagedWorldSection::getStrategy
virtual PageStrategy * getStrategy() const
Get the page strategy which this section is using.
Definition: OgrePagedWorldSection.h:101

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