[1] | 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-2006 Torus Knot Software Ltd |
---|
| 8 | Also see acknowledgements in Readme.html |
---|
| 9 | |
---|
| 10 | This program is free software; you can redistribute it and/or modify it under |
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
| 13 | version. |
---|
| 14 | |
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
| 23 | |
---|
| 24 | You may alternatively use this source under the terms of a specific version of |
---|
| 25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
| 26 | Torus Knot Software Ltd. |
---|
| 27 | ----------------------------------------------------------------------------- |
---|
| 28 | */ |
---|
| 29 | #ifndef _BspLevelManager_H__ |
---|
| 30 | #define _BspLevelManager_H__ |
---|
| 31 | |
---|
| 32 | #include "OgreBspPrerequisites.h" |
---|
| 33 | #include "OgreResourceManager.h" |
---|
| 34 | #include "OgreSingleton.h" |
---|
| 35 | |
---|
| 36 | namespace Ogre { |
---|
| 37 | |
---|
| 38 | /** Manages the locating and loading of BSP-based indoor levels. |
---|
| 39 | Like other ResourceManager specialisations it manages the location and loading |
---|
| 40 | of a specific type of resource, in this case files containing Binary |
---|
| 41 | Space Partition (BSP) based level files e.g. Quake3 levels.</p> |
---|
| 42 | However, note that unlike other ResourceManager implementations, |
---|
| 43 | only 1 BspLevel resource is allowed to be loaded at one time. Loading |
---|
| 44 | another automatically unloads the currently loaded level if any. |
---|
| 45 | */ |
---|
| 46 | class BspResourceManager : public ResourceManager, public Singleton<BspResourceManager> |
---|
| 47 | { |
---|
| 48 | public: |
---|
| 49 | BspResourceManager(); |
---|
| 50 | ~BspResourceManager(); |
---|
| 51 | |
---|
| 52 | /** Loads a BSP-based level from the named file. |
---|
| 53 | Currently only supports loading of Quake3 .bsp files. |
---|
| 54 | */ |
---|
| 55 | ResourcePtr load(const String& name, |
---|
| 56 | const String& group, bool isManual = false, |
---|
| 57 | ManualResourceLoader* loader = 0, const NameValuePairList* loadParams = 0); |
---|
| 58 | |
---|
| 59 | /** Loads a BSP-based level from a stream. |
---|
| 60 | Currently only supports loading of Quake3 .bsp files. |
---|
| 61 | */ |
---|
| 62 | ResourcePtr load(DataStreamPtr& stream, const String& group); |
---|
| 63 | |
---|
| 64 | /** Override standard Singleton retrieval. |
---|
| 65 | @remarks |
---|
| 66 | Why do we do this? Well, it's because the Singleton |
---|
| 67 | implementation is in a .h file, which means it gets compiled |
---|
| 68 | into anybody who includes it. This is needed for the |
---|
| 69 | Singleton template to work, but we actually only want it |
---|
| 70 | compiled into the implementation of the class based on the |
---|
| 71 | Singleton, not all of them. If we don't change this, we get |
---|
| 72 | link errors when trying to use the Singleton-based class from |
---|
| 73 | an outside dll. |
---|
| 74 | @par |
---|
| 75 | This method just delegates to the template version anyway, |
---|
| 76 | but the implementation stays in this single compilation unit, |
---|
| 77 | preventing link errors. |
---|
| 78 | */ |
---|
| 79 | static BspResourceManager& getSingleton(void); |
---|
| 80 | /** Override standard Singleton retrieval. |
---|
| 81 | @remarks |
---|
| 82 | Why do we do this? Well, it's because the Singleton |
---|
| 83 | implementation is in a .h file, which means it gets compiled |
---|
| 84 | into anybody who includes it. This is needed for the |
---|
| 85 | Singleton template to work, but we actually only want it |
---|
| 86 | compiled into the implementation of the class based on the |
---|
| 87 | Singleton, not all of them. If we don't change this, we get |
---|
| 88 | link errors when trying to use the Singleton-based class from |
---|
| 89 | an outside dll. |
---|
| 90 | @par |
---|
| 91 | This method just delegates to the template version anyway, |
---|
| 92 | but the implementation stays in this single compilation unit, |
---|
| 93 | preventing link errors. |
---|
| 94 | */ |
---|
| 95 | static BspResourceManager* getSingletonPtr(void); |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | protected: |
---|
| 99 | /** @copydoc ResourceManager::createImpl. */ |
---|
| 100 | Resource* createImpl(const String& name, ResourceHandle handle, |
---|
| 101 | const String& group, bool isManual, ManualResourceLoader* loader, |
---|
| 102 | const NameValuePairList* createParams); |
---|
| 103 | |
---|
| 104 | // Singleton managed by this class |
---|
| 105 | Quake3ShaderManager *mShaderMgr; |
---|
| 106 | |
---|
| 107 | }; |
---|
| 108 | |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | #endif |
---|