Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OgreMaterialManager.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-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 #if OGRE_THREAD_SUPPORT
00041 // boost::thread_specific_ptr has 'new' in header but delete in lib
00042 // so if we use our memory manager it reports leaks incorrectly
00043 #   include "OgreNoMemoryMacros.h"
00044 #   include <boost/thread/tss.hpp>
00045 #   include "OgreMemoryMacros.h"
00046 #endif
00047 
00048 namespace Ogre {
00049 
00050 
00066     class _OgreExport MaterialManager : public ResourceManager, public Singleton<MaterialManager>
00067     {
00068     protected:
00069 
00071         FilterOptions mDefaultMinFilter;
00073         FilterOptions mDefaultMagFilter;
00075         FilterOptions mDefaultMipFilter;
00077         unsigned int mDefaultMaxAniso;
00079         OGRE_THREAD_POINTER(MaterialScriptCompiler, mScriptCompiler);
00081         OGRE_THREAD_POINTER(MaterialSerializer, mSerializer);
00083         MaterialPtr mDefaultSettings;
00085         Resource* createImpl(const String& name, ResourceHandle handle, 
00086             const String& group, bool isManual, ManualResourceLoader* loader,
00087             const NameValuePairList* params);
00088 
00090         typedef std::map<String, unsigned short> SchemeMap;
00092         SchemeMap mSchemes;
00094         String mActiveSchemeName;
00096         unsigned short mActiveSchemeIndex;
00097 
00098     public:
00100         static String DEFAULT_SCHEME_NAME;
00101         
00104         MaterialManager();
00105 
00108         virtual ~MaterialManager();
00109 
00112         void initialise(void);
00113         
00116         void parseScript(DataStreamPtr& stream, const String& groupName);
00117 
00118 
00125         virtual void setDefaultTextureFiltering(TextureFilterOptions fo);
00130         virtual void setDefaultTextureFiltering(FilterType ftype, FilterOptions opts);
00135         virtual void setDefaultTextureFiltering(FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter);
00136 
00138         virtual FilterOptions getDefaultTextureFiltering(FilterType ftype) const;
00139 
00146         void setDefaultAnisotropy(unsigned int maxAniso);
00148         unsigned int getDefaultAnisotropy() const;
00149 
00180         virtual MaterialPtr getDefaultSettings(void) const { return mDefaultSettings; }
00181 
00185         virtual unsigned short _getSchemeIndex(const String& name);
00189         virtual const String& _getSchemeName(unsigned short index);
00193         virtual unsigned short _getActiveSchemeIndex(void) const;
00194 
00198         virtual const String& getActiveScheme(void) const;
00199         
00203         virtual void setActiveScheme(const String& schemeName);
00204 
00220         static MaterialManager& getSingleton(void);
00236         static MaterialManager* getSingletonPtr(void);
00237 
00238     };
00239 
00240 }
00241 
00242 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Aug 20 13:50:46 2007