OgrePagedWorldSection.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __Ogre_PagedWorldSection_H__
30 #define __Ogre_PagedWorldSection_H__
31 
33 #include "OgreAxisAlignedBox.h"
34 
35 namespace Ogre
36 {
70  {
71  public:
73  protected:
82 
84  virtual void loadSubtypeData(StreamSerialiser& ser) {}
85  virtual void saveSubtypeData(StreamSerialiser& ser) {}
86 
87 
88  public:
89  static const uint32 CHUNK_ID;
90  static const uint16 CHUNK_VERSION;
91 
93  PagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm);
94  virtual ~PagedWorldSection();
95 
96  PageManager* getManager() const;
97 
99  virtual const String& getName() const { return mName; }
101  virtual PageStrategy* getStrategy() const { return mStrategy; }
107  virtual void setStrategy(PageStrategy* strat);
113  virtual void setStrategy(const String& stratName);
114 
120  virtual void setSceneManager(SceneManager* sm);
121 
128  virtual void setSceneManager(const String& smName);
130  virtual SceneManager* getSceneManager() const { return mSceneMgr; }
131 
133  virtual PagedWorld* getWorld() const { return mParent; }
135  virtual PageStrategyData* getStrategyData() const { return mStrategyData; }
137  virtual void setBoundingBox(const AxisAlignedBox& box);
139  virtual const AxisAlignedBox& getBoundingBox() const;
140 
141 
143  virtual bool load(StreamSerialiser& stream);
145  virtual void save(StreamSerialiser& stream);
146 
147 
149  virtual void frameStart(Real timeSinceLastFrame);
151  virtual void frameEnd(Real timeElapsed);
153  virtual void notifyCamera(Camera* cam);
154 
162  virtual Page* loadOrCreatePage(const Vector3& worldPos);
163 
165  virtual PageID getPageID(const Vector3& worldPos);
166 
167 
178  virtual void loadPage(PageID pageID, bool forceSynchronous = false);
179 
187  virtual void unloadPage(PageID pageID, bool forceSynchronous = false);
195  virtual void unloadPage(Page* p, bool forceSynchronous = false);
203  virtual bool _prepareProceduralPage(Page* page);
211  virtual bool _loadProceduralPage(Page* page);
219  virtual bool _unloadProceduralPage(Page* page);
227  virtual bool _unprepareProceduralPage(Page* page);
228 
242  virtual void holdPage(PageID pageID);
243 
249  virtual Page* getPage(PageID pageID);
250 
255  virtual void removeAllPages();
256 
268  virtual void setPageProvider(PageProvider* provider) { mPageProvider = provider; }
269 
271  virtual PageProvider* getPageProvider() const { return mPageProvider; }
272 
279  virtual StreamSerialiser* _readPageStream(PageID pageID);
280 
287  virtual StreamSerialiser* _writePageStream(PageID pageID);
288 
291  _OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorldSection& p );
292 
294  virtual const String& getType();
295 
296  };
297 
298 
302  {
303  public:
305  virtual const String& getName() const = 0;
306  virtual PagedWorldSection* createInstance(const String& name, PagedWorld* parent, SceneManager* sm) = 0;
307  virtual void destroyInstance(PagedWorldSection*) = 0;
308 
309 
310  };
311 
314 }
315 
316 #endif
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::map
Definition: OgrePrerequisites.h:533
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
OgrePagingPrerequisites.h
Ogre::PagedWorldSectionFactory::~PagedWorldSectionFactory
virtual ~PagedWorldSectionFactory()
Definition: OgrePagedWorldSection.h:304
Ogre::PagedWorldSection::loadSubtypeData
virtual void loadSubtypeData(StreamSerialiser &ser)
Load data specific to a subtype of this class (if any)
Definition: OgrePagedWorldSection.h:84
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::PageManager
The PageManager is the entry point through which you load all PagedWorld instances,...
Definition: OgrePageManager.h:136
Ogre::PagedWorldSection::PageMap
map< PageID, Page * >::type PageMap
Definition: OgrePagedWorldSection.h:72
Ogre::PagedWorldSection::mParent
PagedWorld * mParent
Definition: OgrePagedWorldSection.h:76
Ogre::PageStrategyData
Abstract marker class representing the data held against the PagedWorldSection which is specifically ...
Definition: OgrePageStrategy.h:49
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::PagedWorldSection::mStrategy
PageStrategy * mStrategy
Definition: OgrePagedWorldSection.h:77
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
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::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::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::PagedWorldSection::getSceneManager
virtual SceneManager * getSceneManager() const
Get the current SceneManager.
Definition: OgrePagedWorldSection.h:130
Ogre::PageStrategy
Defines the interface to a strategy class which is responsible for deciding when Page instances are r...
Definition: OgrePageStrategy.h:73
Ogre::PagedWorldSection::getStrategy
virtual PageStrategy * getStrategy() const
Get the page strategy which this section is using.
Definition: OgrePagedWorldSection.h:101
Ogre::operator<<
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
Ogre::PagedWorldSection::getWorld
virtual PagedWorld * getWorld() const
Get the parent world.
Definition: OgrePagedWorldSection.h:133
Ogre::SceneManager
Manages the organisation and rendering of a 'scene' i.e.
Definition: OgreSceneManager.h:143
Ogre::PagedWorld
This class represents a collection of pages which make up a world.
Definition: OgrePagedWorld.h:57
Ogre::PagedWorldSectionFactory
A factory class for creating types of world section.
Definition: OgrePagedWorldSection.h:301
Ogre::Page
Page class.
Definition: OgrePage.h:49
Ogre::AxisAlignedBox
A 3D box aligned with the x/y/z axes.
Definition: OgreAxisAlignedBox.h:54
Ogre::PagedWorldSection::mSceneMgr
SceneManager * mSceneMgr
Definition: OgrePagedWorldSection.h:81
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::mStrategyData
PageStrategyData * mStrategyData
Definition: OgrePagedWorldSection.h:78
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream.
Definition: OgreStreamSerialiser.h:66
Ogre::PagedWorldSection::CHUNK_ID
static const uint32 CHUNK_ID
Definition: OgrePagedWorldSection.h:89
Ogre::PagedWorldSection::saveSubtypeData
virtual void saveSubtypeData(StreamSerialiser &ser)
Definition: OgrePagedWorldSection.h:85
Ogre::PagedWorldSection::getPageProvider
virtual PageProvider * getPageProvider() const
Get the PageProvider which can provide streams for Pages in this section.
Definition: OgrePagedWorldSection.h:271
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::PagedWorldSection::getName
virtual const String & getName() const
Get the name of this section.
Definition: OgrePagedWorldSection.h:99
OgreAxisAlignedBox.h
Ogre::PagedWorldSection::mAABB
AxisAlignedBox mAABB
Definition: OgrePagedWorldSection.h:75
Ogre::PagedWorldSection::mPages
PageMap mPages
Definition: OgrePagedWorldSection.h:79
Ogre::PagedWorldSection::mName
String mName
Definition: OgrePagedWorldSection.h:74
Ogre::PagedWorldSection::mPageProvider
PageProvider * mPageProvider
Definition: OgrePagedWorldSection.h:80
Ogre::PagedWorldSection::CHUNK_VERSION
static const uint16 CHUNK_VERSION
Definition: OgrePagedWorldSection.h:90
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
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72

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