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-2013 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_PagedWorld_H__ 00030 #define __Ogre_PagedWorld_H__ 00031 00032 #include "OgrePagingPrerequisites.h" 00033 #include "OgreString.h" 00034 #include "OgreDataStream.h" 00035 #include "OgreCommon.h" 00036 #include "OgreNameGenerator.h" 00037 00038 namespace Ogre 00039 { 00040 class PageManager; 00041 00057 class _OgrePagingExport PagedWorld : public PageAlloc 00058 { 00059 protected: 00060 String mName; 00061 PageManager* mManager; 00062 PageProvider* mPageProvider; 00063 00064 public: 00065 static const uint32 CHUNK_ID; 00066 static const uint16 CHUNK_VERSION; 00067 static const uint32 CHUNK_SECTIONDECLARATION_ID; 00075 PagedWorld(const String& name, PageManager* manager); 00076 virtual ~PagedWorld(); 00077 00078 const String& getName() const { return mName; } 00080 PageManager* getManager() const { return mManager; } 00081 00083 void load(const String& filename); 00085 void load(const DataStreamPtr& stream); 00087 bool load(StreamSerialiser& stream); 00092 void save(const String& filename); 00094 void save(const DataStreamPtr& stream); 00096 void save(StreamSerialiser& stream); 00097 00112 PagedWorldSection* createSection(SceneManager* sceneMgr, 00113 const String& typeName, 00114 const String& sectionName = StringUtil::BLANK); 00115 00116 00130 PagedWorldSection* createSection(const String& strategyName, SceneManager* sceneMgr, 00131 const String& sectionName = StringUtil::BLANK); 00132 00133 00146 PagedWorldSection* createSection(PageStrategy* strategy, SceneManager* sceneMgr, 00147 const String& sectionName = StringUtil::BLANK); 00149 void destroySection(const String& name); 00151 void destroySection(PagedWorldSection* sec); 00153 void destroyAllSections(); 00154 00156 size_t getSectionCount() const { return mSections.size(); } 00157 00159 PagedWorldSection* getSection(const String& name); 00160 00161 typedef map<String, PagedWorldSection*>::type SectionMap; 00163 const SectionMap& getSections() const { return mSections; } 00164 00176 void setPageProvider(PageProvider* provider) { mPageProvider = provider; } 00177 00179 PageProvider* getPageProvider() const { return mPageProvider; } 00180 00188 virtual bool _prepareProceduralPage(Page* page, PagedWorldSection* section); 00196 virtual bool _loadProceduralPage(Page* page, PagedWorldSection* section); 00204 virtual bool _unloadProceduralPage(Page* page, PagedWorldSection* section); 00212 virtual bool _unprepareProceduralPage(Page* page, PagedWorldSection* section); 00220 StreamSerialiser* _readPageStream(PageID pageID, PagedWorldSection* section); 00221 00229 StreamSerialiser* _writePageStream(PageID pageID, PagedWorldSection* section); 00230 00232 virtual void frameStart(Real timeSinceLastFrame); 00234 virtual void frameEnd(Real timeElapsed); 00236 virtual void notifyCamera(Camera* cam); 00237 00240 _OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorld& p ); 00241 00242 00243 protected: 00244 SectionMap mSections; 00245 NameGenerator mSectionNameGenerator; 00246 }; 00247 00251 } 00252 00253 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:44