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-2006 Torus Knot Software Ltd 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 You may alternatively use this source under the terms of a specific version of 00025 the OGRE Unrestricted License provided you have obtained such a license from 00026 Torus Knot Software Ltd. 00027 ----------------------------------------------------------------------------- 00028 */ 00029 #ifndef __MATERIALMANAGER_H__ 00030 #define __MATERIALMANAGER_H__ 00031 00032 #include "OgrePrerequisites.h" 00033 00034 #include "OgreSingleton.h" 00035 #include "OgreResourceManager.h" 00036 #include "OgreMaterial.h" 00037 #include "OgreStringVector.h" 00038 #include "OgreMaterialSerializer.h" 00039 00040 namespace Ogre { 00041 00042 00058 class _OgreExport MaterialManager : public ResourceManager, public Singleton<MaterialManager> 00059 { 00060 public: 00064 class Listener 00065 { 00066 public: 00068 virtual ~Listener() { } 00098 virtual Technique* handleSchemeNotFound(unsigned short schemeIndex, 00099 const String& schemeName, Material* originalMaterial, unsigned short lodIndex, 00100 const Renderable* rend) = 0; 00101 00102 }; 00103 00104 protected: 00105 00107 FilterOptions mDefaultMinFilter; 00109 FilterOptions mDefaultMagFilter; 00111 FilterOptions mDefaultMipFilter; 00113 unsigned int mDefaultMaxAniso; 00115 OGRE_THREAD_POINTER(MaterialSerializer, mSerializer); 00117 MaterialPtr mDefaultSettings; 00119 Resource* createImpl(const String& name, ResourceHandle handle, 00120 const String& group, bool isManual, ManualResourceLoader* loader, 00121 const NameValuePairList* params); 00122 00124 typedef std::map<String, unsigned short> SchemeMap; 00126 SchemeMap mSchemes; 00128 String mActiveSchemeName; 00130 unsigned short mActiveSchemeIndex; 00131 00132 typedef std::list<Listener*> ListenerList; 00133 ListenerList mListenerList; 00134 00135 public: 00137 static String DEFAULT_SCHEME_NAME; 00138 00141 MaterialManager(); 00142 00145 virtual ~MaterialManager(); 00146 00149 void initialise(void); 00150 00153 void parseScript(DataStreamPtr& stream, const String& groupName); 00154 00155 00162 virtual void setDefaultTextureFiltering(TextureFilterOptions fo); 00167 virtual void setDefaultTextureFiltering(FilterType ftype, FilterOptions opts); 00172 virtual void setDefaultTextureFiltering(FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter); 00173 00175 virtual FilterOptions getDefaultTextureFiltering(FilterType ftype) const; 00176 00183 void setDefaultAnisotropy(unsigned int maxAniso); 00185 unsigned int getDefaultAnisotropy() const; 00186 00217 virtual MaterialPtr getDefaultSettings(void) const { return mDefaultSettings; } 00218 00222 virtual unsigned short _getSchemeIndex(const String& name); 00226 virtual const String& _getSchemeName(unsigned short index); 00230 virtual unsigned short _getActiveSchemeIndex(void) const; 00231 00235 virtual const String& getActiveScheme(void) const; 00236 00240 virtual void setActiveScheme(const String& schemeName); 00241 00243 virtual void addListener(Listener* l); 00245 virtual void removeListener(Listener* l); 00246 00248 virtual Technique* _arbitrateMissingTechniqueForActiveScheme( 00249 Material* mat, unsigned short lodIndex, const Renderable* rend); 00250 00266 static MaterialManager& getSingleton(void); 00282 static MaterialManager* getSingletonPtr(void); 00283 00284 }; 00285 00286 } 00287 00288 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:23 2009