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-2005 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef __TerrainPageSource_H__ 00027 #define __TerrainPageSource_H__ 00028 00029 #include "OgreTerrainPrerequisites.h" 00030 #include "OgreSingleton.h" 00031 00032 namespace Ogre { 00033 00034 typedef std::pair<String, String> TerrainPageSourceOption; 00035 typedef std::vector<TerrainPageSourceOption> TerrainPageSourceOptionList; 00036 00040 class _OgreTerrainExport TerrainPageSourceListener 00041 { 00042 public: 00050 virtual void pageConstructed(TerrainSceneManager* manager, size_t pagex, size_t pagez, Real* heightData) = 0; 00051 }; 00052 00056 class _OgreTerrainExport TerrainPageSourceListenerManager : 00057 public Singleton<TerrainPageSourceListenerManager> 00058 { 00059 protected: 00060 typedef std::vector<TerrainPageSourceListener*> PageSourceListenerList; 00061 PageSourceListenerList mPageSourceListeners; 00062 public: 00063 TerrainPageSourceListenerManager() {} 00064 ~TerrainPageSourceListenerManager() {} 00065 00072 void addListener(TerrainPageSourceListener* pl); 00076 void removeListener(TerrainPageSourceListener* pl); 00077 00079 void firePageConstructed(TerrainSceneManager* manager, size_t pagex, size_t pagez, Real* heightData); 00080 00083 static TerrainPageSourceListenerManager& getSingleton(void); 00086 static TerrainPageSourceListenerManager* getSingletonPtr(void); 00087 00088 }; 00089 00090 00132 class _OgreTerrainExport TerrainPageSource 00133 { 00134 protected: 00136 TerrainSceneManager* mSceneManager; 00138 bool mAsyncLoading; 00140 unsigned short mPageSize; 00142 unsigned short mTileSize; 00143 00145 void firePageConstructed(size_t pagex, size_t pagez, Real* heightData); 00146 00154 virtual TerrainPage* buildPage(Real* heightData, const MaterialPtr& pMaterial); 00155 00156 00157 public: 00158 TerrainPageSource(); 00159 virtual ~TerrainPageSource() { shutdown(); } 00160 00181 virtual void initialise(TerrainSceneManager* tsm, 00182 ushort tileSize, ushort pageSize, bool asyncLoading, 00183 TerrainPageSourceOptionList& optionList) 00184 { 00185 mSceneManager = tsm; 00186 mTileSize = tileSize; 00187 mPageSize = pageSize; 00188 mAsyncLoading = asyncLoading; 00189 } 00197 virtual void shutdown(void) {} 00198 00220 virtual void requestPage(ushort x, ushort z) = 0; 00236 virtual void expirePage(ushort x, ushort z) = 0; 00237 00244 static void addListener(TerrainPageSourceListener* pl); 00248 static void removeListener(TerrainPageSourceListener* pl); 00249 00250 }; 00251 00252 } 00253 00254 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:50 2006