OgreMaterialManager.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __MATERIALMANAGER_H__
#define __MATERIALMANAGER_H__
#include "OgrePrerequisites.h"
#include "OgreSingleton.h"
#include "OgreResourceManager.h"
#include "OgreMaterial.h"
#include "OgreStringVector.h"
#include "OgreMaterialSerializer.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport MaterialManager : public ResourceManager, public Singleton<MaterialManager>
{
public:
class Listener
{
public:
virtual ~Listener() { }
virtual Technique* handleSchemeNotFound(unsigned short schemeIndex,
const String& schemeName, Material* originalMaterial, unsigned short lodIndex,
const Renderable* rend) = 0;
};
protected:
FilterOptions mDefaultMinFilter;
FilterOptions mDefaultMagFilter;
FilterOptions mDefaultMipFilter;
FilterOptions mDefaultCompare;
bool mDefaultCompareEnabled;
CompareFunction mDefaultCompareFunction;
unsigned int mDefaultMaxAniso;
OGRE_THREAD_POINTER(MaterialSerializer, mSerializer);
MaterialPtr mDefaultSettings;
Resource* createImpl(const String& name, ResourceHandle handle,
const String& group, bool isManual, ManualResourceLoader* loader,
const NameValuePairList* params);
typedef map<String, unsigned short>::type SchemeMap;
SchemeMap mSchemes;
String mActiveSchemeName;
unsigned short mActiveSchemeIndex;
typedef list<Listener*>::type ListenerList;
typedef map<String, ListenerList>::type ListenerMap;
ListenerMap mListenerMap;
public:
static String DEFAULT_SCHEME_NAME;
MaterialPtr create (const String& name, const String& group,
bool isManual = false, ManualResourceLoader* loader = 0,
const NameValuePairList* createParams = 0);
MaterialPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
MaterialManager();
virtual ~MaterialManager();
void initialise(void);
void parseScript(DataStreamPtr& stream, const String& groupName);
virtual void setDefaultTextureFiltering(TextureFilterOptions fo);
virtual void setDefaultTextureFiltering(FilterType ftype, FilterOptions opts);
virtual void setDefaultTextureFiltering(FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter);
virtual FilterOptions getDefaultTextureFiltering(FilterType ftype) const;
void setDefaultAnisotropy(unsigned int maxAniso);
unsigned int getDefaultAnisotropy() const;
virtual MaterialPtr getDefaultSettings(void) const { return mDefaultSettings; }
virtual unsigned short _getSchemeIndex(const String& name);
virtual const String& _getSchemeName(unsigned short index);
virtual unsigned short _getActiveSchemeIndex(void) const;
virtual const String& getActiveScheme(void) const;
virtual void setActiveScheme(const String& schemeName);
virtual void addListener(Listener* l, const Ogre::String& schemeName = StringUtil::BLANK);
virtual void removeListener(Listener* l, const Ogre::String& schemeName = StringUtil::BLANK);
virtual Technique* _arbitrateMissingTechniqueForActiveScheme(
Material* mat, unsigned short lodIndex, const Renderable* rend);
static MaterialManager& getSingleton(void);
static MaterialManager* getSingletonPtr(void);
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::MaterialManager::mActiveSchemeIndex
unsigned short mActiveSchemeIndex
Current material scheme.
Definition: OgreMaterialManager.h:143
Ogre::MaterialManager::mListenerMap
ListenerMap mListenerMap
Definition: OgreMaterialManager.h:148
Ogre::MaterialManager::mDefaultCompareFunction
CompareFunction mDefaultCompareFunction
Definition: OgreMaterialManager.h:122
Ogre::Renderable
Abstract class defining the interface all renderable objects must implement.
Definition: OgreRenderable.h:63
Ogre::MaterialSerializer
Class for serializing Materials to / from a .material script.
Definition: OgreMaterialSerializer.h:106
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::list
Definition: OgrePrerequisites.h:505
Ogre::TextureFilterOptions
TextureFilterOptions
High-level filtering options providing shortcuts to settings the minification, magnification and mip ...
Definition: OgreCommon.h:78
OGRE_THREAD_POINTER
#define OGRE_THREAD_POINTER(T, var)
Definition: OgreThreadDefinesBoost.h:66
Ogre::MaterialManager::DEFAULT_SCHEME_NAME
static String DEFAULT_SCHEME_NAME
Default material scheme.
Definition: OgreMaterialManager.h:152
Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
Definition: OgreResourceGroupManager.h:270
Ogre::Resource
Abstract class representing a loadable resource (e.g.
Definition: OgreResource.h:79
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:514
Ogre::ResourceHandle
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
Ogre::MaterialManager
Class for managing Material settings for Ogre.
Definition: OgreMaterialManager.h:64
Ogre::MaterialManager::mDefaultCompare
FilterOptions mDefaultCompare
Default Texture filtering - comparison.
Definition: OgreMaterialManager.h:119
Ogre::MaterialManager::getDefaultSettings
virtual MaterialPtr getDefaultSettings(void) const
Returns a pointer to the default Material settings.
Definition: OgreMaterialManager.h:242
OgreSingleton.h
OgrePrerequisites.h
Ogre::MaterialManager::Listener
Listener on any general material events.
Definition: OgreMaterialManager.h:70
Ogre::MaterialManager::mActiveSchemeName
String mActiveSchemeName
Current material scheme.
Definition: OgreMaterialManager.h:141
Ogre::NameValuePairList
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
OgreStringVector.h
Ogre::CompareFunction
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
Definition: OgreCommon.h:64
Ogre::MaterialManager::mSchemes
SchemeMap mSchemes
List of material schemes.
Definition: OgreMaterialManager.h:139
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::MaterialManager::Listener::~Listener
virtual ~Listener()
Virtual destructor needed as class has virtual methods.
Definition: OgreMaterialManager.h:74
OgreResourceManager.h
OgreHeaderSuffix.h
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:122
Ogre::MaterialManager::SchemeMap
map< String, unsigned short >::type SchemeMap
Scheme name -> index. Never shrinks! Should be pretty static anyway.
Definition: OgreMaterialManager.h:137
Ogre::MaterialManager::mDefaultCompareEnabled
bool mDefaultCompareEnabled
Definition: OgreMaterialManager.h:121
Ogre::FilterOptions
FilterOptions
Filtering options for textures / mipmaps.
Definition: OgreCommon.h:100
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::Material
Class encapsulates rendering properties of an object.
Definition: OgreMaterial.h:88
Ogre::MaterialManager::mDefaultMinFilter
FilterOptions mDefaultMinFilter
Default Texture filtering - minification.
Definition: OgreMaterialManager.h:113
Ogre::SharedPtr< Material >
Ogre::MaterialManager::mDefaultMagFilter
FilterOptions mDefaultMagFilter
Default Texture filtering - magnification.
Definition: OgreMaterialManager.h:115
OgreHeaderPrefix.h
Ogre::MaterialManager::mDefaultMipFilter
FilterOptions mDefaultMipFilter
Default Texture filtering - mipmapping.
Definition: OgreMaterialManager.h:117
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
Ogre::Technique
Class representing an approach to rendering this particular Material.
Definition: OgreTechnique.h:53
Ogre::MaterialManager::ListenerMap
map< String, ListenerList >::type ListenerMap
Definition: OgreMaterialManager.h:147
OgreMaterialSerializer.h
Ogre::map
Definition: OgrePrerequisites.h:533
Ogre::MaterialManager::mDefaultSettings
MaterialPtr mDefaultSettings
Default settings.
Definition: OgreMaterialManager.h:129
Ogre::MaterialManager::mDefaultMaxAniso
unsigned int mDefaultMaxAniso
Default Texture anisotropy.
Definition: OgreMaterialManager.h:125
OgreMaterial.h
Ogre::StringUtil::BLANK
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
Definition: OgreString.h:196
Ogre::MaterialManager::ListenerList
list< Listener * >::type ListenerList
The list of per-scheme (and general) material listeners.
Definition: OgreMaterialManager.h:146
Ogre::FilterType
FilterType
Definition: OgreCommon.h:90

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.