OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2014 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
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
virtual void saveSubtypeData(StreamSerialiser &ser)
float Real
Software floating point type.
virtual const String & getName() const
Get the name of this section.
unsigned int uint32
Definition: OgrePlatform.h:344
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.
virtual PageProvider * getPageProvider() const
Get the PageProvider which can provide streams for Pages in this section.
Manages the organisation and rendering of a 'scene' i.e.
This class represents a collection of pages which make up a world.
A 3D box aligned with the x/y/z axes.
virtual PageStrategy * getStrategy() const
Get the page strategy which this section is using.
virtual PagedWorld * getWorld() const
Get the parent world.
static const uint32 CHUNK_ID
PageStrategyData * mStrategyData
map< PageID, Page * >::type PageMap
A factory class for creating types of world section.
virtual void loadSubtypeData(StreamSerialiser &ser)
Load data specific to a subtype of this class (if any)
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
#define _OgrePagingExport
Utility class providing helper methods for reading / writing structured data held in a DataStream...
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
Page class.
Definition: OgrePage.h:49
virtual SceneManager * getSceneManager() const
Get the current SceneManager.
Abstract marker class representing the data held against the PagedWorldSection which is specifically ...
virtual void setPageProvider(PageProvider *provider)
Set the PageProvider which can provide streams Pages in this section.
_StringBase String
unsigned short uint16
Definition: OgrePlatform.h:345
Abstract class that can be implemented by the user application to provide a way to retrieve or genera...
virtual PageStrategyData * getStrategyData() const
Get the data required by the PageStrategy which is specific to this world section.
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
Defines the interface to a strategy class which is responsible for deciding when Page instances are r...
static const uint16 CHUNK_VERSION
uint32 PageID
Identifier for a page.