[148] | 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-2013 Torus Knot Software Ltd |
---|
| 8 | |
---|
| 9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
| 10 | of this software and associated documentation files (the "Software"), to deal |
---|
| 11 | in the Software without restriction, including without limitation the rights |
---|
| 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
| 13 | copies of the Software, and to permit persons to whom the Software is |
---|
| 14 | furnished to do so, subject to the following conditions: |
---|
| 15 | |
---|
| 16 | The above copyright notice and this permission notice shall be included in |
---|
| 17 | all copies or substantial portions of the Software. |
---|
| 18 | |
---|
| 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
| 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
| 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
| 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
| 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
| 25 | THE SOFTWARE. |
---|
| 26 | ----------------------------------------------------------------------------- |
---|
| 27 | */ |
---|
| 28 | #ifndef __RENDERSYSTEMCAPABILITIESMANAGER_H__ |
---|
| 29 | #define __RENDERSYSTEMCAPABILITIESMANAGER_H__ |
---|
| 30 | |
---|
| 31 | #include "OgrePrerequisites.h" |
---|
| 32 | #include "OgreSingleton.h" |
---|
| 33 | #include "OgreStringVector.h" |
---|
| 34 | |
---|
| 35 | #include "OgreRenderSystemCapabilities.h" |
---|
| 36 | #include "OgreHeaderPrefix.h" |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | namespace Ogre { |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | /** \addtogroup Core |
---|
| 43 | * @{ |
---|
| 44 | */ |
---|
| 45 | /** \addtogroup RenderSystem |
---|
| 46 | * @{ |
---|
| 47 | */ |
---|
| 48 | /** Class for managing RenderSystemCapabilities database for Ogre. |
---|
| 49 | @remarks This class behaves similarly to other ResourceManager, although .rendercaps are not resources. |
---|
| 50 | It contains and abstract a .rendercaps Serializer |
---|
| 51 | */ |
---|
| 52 | class _OgreExport RenderSystemCapabilitiesManager : public Singleton<RenderSystemCapabilitiesManager>, public RenderSysAlloc |
---|
| 53 | { |
---|
| 54 | |
---|
| 55 | public: |
---|
| 56 | |
---|
| 57 | /** Default constructor. |
---|
| 58 | */ |
---|
| 59 | RenderSystemCapabilitiesManager(); |
---|
| 60 | |
---|
| 61 | /** Default destructor. |
---|
| 62 | */ |
---|
| 63 | virtual ~RenderSystemCapabilitiesManager(); |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | /** @see ScriptLoader::parseScript |
---|
| 67 | */ |
---|
| 68 | void parseCapabilitiesFromArchive(const String& filename, const String& archiveType, bool recursive = true); |
---|
| 69 | |
---|
| 70 | /** Returns a capability loaded with RenderSystemCapabilitiesManager::parseCapabilitiesFromArchive method |
---|
| 71 | * @return NULL if the name is invalid, a parsed RenderSystemCapabilities otherwise. |
---|
| 72 | */ |
---|
| 73 | RenderSystemCapabilities* loadParsedCapabilities(const String& name); |
---|
| 74 | |
---|
| 75 | /** Access to the internal map of loaded capabilities */ |
---|
| 76 | const map<String, RenderSystemCapabilities*>::type &getCapabilities() const; |
---|
| 77 | |
---|
| 78 | /** Method used by RenderSystemCapabilitiesSerializer::parseScript */ |
---|
| 79 | void _addRenderSystemCapabilities(const String& name, RenderSystemCapabilities* caps); |
---|
| 80 | |
---|
| 81 | /** Override standard Singleton retrieval. |
---|
| 82 | @remarks |
---|
| 83 | Why do we do this? Well, it's because the Singleton |
---|
| 84 | implementation is in a .h file, which means it gets compiled |
---|
| 85 | into anybody who includes it. This is needed for the |
---|
| 86 | Singleton template to work, but we actually only want it |
---|
| 87 | compiled into the implementation of the class based on the |
---|
| 88 | Singleton, not all of them. If we don't change this, we get |
---|
| 89 | link errors when trying to use the Singleton-based class from |
---|
| 90 | an outside dll. |
---|
| 91 | @par |
---|
| 92 | This method just delegates to the template version anyway, |
---|
| 93 | but the implementation stays in this single compilation unit, |
---|
| 94 | preventing link errors. |
---|
| 95 | */ |
---|
| 96 | static RenderSystemCapabilitiesManager& getSingleton(void); |
---|
| 97 | /** Override standard Singleton retrieval. |
---|
| 98 | @remarks |
---|
| 99 | Why do we do this? Well, it's because the Singleton |
---|
| 100 | implementation is in a .h file, which means it gets compiled |
---|
| 101 | into anybody who includes it. This is needed for the |
---|
| 102 | Singleton template to work, but we actually only want it |
---|
| 103 | compiled into the implementation of the class based on the |
---|
| 104 | Singleton, not all of them. If we don't change this, we get |
---|
| 105 | link errors when trying to use the Singleton-based class from |
---|
| 106 | an outside dll. |
---|
| 107 | @par |
---|
| 108 | This method just delegates to the template version anyway, |
---|
| 109 | but the implementation stays in this single compilation unit, |
---|
| 110 | preventing link errors. |
---|
| 111 | */ |
---|
| 112 | static RenderSystemCapabilitiesManager* getSingletonPtr(void); |
---|
| 113 | |
---|
| 114 | protected: |
---|
| 115 | |
---|
| 116 | RenderSystemCapabilitiesSerializer* mSerializer; |
---|
| 117 | |
---|
| 118 | typedef map<String, RenderSystemCapabilities*>::type CapabilitiesMap; |
---|
| 119 | CapabilitiesMap mCapabilitiesMap; |
---|
| 120 | |
---|
| 121 | const String mScriptPattern; |
---|
| 122 | |
---|
| 123 | }; |
---|
| 124 | |
---|
| 125 | /** @} */ |
---|
| 126 | /** @} */ |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | #include "OgreHeaderSuffix.h" |
---|
| 130 | |
---|
| 131 | #endif |
---|