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

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Oct 16 2013 14:35:43