OgreSceneManagerEnumerator.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-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 #ifndef __SceneManagerEnumerator_H__
00029 #define __SceneManagerEnumerator_H__
00030 
00031 #include "OgrePrerequisites.h"
00032 
00033 #include "OgreSceneManager.h"
00034 #include "OgreSingleton.h"
00035 #include "OgreIteratorWrappers.h"
00036 #include "OgreHeaderPrefix.h"
00037 
00038 namespace Ogre {
00039     
00046 
00047     class _OgreExport DefaultSceneManagerFactory : public SceneManagerFactory
00048     {
00049     protected:
00050         void initMetaData(void) const;
00051     public:
00052         DefaultSceneManagerFactory() {}
00053         ~DefaultSceneManagerFactory() {}
00055         static const String FACTORY_TYPE_NAME;
00056         SceneManager* createInstance(const String& instanceName);
00057         void destroyInstance(SceneManager* instance);
00058     };
00060     class _OgreExport DefaultSceneManager : public SceneManager
00061     {
00062     public:
00063         DefaultSceneManager(const String& name);
00064         ~DefaultSceneManager();
00065         const String& getTypeName(void) const;
00066     };
00067 
00088     class _OgreExport SceneManagerEnumerator : public Singleton<SceneManagerEnumerator>, public SceneMgtAlloc
00089     {
00090     public:
00092         typedef map<String, SceneManager*>::type Instances;
00094         typedef vector<const SceneManagerMetaData*>::type MetaDataList;
00095     private:
00097         typedef list<SceneManagerFactory*>::type Factories;
00098         Factories mFactories;
00099         Instances mInstances;
00101         MetaDataList mMetaDataList;
00103         DefaultSceneManagerFactory mDefaultFactory;
00105         unsigned long mInstanceCreateCount;
00107         RenderSystem* mCurrentRenderSystem;
00108 
00109 
00110     public:
00111         SceneManagerEnumerator();
00112         ~SceneManagerEnumerator();
00113 
00118         void addFactory(SceneManagerFactory* fact);
00119 
00122         void removeFactory(SceneManagerFactory* fact);
00123 
00133         const SceneManagerMetaData* getMetaData(const String& typeName) const;
00134 
00135         typedef ConstVectorIterator<MetaDataList> MetaDataIterator;
00139         MetaDataIterator getMetaDataIterator(void) const;
00140 
00152         SceneManager* createSceneManager(const String& typeName, 
00153             const String& instanceName = StringUtil::BLANK);
00154 
00167         SceneManager* createSceneManager(SceneTypeMask typeMask, 
00168             const String& instanceName = StringUtil::BLANK);
00169 
00171         void destroySceneManager(SceneManager* sm);
00172 
00177         SceneManager* getSceneManager(const String& instanceName) const;
00178 
00182         bool hasSceneManager(const String& instanceName) const;
00183 
00184         typedef MapIterator<Instances> SceneManagerIterator;
00186         SceneManagerIterator getSceneManagerIterator(void);
00187 
00190         void setRenderSystem(RenderSystem* rs);
00191 
00193         void shutdownAll(void);
00209         static SceneManagerEnumerator& getSingleton(void);
00225         static SceneManagerEnumerator* getSingletonPtr(void);
00226 
00227     };
00228 
00232 }
00233 
00234 #include "OgreHeaderSuffix.h"
00235 
00236 #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 Mon Jul 27 2020 13:40:45