00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2012 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 00029 #ifndef __Ogre_PagedWorldSection_H__ 00030 #define __Ogre_PagedWorldSection_H__ 00031 00032 #include "OgrePagingPrerequisites.h" 00033 #include "OgreAxisAlignedBox.h" 00034 00035 namespace Ogre 00036 { 00069 class _OgrePagingExport PagedWorldSection : public PageAlloc 00070 { 00071 public: 00072 typedef map<PageID, Page*>::type PageMap; 00073 protected: 00074 String mName; 00075 AxisAlignedBox mAABB; 00076 PagedWorld* mParent; 00077 PageStrategy* mStrategy; 00078 PageStrategyData* mStrategyData; 00079 PageMap mPages; 00080 PageProvider* mPageProvider; 00081 SceneManager* mSceneMgr; 00082 00084 virtual void loadSubtypeData(StreamSerialiser& ser) {} 00085 virtual void saveSubtypeData(StreamSerialiser& ser) {} 00086 00087 00088 public: 00089 static const uint32 CHUNK_ID; 00090 static const uint16 CHUNK_VERSION; 00091 00093 PagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm); 00094 virtual ~PagedWorldSection(); 00095 00096 PageManager* getManager() const; 00097 00099 virtual const String& getName() const { return mName; } 00101 virtual PageStrategy* getStrategy() const { return mStrategy; } 00107 virtual void setStrategy(PageStrategy* strat); 00113 virtual void setStrategy(const String& stratName); 00114 00120 virtual void setSceneManager(SceneManager* sm); 00121 00128 virtual void setSceneManager(const String& smName); 00130 virtual SceneManager* getSceneManager() const { return mSceneMgr; } 00131 00133 virtual PagedWorld* getWorld() const { return mParent; } 00135 virtual PageStrategyData* getStrategyData() const { return mStrategyData; } 00137 virtual void setBoundingBox(const AxisAlignedBox& box); 00139 virtual const AxisAlignedBox& getBoundingBox() const; 00140 00141 00143 virtual bool load(StreamSerialiser& stream); 00145 virtual void save(StreamSerialiser& stream); 00146 00147 00149 virtual void frameStart(Real timeSinceLastFrame); 00151 virtual void frameEnd(Real timeElapsed); 00153 virtual void notifyCamera(Camera* cam); 00154 00162 virtual Page* loadOrCreatePage(const Vector3& worldPos); 00163 00165 virtual PageID getPageID(const Vector3& worldPos); 00166 00167 00178 virtual void loadPage(PageID pageID, bool forceSynchronous = false); 00179 00187 virtual void unloadPage(PageID pageID, bool forceSynchronous = false); 00195 virtual void unloadPage(Page* p, bool forceSynchronous = false); 00203 virtual bool _prepareProceduralPage(Page* page); 00211 virtual bool _loadProceduralPage(Page* page); 00219 virtual bool _unloadProceduralPage(Page* page); 00227 virtual bool _unprepareProceduralPage(Page* page); 00228 00242 virtual void holdPage(PageID pageID); 00243 00249 virtual Page* getPage(PageID pageID); 00250 00255 virtual void removeAllPages(); 00256 00268 virtual void setPageProvider(PageProvider* provider) { mPageProvider = provider; } 00269 00271 virtual PageProvider* getPageProvider() const { return mPageProvider; } 00272 00279 virtual StreamSerialiser* _readPageStream(PageID pageID); 00280 00287 virtual StreamSerialiser* _writePageStream(PageID pageID); 00288 00291 _OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorldSection& p ); 00292 00294 virtual const String& getType(); 00295 00296 }; 00297 00298 00301 class _OgrePagingExport PagedWorldSectionFactory : public PageAlloc 00302 { 00303 public: 00304 virtual ~PagedWorldSectionFactory() {} 00305 virtual const String& getName() const = 0; 00306 virtual PagedWorldSection* createInstance(const String& name, PagedWorld* parent, SceneManager* sm) = 0; 00307 virtual void destroyInstance(PagedWorldSection*) = 0; 00308 00309 00310 }; 00311 00314 } 00315 00316 #endif
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:25 2012