Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::Material Class Reference

Class encapsulates rendering properties of an object. More...

#include <OgreMaterial.h>

Inheritance diagram for Ogre::Material:

Inheritance graph
[legend]
Collaboration diagram for Ogre::Material:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< RealLodDistanceList
 distance list used to specify LOD

typedef VectorIterator< TechniquesTechniqueIterator

Public Methods

 Material (const String &name)
 Mandatory constructor - you must supply a name for the material.

 Material ()
 Default constructor - uses a generated material name.

 ~Material ()
Material & operator= (const Material &rhs)
 Assignment operator to allow easy copying between materials.

const StringgetName (void) const
 Gets the material's name (note - not a texture name).

bool isTransparent (void) const
 Determines if the material has any transparency with the rest of the scene (derived from whether any Techniques say they involve transparency).

TechniquecreateTechnique (void)
 Creates a new Technique for this Material.

TechniquegetTechnique (unsigned short index)
 Gets the indexed technique.

void removeTechnique (unsigned short index)
 Removes the technique at the given index.

void removeAllTechniques (void)
 Removes all the techniques in this Material.

TechniqueIterator getTechniqueIterator (void)
 Get an iterator over the Techniques in this Material.

TechniqueIterator getSupportedTechniqueIterator (void)
 Gets an iterator over all the Techniques which are supported by the current card.

unsigned short getNumLodLevels (void) const
 Gets the number of levels-of-detail this material has, based on Technique::setLodIndex.

TechniquegetBestTechnique (unsigned short lodIndex=0)
 Gets the best supported technique.

void load (void)
 Overridden from Resource.

void unload (void)
 Unloads the material, frees resources etc.

Material * clone (const String &newName) const
 Creates a new copy of this material with the same settings but a new name.

void copyDetailsTo (Material *mat) const
 Copies the details of this material into another, preserving the target's handle and name (unlike operator=) but copying everything else.

void compile (bool autoManageTextureUnits=true)
 'Compiles' this Material.

void setAmbient (Real red, Real green, Real blue)
 Sets the ambient colour reflectance properties for every Pass in every Technique.

void setAmbient (const ColourValue &ambient)
 Sets the ambient colour reflectance properties for every Pass in every Technique.

void setDiffuse (Real red, Real green, Real blue)
 Sets the diffuse colour reflectance properties of every Pass in every Technique.

void setDiffuse (const ColourValue &diffuse)
 Sets the diffuse colour reflectance properties of every Pass in every Technique.

void setSpecular (Real red, Real green, Real blue)
 Sets the specular colour reflectance properties of every Pass in every Technique.

void setSpecular (const ColourValue &specular)
 Sets the specular colour reflectance properties of every Pass in every Technique.

void setShininess (Real val)
 Sets the shininess properties of every Pass in every Technique.

void setSelfIllumination (Real red, Real green, Real blue)
 Sets the amount of self-illumination of every Pass in every Technique.

void setSelfIllumination (const ColourValue &selfIllum)
 Sets the amount of self-illumination of every Pass in every Technique.

void setDepthCheckEnabled (bool enabled)
 Sets whether or not each Pass renders with depth-buffer checking on or not.

void setDepthWriteEnabled (bool enabled)
 Sets whether or not each Pass renders with depth-buffer writing on or not.

void setDepthFunction (CompareFunction func)
 Sets the function used to compare depth values when depth checking is on.

void setColourWriteEnabled (bool enabled)
 Sets whether or not colour buffer writing is enabled for each Pass.

void setCullingMode (CullingMode mode)
 Sets the culling mode for each pass based on the 'vertex winding'.

void setManualCullingMode (ManualCullingMode mode)
 Sets the manual culling mode, performed by CPU rather than hardware.

void setLightingEnabled (bool enabled)
 Sets whether or not dynamic lighting is enabled for every Pass.

void setShadingMode (ShadeOptions mode)
 Sets the type of light shading required.

void setFog (bool overrideScene, FogMode mode=FOG_NONE, const ColourValue &colour=ColourValue::White, Real expDensity=0.001, Real linearStart=0.0, Real linearEnd=1.0)
 Sets the fogging mode applied to each pass.

void setDepthBias (ushort bias)
 Sets the depth bias to be used for each Pass.

void setTextureFiltering (TextureFilterOptions filterType)
 Set texture filtering for every texture unit in every Technique and Pass.

void setTextureAnisotropy (int maxAniso)
 Sets the anisotropy level to be used for all textures.

void setSceneBlending (const SceneBlendType sbt)
 Sets the kind of blending every pass has with the existing contents of the scene.

void setSceneBlending (const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor)
 Allows very fine control of blending every Pass with the existing contents of the scene.

void _notifyNeedsRecompile (void)
 Tells the material that it needs recompilation.

void setLodLevels (const LodDistanceList &lodDistances)
 Sets the distance at which level-of-detail (LOD) levels come into effect.

unsigned short getLodIndex (Real d) const
 Gets the LOD index to use at the given distance.

unsigned short getLodIndexSquaredDepth (Real squaredDepth) const
 Gets the LOD index to use at the given squared distance.

void touch (void)
 @copydoc Resource::touch

virtual size_t getSize (void) const
 Retrieves info about the size of the resource.

time_t getLastAccess (void) const
 Gets the last time the resource was 'touched'.

ResourceHandle getHandle (void) const
bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise.

virtual void destroy ()
 A method to make the resource delete itself.


Protected Types

typedef std::vector< Technique * > Techniques
typedef std::map< unsigned
short, Technique * > 
BestTechniqueList

Protected Methods

void applyDefaults (void)
 Internal method which sets the material up from the default settings.


Protected Attributes

Techniques mTechniques
Techniques mSupportedTechniques
BestTechniqueList mBestTechniqueList
bool mCompilationRequired
 Does this material require compilation?

LodDistanceList mLodDistances
String mName
ResourceHandle mHandle
bool mIsLoaded
time_t mLastAccess
size_t mSize

Static Protected Attributes

Material * mDefaultSettings = 0
 Default material settings - set up by SceneManager.


Friends

class SceneManager
class MaterialManager

Detailed Description

Class encapsulates rendering properties of an object.

Remarks:
Ogre's material class encapsulates ALL aspects of the visual appearance, of an object. It also includes other flags which might not be traditionally thought of as material properties such as culling modes and depth buffer settings, but these affect the appearance of the rendered object and are convenient to attach to the material since it keeps all the settings in one place. This is different to Direct3D which treats a material as just the colour components (diffuse, specular) and not texture maps etc. An Ogre Material can be thought of as equivalent to a 'Shader'.

A Material can be rendered in multiple different ways depending on the hardware available. You may configure a Material to use high-complexity fragment shaders, but these won't work on every card; therefore a Technique is an approach to creating the visual effect you are looking for. You are advised to create fallback techniques with lower hardware requirements if you decide to use advanced features. In addition, you also might want lower-detail techniques for distant geometry.

Each technique can be made up of multiple passes. A fixed-function pass may combine multiple texture layers using multitexrtuing, but Ogre can break that into multiple passes automatically if the active card cannot handle that many simultaneous textures. Programmable passes, however, cannot be split down automatically, so if the active graphics card cannot handle the technique which contains these passes, OGRE will try to find another technique which the card can do. If, at the end of the day, the card cannot handle any of the techniques which are listed for the material, the engine will render the geometry plain white, which should alert you to the problem.

Ogre comes configured with a number of default settings for a newly created material. These can be changed if you wish by retrieving the default material settings through SceneManager::getDefaultMaterialSettings. Any changes you make to the Material returned from this method will apply to any materials created from this point onward.

Definition at line 76 of file OgreMaterial.h.


Member Typedef Documentation

typedef std::map<unsigned short, Technique*> Ogre::Material::BestTechniqueList [protected]
 

Definition at line 96 of file OgreMaterial.h.

typedef std::vector<Real> Ogre::Material::LodDistanceList
 

distance list used to specify LOD

Definition at line 83 of file OgreMaterial.h.

typedef VectorIterator<Techniques> Ogre::Material::TechniqueIterator
 

Definition at line 153 of file OgreMaterial.h.

Referenced by getSupportedTechniqueIterator(), and getTechniqueIterator().

typedef std::vector<Technique*> Ogre::Material::Techniques [protected]
 

Definition at line 93 of file OgreMaterial.h.


Constructor & Destructor Documentation

Ogre::Material::Material const String   name
 

Mandatory constructor - you must supply a name for the material.

Note:
Normally you create materials by calling the relevant SceneManager since that is responsible for managing all scene state including materials.
Parameters:
name  A unique mateiral name

Definition at line 53 of file OgreMaterial.cpp.

References applyDefaults(), mCompilationRequired, Ogre::Resource::mIsLoaded, and Ogre::Resource::mName.

Ogre::Material::Material  
 

Default constructor - uses a generated material name.

Definition at line 40 of file OgreMaterial.cpp.

References mCompilationRequired, Ogre::Resource::mIsLoaded, mLodDistances, and Ogre::Resource::mName.

Ogre::Material::~Material  
 

Definition at line 64 of file OgreMaterial.cpp.

References removeAllTechniques().


Member Function Documentation

void Ogre::Material::_notifyNeedsRecompile void   
 

Tells the material that it needs recompilation.

Definition at line 537 of file OgreMaterial.cpp.

References mCompilationRequired, and Ogre::Resource::mIsLoaded.

Referenced by Ogre::Technique::_notifyNeedsRecompile().

void Ogre::Material::applyDefaults void    [protected]
 

Internal method which sets the material up from the default settings.

Definition at line 185 of file OgreMaterial.cpp.

References mCompilationRequired, and mDefaultSettings.

Referenced by Material().

Material * Ogre::Material::clone const String   newName const
 

Creates a new copy of this material with the same settings but a new name.

Definition at line 153 of file OgreMaterial.cpp.

References Ogre::Resource::getHandle(), Ogre::Resource::mHandle, Ogre::Resource::mIsLoaded, Ogre::Resource::mName, and Ogre::ResourceHandle.

Referenced by Ogre::SceneManager::setSkyBox().

void Ogre::Material::compile bool    autoManageTextureUnits = true
 

'Compiles' this Material.

Remarks:
Compiling a material involves determining which Techniques are supported on the card on which OGRE is currently running, and for fixed-function Passes within those Techniques, splitting the passes down where they contain more TextureUnitState instances than the curren card has texture units.

This process is automatically done when the Material is loaded, but may be repeated if you make some procedural changes.

Parameters:
autoManageTextureUnits  If true, when a fixed function pass has too many TextureUnitState entries than the card has texture units, the Pass in question will be split into more than one Pass in order to emulate the Pass. If you set this to false and this situation arises, an Exception will be thrown.

Definition at line 275 of file OgreMaterial.cpp.

References mBestTechniqueList, mCompilationRequired, Ogre::Resource::mName, mSupportedTechniques, and mTechniques.

Referenced by load().

void Ogre::Material::copyDetailsTo Material *    mat const
 

Copies the details of this material into another, preserving the target's handle and name (unlike operator=) but copying everything else.

Parameters:
mat  Pointer to material which will receive this material's settings.

Definition at line 172 of file OgreMaterial.cpp.

References Ogre::Resource::mHandle, Ogre::Resource::mName, and Ogre::ResourceHandle.

Referenced by Ogre::SceneManager::setSkyBox().

Technique * Ogre::Material::createTechnique void   
 

Creates a new Technique for this Material.

Remarks:
A Technique is a single way of rendering geometry in order to achieve the effect you are intending in a material. There are many reason why you would want more than one - the main one being to handle variable graphics card abilities; you might have one technique which is impressive but only runs on 4th-generation graphics cards, for example. In this case you will want to create at least one fallback Technique. OGRE will work out which Techniques a card can support and pick the best one.

If multiple Techniques are available, the order in which they are created is important - the engine will consider lower-indexed Techniques to be preferable to higher-indexed Techniques, ie when asked for the 'best' technique it will return the first one in the technique list which is supported by the hardware.

Definition at line 192 of file OgreMaterial.cpp.

References mCompilationRequired, and mTechniques.

Referenced by operator=(), Ogre::parseTechnique(), and Ogre::MeshSerializerImpl_v1::readMaterial().

virtual void Ogre::Resource::destroy void    [virtual, inherited]
 

A method to make the resource delete itself.

Note:
This exists because Resource objects could be created in other processes, and they need to be destroyed in the process that created them.

Definition at line 137 of file OgreResource.h.

Technique * Ogre::Material::getBestTechnique unsigned short    lodIndex = 0
 

Gets the best supported technique.

Remarks:
This method returns the lowest-index supported Technique in this material (since lower-indexed Techniques are considered to be better than higher-indexed ones).

The best supported technique is only available after this material has been compiled, which typically happens on loading the material. Therefore, if this method returns NULL, try calling Material::load.

Parameters:
lodIndex  The material lod index to use

Definition at line 206 of file OgreMaterial.cpp.

References Except, mBestTechniqueList, Ogre::Resource::mName, and mSupportedTechniques.

Referenced by Ogre::SubEntity::getTechnique(), Ogre::Renderable::getTechnique(), and Ogre::SceneManager::setSkyBox().

ResourceHandle Ogre::Resource::getHandle void    const [inherited]
 

Definition at line 120 of file OgreResource.h.

References Ogre::ResourceHandle.

Referenced by clone(), Ogre::BspLevel::loadQuake3Level(), and Ogre::ResourceManager::unload().

time_t Ogre::Resource::getLastAccess void    const [inherited]
 

Gets the last time the resource was 'touched'.

Definition at line 108 of file OgreResource.h.

unsigned short Ogre::Material::getLodIndex Real    d const
 

Gets the LOD index to use at the given distance.

Definition at line 559 of file OgreMaterial.cpp.

References getLodIndexSquaredDepth(), and Ogre::Real.

unsigned short Ogre::Material::getLodIndexSquaredDepth Real    squaredDepth const
 

Gets the LOD index to use at the given squared distance.

Definition at line 564 of file OgreMaterial.cpp.

References mLodDistances, and Ogre::Real.

Referenced by getLodIndex().

const String & Ogre::Material::getName void    const
 

Gets the material's name (note - not a texture name).

Reimplemented from Ogre::Resource.

Definition at line 112 of file OgreMaterial.cpp.

References Ogre::Resource::mName.

Referenced by Ogre::logParseError(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), and Ogre::MaterialSerializer::writeMaterial().

unsigned short Ogre::Material::getNumLodLevels void    const
 

Gets the number of levels-of-detail this material has, based on Technique::setLodIndex.

Remarks:
Note that this will not be up to date until the material has been compiled.

Definition at line 169 of file OgreMaterial.h.

virtual size_t Ogre::Resource::getSize void    const [virtual, inherited]
 

Retrieves info about the size of the resource.

Definition at line 93 of file OgreResource.h.

Referenced by Ogre::ResourceManager::unload().

Material::TechniqueIterator Ogre::Material::getSupportedTechniqueIterator void   
 

Gets an iterator over all the Techniques which are supported by the current card.

Remarks:
The supported technique list is only available after this material has been compiled, which typically happens on loading the material. Therefore, if this method returns an empty list, try calling Material::load.

Definition at line 257 of file OgreMaterial.cpp.

References mSupportedTechniques, and TechniqueIterator.

Technique * Ogre::Material::getTechnique unsigned short    index
 

Gets the indexed technique.

Definition at line 200 of file OgreMaterial.cpp.

References mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::Font::createTextureFromFont(), Ogre::Font::load(), Ogre::BspLevel::loadQuake3Level(), Ogre::BspSceneManager::processVisibleLeaf(), Ogre::MeshSerializerImpl_v1::readTextureLayer(), Ogre::BspSceneManager::renderStaticGeometry(), Ogre::TerrainSceneManager::setWorldGeometry(), and Ogre::PanelGuiElement::updateTextureGeometry().

Material::TechniqueIterator Ogre::Material::getTechniqueIterator void   
 

Get an iterator over the Techniques in this Material.

Definition at line 252 of file OgreMaterial.cpp.

References mTechniques, and TechniqueIterator.

bool Ogre::Resource::isLoaded void    const [inherited]
 

Returns true if the Resource has been loaded, false otherwise.

Definition at line 127 of file OgreResource.h.

Referenced by Ogre::GpuProgramUsage::_load(), Ogre::Technique::isLoaded(), Ogre::D3D9Texture::load(), Ogre::D3D9Texture::unload(), and Ogre::D3D9Texture::~D3D9Texture().

bool Ogre::Material::isTransparent void    const
 

Determines if the material has any transparency with the rest of the scene (derived from whether any Techniques say they involve transparency).

Definition at line 262 of file OgreMaterial.cpp.

References mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), and Ogre::SceneManager::materialLess::operator()().

void Ogre::Material::load void    [virtual]
 

Overridden from Resource.

Remarks:
By default, Materials are not loaded, and adding additional textures etc do not cause those textures to be loaded. When the 'load' method is called, all textures are loaded (if they are not already), GPU programs are created if applicable, and Controllers are instantiated. Once a material has been loaded, all changes made to it are immediately loaded too.

Implements Ogre::Resource.

Definition at line 117 of file OgreMaterial.cpp.

References compile(), Ogre::Resource::mIsLoaded, and mSupportedTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::Node::getMaterial(), Ogre::Node::getRenderOperation(), Ogre::BspLevel::loadQuake3Level(), Ogre::BorderPanelGuiElement::setBorderMaterialName(), Ogre::SimpleRenderable::setMaterial(), Ogre::SubEntity::setMaterialName(), Ogre::GuiElement::setMaterialName(), Ogre::BillboardSet::setMaterialName(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), Ogre::SceneManager::setSkyPlane(), and Ogre::TerrainSceneManager::setWorldGeometry().

Material & Ogre::Material::operator= const Material &    rhs
 

Assignment operator to allow easy copying between materials.

Definition at line 70 of file OgreMaterial.cpp.

References createTechnique(), Ogre::Technique::getLodIndex(), mBestTechniqueList, mCompilationRequired, Ogre::Resource::mHandle, Ogre::Resource::mIsLoaded, Ogre::Resource::mLastAccess, mLodDistances, Ogre::Resource::mName, Ogre::Resource::mSize, mSupportedTechniques, mTechniques, and removeAllTechniques().

void Ogre::Material::removeAllTechniques void   
 

Removes all the techniques in this Material.

Definition at line 238 of file OgreMaterial.cpp.

References mBestTechniqueList, mCompilationRequired, mSupportedTechniques, and mTechniques.

Referenced by operator=(), Ogre::parseMaterial(), and ~Material().

void Ogre::Material::removeTechnique unsigned short    index
 

Removes the technique at the given index.

Definition at line 227 of file OgreMaterial.cpp.

References mBestTechniqueList, mCompilationRequired, mSupportedTechniques, and mTechniques.

void Ogre::Material::setAmbient const ColourValue   ambient
 

Sets the ambient colour reflectance properties for every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setAmbient

Definition at line 335 of file OgreMaterial.cpp.

References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setAmbient().

void Ogre::Material::setAmbient Real    red,
Real    green,
Real    blue
 

Sets the ambient colour reflectance properties for every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setAmbient

Definition at line 324 of file OgreMaterial.cpp.

References Ogre::green, mTechniques, Ogre::Real, and Ogre::red.

Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(), and setAmbient().

void Ogre::Material::setColourWriteEnabled bool    enabled
 

Sets whether or not colour buffer writing is enabled for each Pass.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setColourWriteEnabled

Definition at line 425 of file OgreMaterial.cpp.

References mTechniques.

void Ogre::Material::setCullingMode CullingMode    mode
 

Sets the culling mode for each pass based on the 'vertex winding'.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setCullingMode

Definition at line 435 of file OgreMaterial.cpp.

References Ogre::CullingMode, and mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), and Ogre::BspLevel::loadQuake3Level().

void Ogre::Material::setDepthBias ushort    bias
 

Sets the depth bias to be used for each Pass.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setDepthBias

Definition at line 486 of file OgreMaterial.cpp.

References mTechniques, and Ogre::ushort.

void Ogre::Material::setDepthCheckEnabled bool    enabled
 

Sets whether or not each Pass renders with depth-buffer checking on or not.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setDepthCheckEnabled

Definition at line 395 of file OgreMaterial.cpp.

References mTechniques.

Referenced by Ogre::BorderPanelGuiElement::setBorderMaterialName(), Ogre::TTYGuiElement::setFontName(), Ogre::TextAreaGuiElement::setFontName(), and Ogre::GuiElement::setMaterialName().

void Ogre::Material::setDepthFunction CompareFunction    func
 

Sets the function used to compare depth values when depth checking is on.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setDepthFunction

Definition at line 415 of file OgreMaterial.cpp.

References Ogre::CompareFunction, and mTechniques.

void Ogre::Material::setDepthWriteEnabled bool    enabled
 

Sets whether or not each Pass renders with depth-buffer writing on or not.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setDepthWriteEnabled

Definition at line 405 of file OgreMaterial.cpp.

References mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), and Ogre::SceneManager::setSkyPlane().

void Ogre::Material::setDiffuse const ColourValue   diffuse
 

Sets the diffuse colour reflectance properties of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setDiffuse

Definition at line 350 of file OgreMaterial.cpp.

References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setDiffuse().

void Ogre::Material::setDiffuse Real    red,
Real    green,
Real    blue
 

Sets the diffuse colour reflectance properties of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setDiffuse

Definition at line 340 of file OgreMaterial.cpp.

References Ogre::green, mTechniques, Ogre::Real, and Ogre::red.

Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(), and setDiffuse().

void Ogre::Material::setFog bool    overrideScene,
FogMode    mode = FOG_NONE,
const ColourValue   colour = ColourValue::White,
Real    expDensity = 0.001,
Real    linearStart = 0.0,
Real    linearEnd = 1.0
 

Sets the fogging mode applied to each pass.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setFog

Definition at line 475 of file OgreMaterial.cpp.

References Ogre::FogMode, mTechniques, and Ogre::Real.

void Ogre::Material::setLightingEnabled bool    enabled
 

Sets whether or not dynamic lighting is enabled for every Pass.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setLightingEnabled

Definition at line 455 of file OgreMaterial.cpp.

References mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::MaterialManager::initialise(), Ogre::BspLevel::loadQuake3Level(), Ogre::BorderPanelGuiElement::setBorderMaterialName(), Ogre::TTYGuiElement::setFontName(), Ogre::TextAreaGuiElement::setFontName(), and Ogre::GuiElement::setMaterialName().

void Ogre::Material::setLodLevels const LodDistanceList   lodDistances
 

Sets the distance at which level-of-detail (LOD) levels come into effect.

Remarks:
You should only use this if you have assigned LOD indexes to the Technique instances attached to this Material. If you have done so, you should call this method to determine the distance at which the lowe levels of detail kick in. The decision about what distance is actually used is a combination of this and the LOD bias applied to both the current Camera and the current Entity.
Parameters:
lodDistances  A vector of Reals which indicate the distance at which to switch to lower details. They are listed in LOD index order, starting at index 1 (ie the first level down from the highest level 0, which automatically applies from a distance of 0).

Definition at line 544 of file OgreMaterial.cpp.

References mLodDistances.

Referenced by Ogre::parseLodDistances().

void Ogre::Material::setManualCullingMode ManualCullingMode    mode
 

Sets the manual culling mode, performed by CPU rather than hardware.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setManualCullingMode

Definition at line 445 of file OgreMaterial.cpp.

References Ogre::ManualCullingMode, and mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial().

void Ogre::Material::setSceneBlending const SceneBlendFactor    sourceFactor,
const SceneBlendFactor    destFactor
 

Allows very fine control of blending every Pass with the existing contents of the scene.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setSceneBlending

Definition at line 526 of file OgreMaterial.cpp.

References mTechniques, and Ogre::SceneBlendFactor.

void Ogre::Material::setSceneBlending const SceneBlendType    sbt
 

Sets the kind of blending every pass has with the existing contents of the scene.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setSceneBlending

Definition at line 516 of file OgreMaterial.cpp.

References mTechniques, and Ogre::SceneBlendType.

Referenced by Ogre::Quake3Shader::createAsMaterial(), and Ogre::Font::load().

void Ogre::Material::setSelfIllumination const ColourValue   selfIllum
 

Sets the amount of self-illumination of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setSelfIllumination

Definition at line 390 of file OgreMaterial.cpp.

References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setSelfIllumination().

void Ogre::Material::setSelfIllumination Real    red,
Real    green,
Real    blue
 

Sets the amount of self-illumination of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setSelfIllumination

Definition at line 380 of file OgreMaterial.cpp.

References Ogre::green, mTechniques, Ogre::Real, and Ogre::red.

Referenced by setSelfIllumination().

void Ogre::Material::setShadingMode ShadeOptions    mode
 

Sets the type of light shading required.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setShadingMode

Definition at line 465 of file OgreMaterial.cpp.

References mTechniques, and Ogre::ShadeOptions.

void Ogre::Material::setShininess Real    val
 

Sets the shininess properties of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setShininess

Definition at line 370 of file OgreMaterial.cpp.

References mTechniques, and Ogre::Real.

Referenced by Ogre::MeshSerializerImpl_v1::readMaterial().

void Ogre::Material::setSpecular const ColourValue   specular
 

Sets the specular colour reflectance properties of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setSpecular

Definition at line 365 of file OgreMaterial.cpp.

References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setSpecular().

void Ogre::Material::setSpecular Real    red,
Real    green,
Real    blue
 

Sets the specular colour reflectance properties of every Pass in every Technique.

Note:
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
See also:
Pass::setSpecular

Definition at line 355 of file OgreMaterial.cpp.

References Ogre::green, mTechniques, Ogre::Real, and Ogre::red.

Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(), and setSpecular().

void Ogre::Material::setTextureAnisotropy int    maxAniso
 

Sets the anisotropy level to be used for all textures.

Note:
This property has been moved to the TextureUnitState class, which is accessible via the Technique and Pass. For simplicity, this method allows you to set these properties for every current TeextureUnitState, If you need more precision, retrieve the Technique, Pass and TextureUnitState instances and set the property there.
See also:
TextureUnitState::setTextureAnisotropy

Definition at line 506 of file OgreMaterial.cpp.

References mTechniques.

void Ogre::Material::setTextureFiltering TextureFilterOptions    filterType
 

Set texture filtering for every texture unit in every Technique and Pass.

Note:
This property has been moved to the TextureUnitState class, which is accessible via the Technique and Pass. For simplicity, this method allows you to set these properties for every current TeextureUnitState, If you need more precision, retrieve the Technique, Pass and TextureUnitState instances and set the property there.
See also:
TextureUnitState::setTextureFiltering

Definition at line 496 of file OgreMaterial.cpp.

References mTechniques, and Ogre::TextureFilterOptions.

void Ogre::Material::touch void    [virtual]
 

@copydoc Resource::touch

Reimplemented from Ogre::Resource.

Definition at line 511 of file OgreMaterial.h.

Referenced by Ogre::RenderQueue::addRenderable().

void Ogre::Material::unload void    [virtual]
 

Unloads the material, frees resources etc.

See also:
Resource

Reimplemented from Ogre::Resource.

Definition at line 138 of file OgreMaterial.cpp.

References Ogre::Resource::mIsLoaded, and mSupportedTechniques.


Friends And Related Function Documentation

friend class MaterialManager [friend]
 

Definition at line 79 of file OgreMaterial.h.

friend class SceneManager [friend]
 

Definition at line 78 of file OgreMaterial.h.


Member Data Documentation

BestTechniqueList Ogre::Material::mBestTechniqueList [protected]
 

Definition at line 97 of file OgreMaterial.h.

Referenced by compile(), getBestTechnique(), operator=(), removeAllTechniques(), and removeTechnique().

bool Ogre::Material::mCompilationRequired [protected]
 

Does this material require compilation?

Definition at line 100 of file OgreMaterial.h.

Referenced by _notifyNeedsRecompile(), applyDefaults(), compile(), createTechnique(), Material(), operator=(), removeAllTechniques(), and removeTechnique().

Material * Ogre::Material::mDefaultSettings = 0 [static, protected]
 

Default material settings - set up by SceneManager.

Definition at line 37 of file OgreMaterial.cpp.

Referenced by applyDefaults().

ResourceHandle Ogre::Resource::mHandle [protected, inherited]
 

Definition at line 57 of file OgreResource.h.

Referenced by Ogre::ResourceManager::add(), clone(), copyDetailsTo(), and operator=().

bool Ogre::Resource::mIsLoaded [protected, inherited]
 

Definition at line 58 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_initMembers(), Ogre::D3D9Texture::_loadCubeTex(), Ogre::D3D9Texture::_loadNormTex(), Ogre::D3D9Texture::_loadVolumeTex(), _notifyNeedsRecompile(), clone(), Ogre::D3DTexture::createSurface2D(), Ogre::D3DTexture::createSurface3D(), Ogre::D3D9Texture::D3D9Texture(), Ogre::D3DTexture::D3DTexture(), Ogre::DynLib::DynLib(), Ogre::Zip::load(), Ogre::Skeleton::load(), Ogre::PatchMesh::load(), Ogre::Mesh::load(), load(), Ogre::HighLevelGpuProgram::load(), Ogre::GpuProgram::load(), Ogre::GLTexture::load(), Ogre::Font::load(), Ogre::DynLib::load(), Ogre::D3D9Texture::load(), Ogre::D3D9GpuProgram::load(), Ogre::D3DTexture::load(), Ogre::BspLevel::load(), Ogre::D3D9Texture::loadImage(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), Material(), operator=(), Ogre::Skeleton::unload(), Ogre::Mesh::unload(), unload(), Ogre::HighLevelGpuProgram::unload(), Ogre::GLTexture::unload(), Ogre::Font::unload(), Ogre::DynLib::unload(), Ogre::D3D9Texture::unload(), Ogre::D3DTexture::unload(), and Ogre::BspLevel::~BspLevel().

time_t Ogre::Resource::mLastAccess [protected, inherited]
 

Definition at line 59 of file OgreResource.h.

Referenced by operator=().

LodDistanceList Ogre::Material::mLodDistances [protected]
 

Definition at line 101 of file OgreMaterial.h.

Referenced by getLodIndexSquaredDepth(), Material(), operator=(), and setLodLevels().

String Ogre::Resource::mName [protected, inherited]
 

Definition at line 56 of file OgreResource.h.

Referenced by Ogre::Skeleton::_dumpContents(), Ogre::Mesh::_rationaliseBoneAssignments(), Ogre::BspLevel::BspLevel(), Ogre::Mesh::buildTangentVectors(), clone(), compile(), copyDetailsTo(), Ogre::Quake3Shader::createAsMaterial(), Ogre::D3D9HLSLProgram::createLowLevelImpl(), Ogre::CgProgram::createLowLevelImpl(), Ogre::Font::createTextureFromFont(), Ogre::D3D9Texture::D3D9Texture(), Ogre::D3DTexture::D3DTexture(), Ogre::DynLib::DynLib(), Ogre::Font::Font(), Ogre::Mesh::generateLodLevels(), getBestTechnique(), Ogre::Overlay::getName(), getName(), Ogre::GLTexture::GLTexture(), Ogre::GpuProgram::GpuProgram(), Ogre::Zip::load(), Ogre::Skeleton::load(), Ogre::Mesh::load(), Ogre::GLTexture::load(), Ogre::Font::load(), Ogre::DynLib::load(), Ogre::D3DTexture::load(), Ogre::BspLevel::load(), Ogre::D3D9GpuFragmentProgram::loadFromMicrocode(), Ogre::D3D9GpuVertexProgram::loadFromMicrocode(), Ogre::GLArbGpuProgram::loadFromSource(), Ogre::D3D9HLSLProgram::loadFromSource(), Ogre::D3D9GpuProgram::loadFromSource(), Ogre::CgProgram::loadFromSource(), Ogre::GLTexture::loadImages(), Material(), Ogre::Mesh::Mesh(), operator=(), Ogre::Overlay::Overlay(), Ogre::Quake3Shader::Quake3Shader(), Ogre::CgProgram::selectProfile(), Ogre::Mesh::setSkeletonName(), Ogre::Skeleton::Skeleton(), Ogre::StringResource::StringResource(), Ogre::Zip::unload(), Ogre::DynLib::unload(), Ogre::CgProgram::unloadImpl(), and Ogre::Zip::Zip().

size_t Ogre::Resource::mSize [protected, inherited]
 

Definition at line 60 of file OgreResource.h.

Referenced by Ogre::D3D9Texture::_setFinalAttributes(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), and operator=().

Techniques Ogre::Material::mSupportedTechniques [protected]
 

Definition at line 95 of file OgreMaterial.h.

Referenced by compile(), getBestTechnique(), getSupportedTechniqueIterator(), load(), operator=(), removeAllTechniques(), removeTechnique(), and unload().

Techniques Ogre::Material::mTechniques [protected]
 

Definition at line 94 of file OgreMaterial.h.

Referenced by compile(), createTechnique(), getTechnique(), getTechniqueIterator(), isTransparent(), operator=(), removeAllTechniques(), removeTechnique(), setAmbient(), setColourWriteEnabled(), setCullingMode(), setDepthBias(), setDepthCheckEnabled(), setDepthFunction(), setDepthWriteEnabled(), setDiffuse(), setFog(), setLightingEnabled(), setManualCullingMode(), setSceneBlending(), setSelfIllumination(), setShadingMode(), setShininess(), setSpecular(), setTextureAnisotropy(), and setTextureFiltering().


The documentation for this class was generated from the following files:

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:18:03 2004