OgrePagedWorld.h

Go to the documentation of this file.
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_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 
00037 namespace Ogre
00038 {
00039     class PageManager;
00040 
00056     class _OgrePagingExport PagedWorld : public PageAlloc
00057     {
00058     protected:
00059         String mName;
00060         PageManager* mManager;
00061         PageProvider* mPageProvider;
00062 
00063     public:
00064         static const uint32 CHUNK_ID;
00065         static const uint16 CHUNK_VERSION;
00066         static const uint32 CHUNK_SECTIONDECLARATION_ID;
00074         PagedWorld(const String& name, PageManager* manager);
00075         virtual ~PagedWorld();
00076 
00077         const String& getName() const { return mName; }
00079         PageManager* getManager() const { return mManager; }
00080 
00082         void load(const String& filename);
00084         void load(const DataStreamPtr& stream);
00086         bool load(StreamSerialiser& stream);
00091         void save(const String& filename);
00093         void save(const DataStreamPtr& stream);
00095         void save(StreamSerialiser& stream);
00096 
00111         PagedWorldSection* createSection(SceneManager* sceneMgr,
00112             const String& typeName,
00113             const String& sectionName = StringUtil::BLANK);
00114 
00115 
00129         PagedWorldSection* createSection(const String& strategyName, SceneManager* sceneMgr,
00130             const String& sectionName = StringUtil::BLANK);
00131 
00132 
00145         PagedWorldSection* createSection(PageStrategy* strategy, SceneManager* sceneMgr, 
00146             const String& sectionName = StringUtil::BLANK);
00148         void destroySection(const String& name);
00150         void destroySection(PagedWorldSection* sec);
00152         void destroyAllSections();
00153 
00155         size_t getSectionCount() const { return mSections.size(); }
00156 
00158         PagedWorldSection* getSection(const String& name);
00159 
00160         typedef map<String, PagedWorldSection*>::type SectionMap;
00162         const SectionMap& getSections() const { return mSections; }
00163 
00175         void setPageProvider(PageProvider* provider) { mPageProvider = provider; }
00176         
00178         PageProvider* getPageProvider() const { return mPageProvider; }
00179 
00187         virtual bool _prepareProceduralPage(Page* page, PagedWorldSection* section);
00195         virtual bool _loadProceduralPage(Page* page, PagedWorldSection* section);
00203         virtual bool _unloadProceduralPage(Page* page, PagedWorldSection* section);
00211         virtual bool _unprepareProceduralPage(Page* page, PagedWorldSection* section);
00219         StreamSerialiser* _readPageStream(PageID pageID, PagedWorldSection* section);
00220 
00228         StreamSerialiser* _writePageStream(PageID pageID, PagedWorldSection* section);
00229 
00231         virtual void frameStart(Real timeSinceLastFrame);
00233         virtual void frameEnd(Real timeElapsed);
00235         virtual void notifyCamera(Camera* cam);
00236 
00239         _OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorld& p );
00240 
00241 
00242     protected:
00243         SectionMap mSections;
00244         NameGenerator mSectionNameGenerator;
00245     };
00246     
00250 }
00251 
00252 #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 Fri May 25 23:36:25 2012