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:

[legend]
List of all members.

## Public Types

typedef std::vector< Real > | LodDistanceList
| distance list used to specify LOD
typedef ConstVectorIterator< LodDistanceList > | LodDistanceIterator
typedef VectorIterator< Techniques > | TechniqueIterator

## 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 String & | getName (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).
void | setReceiveShadows (bool enabled)
| Sets whether objects using this material will receive shadows.
bool | getReceiveShadows (void) const
| Returns whether or not objects using this material will receive shadows.
void | setTransparencyCastsShadows (bool enabled)
| Sets whether objects using this material be classified as opaque to the shadow caster system.
bool | getTransparencyCastsShadows (void) const
| Returns whether or not objects using this material be classified as opaque to the shadow caster system.
Technique * | createTechnique (void)
| Creates a new Technique for this Material.
Technique * | getTechnique (unsigned short index)
| Gets the indexed technique.
unsigned short | getNumTechniques (void) const
| Retrieves the number of techniques.
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.
Technique * | getSupportedTechnique (unsigned short index)
| Gets the indexed supported technique.
unsigned short | getNumSupportedTechniques (void) const
| Retrieves the number of supported techniques.
unsigned short | getNumLodLevels (void) const
| Gets the number of levels-of-detail this material has, based on Technique::setLodIndex.
Technique * | getBestTechnique (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, Real alpha)
| 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, Real alpha)
| 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.
LodDistanceIterator | getLodDistanceIterator (void) const
| Gets an iterator over the list of distances at which each LOD comes 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
bool | mReceiveShadows
bool | mTransparencyCastsShadows
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 97 of file OgreMaterial.h.

typedef ConstVectorIterator<LodDistanceList> Ogre::Material::LodDistanceIterator

| Definition at line 84 of file OgreMaterial.h. Referenced by getLodDistanceIterator().

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 187 of file OgreMaterial.h. Referenced by getSupportedTechniqueIterator(), and getTechniqueIterator().

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

| Definition at line 94 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 56 of file OgreMaterial.cpp.

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

Ogre::Material::Material | ( |  | ) |

| Default constructor - uses a generated material name. Definition at line 42 of file OgreMaterial.cpp. References mCompilationRequired, Ogre::Resource::mIsLoaded, mLodDistances, Ogre::Resource::mName, mReceiveShadows, and mTransparencyCastsShadows.

Ogre::Material::~Material | ( |  | ) |

| Definition at line 70 of file OgreMaterial.cpp. References removeAllTechniques().

## Member Function Documentation

void Ogre::Material::_notifyNeedsRecompile | ( | void |  | ) |

| Tells the material that it needs recompilation. Definition at line 560 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 192 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 160 of file OgreMaterial.cpp. References Ogre::Resource::getHandle(), Ogre::Resource::mHandle, Ogre::Resource::mIsLoaded, Ogre::Resource::mName, Ogre::ResourceHandle, and Ogre::String. 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 298 of file OgreMaterial.cpp.

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

Referenced by Ogre::SceneManager::initShadowVolumeMaterials(), and 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 179 of file OgreMaterial.cpp.

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

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 199 of file OgreMaterial.cpp.

References mCompilationRequired, and mTechniques.

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

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 229 of file OgreMaterial.cpp.

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

Referenced by Ogre::SubEntity::getTechnique(), Ogre::Entity::reevaluateVertexProcessing(), Ogre::SceneManager::setSkyBox(), and Ogre::TerrainSceneManager::setupTerrainMaterial().

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.

Material::LodDistanceIterator Ogre::Material::getLodDistanceIterator | ( | void |  | ) | const

Gets an iterator over the list of distances at which each LOD comes into effect.

Remarks:
  Note that the iterator returned from this method is not totally anagolous to the one passed in by calling setLodLevels - the list includes a zero entry at the start (since the highest LOD starts at distance 0), and the other distances are held as their squared value for efficiency.

Definition at line 604 of file OgreMaterial.cpp.

References LodDistanceIterator, and mLodDistances.

Referenced by Ogre::MaterialSerializer::writeMaterial().

unsigned short Ogre::Material::getLodIndex | ( | Real | d | ) | const

| Gets the LOD index to use at the given distance. Definition at line 582 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 587 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 119 of file OgreMaterial.cpp. References Ogre::Resource::mName, and Ogre::String. Referenced by Ogre::logParseError(), Ogre::MaterialSerializer::parseScriptLine(), 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 208 of file OgreMaterial.h.

unsigned short Ogre::Material::getNumSupportedTechniques | ( | void |  | ) | const

| Retrieves the number of supported techniques. Definition at line 224 of file OgreMaterial.cpp. References mSupportedTechniques.

unsigned short Ogre::Material::getNumTechniques | ( | void |  | ) | const

| Retrieves the number of techniques. Definition at line 213 of file OgreMaterial.cpp. References mTechniques.

bool Ogre::Material::getReceiveShadows | ( | void |  | ) | const

| Returns whether or not objects using this material will receive shadows. Definition at line 150 of file OgreMaterial.h. Referenced by Ogre::RenderPriorityGroup::addRenderable(), and Ogre::MaterialSerializer::writeMaterial().

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().

Technique * Ogre::Material::getSupportedTechnique | ( | unsigned short | index | ) |

| Gets the indexed supported technique. Definition at line 218 of file OgreMaterial.cpp. References mSupportedTechniques.

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 280 of file OgreMaterial.cpp.

References mSupportedTechniques, and TechniqueIterator.

Technique * Ogre::Material::getTechnique | ( | unsigned short | index | ) |

Gets the indexed technique.

Definition at line 207 of file OgreMaterial.cpp.

References mTechniques.

Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::SceneManager::createShadowTextures(), Ogre::Font::createTextureFromFont(), Ogre::SceneManager::initShadowVolumeMaterials(), Ogre::Font::load(), Ogre::BspLevel::loadQuake3Level(), Ogre::BspSceneManager::processVisibleLeaf(), Ogre::BspSceneManager::renderStaticGeometry(), Ogre::TerrainSceneManager::setupTerrainMaterial(), and Ogre::PanelGuiElement::updateTextureGeometry().

Material::TechniqueIterator Ogre::Material::getTechniqueIterator | ( | void |  | ) |

| Get an iterator over the Techniques in this Material. Definition at line 275 of file OgreMaterial.cpp. References mTechniques, and TechniqueIterator.

bool Ogre::Material::getTransparencyCastsShadows | ( | void |  | ) | const

| Returns whether or not objects using this material be classified as opaque to the shadow caster system. Definition at line 162 of file OgreMaterial.h. Referenced by Ogre::SceneManager::renderTransparentShadowCasterObjects(), and Ogre::MaterialSerializer::writeMaterial().

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::SceneManager::deriveShadowCasterPass(), Ogre::SceneManager::deriveShadowReceiverPass(), 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 285 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 124 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::Entity::reevaluateVertexProcessing(), 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::setupTerrainMaterial().

Material & Ogre::Material::operator= | ( | const Material & | rhs | ) |

Assignment operator to allow easy copying between materials.

Definition at line 76 of file OgreMaterial.cpp.

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

void Ogre::Material::removeAllTechniques | ( | void |  | ) |

| Removes all the techniques in this Material. Definition at line 261 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 250 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 358 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 347 of file OgreMaterial.cpp.

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

Referenced by 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 448 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 458 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 509 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 418 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 438 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 428 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 373 of file OgreMaterial.cpp.

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

void Ogre::Material::setDiffuse | ( | Real | red,
|  | Real | green,
|  | Real | blue,
|  | Real | alpha
| ) |

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 363 of file OgreMaterial.cpp.

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

Referenced by 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 498 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 478 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 567 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 468 of file OgreMaterial.cpp.

References Ogre::ManualCullingMode, and mTechniques.

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

void Ogre::Material::setReceiveShadows | ( | bool | enabled | ) |

Sets whether objects using this material will receive shadows.

Remarks:
  This method allows a material to opt out of receiving shadows, if it would otherwise do so. Shadows will not be cast on any objects unless the scene is set up to support shadows (

See also:
  SceneManager::setShadowTechnique), and not all techniques cast shadows on all objects. In any case, if you have a need to prevent shadows being received by material, this is the method you call to do it.

Note:
  Transparent materials never receive shadows despite this setting. The default is to receive shadows.

Definition at line 148 of file OgreMaterial.h.

Referenced by Ogre::parseReceiveShadows().

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 549 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 539 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 413 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 403 of file OgreMaterial.cpp.

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

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 488 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 393 of file OgreMaterial.cpp.

References mTechniques, and Ogre::Real.

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 388 of file OgreMaterial.cpp.

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

void Ogre::Material::setSpecular | ( | Real | red,
|  | Real | green,
|  | Real | blue,
|  | Real | alpha
| ) |

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 378 of file OgreMaterial.cpp.

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

Referenced by 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 529 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 519 of file OgreMaterial.cpp.

References mTechniques, and Ogre::TextureFilterOptions.

void Ogre::Material::setTransparencyCastsShadows | ( | bool | enabled | ) |

Sets whether objects using this material be classified as opaque to the shadow caster system.

Remarks:
  This method allows a material to cast a shadow, even if it is transparent. By default, transparent materials neither cast nor receive shadows. Shadows will not be cast on any objects unless the scene is set up to support shadows (

See also:
  SceneManager::setShadowTechnique), and not all techniques cast shadows on all objects.

Definition at line 160 of file OgreMaterial.h.

Referenced by Ogre::parseTransparencyCastsShadows().

void Ogre::Material::touch | ( | void |  | ) | `[virtual]`

| @copydoc Resource::touch Reimplemented from Ogre::Resource. Definition at line 558 of file OgreMaterial.h. Referenced by Ogre::RenderQueue::addRenderable(), and Ogre::SceneManager::createShadowTextures().

void Ogre::Material::unload | ( | void |  | ) | `[virtual]`

Unloads the material, frees resources etc.

See also:
  Resource

Reimplemented from Ogre::Resource.

Definition at line 145 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 98 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 101 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 39 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::SkeletonInstance::load(), Ogre::Skeleton::load(), Ogre::PatchMesh::load(), Ogre::Mesh::load(), load(), Ogre::HighLevelGpuProgram::load(), Ogre::GpuProgram::load(), Ogre::GLTexture::load(), Ogre::GLSLGpuProgram::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 102 of file OgreMaterial.h. Referenced by getLodDistanceIterator(), 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::GLSLProgram::attachToProgramObject(), Ogre::BspLevel::BspLevel(), Ogre::Mesh::buildEdgeList(), Ogre::Mesh::buildTangentVectors(), clone(), compile(), Ogre::GLSLProgram::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::GLSLProgram::loadFromSource(), 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::Texture::Texture(), Ogre::Zip::unload(), Ogre::DynLib::unload(), Ogre::CgProgram::unloadImpl(), and Ogre::Zip::Zip().

bool Ogre::Material::mReceiveShadows`[protected]`

| Definition at line 103 of file OgreMaterial.h. Referenced by Material(), and operator=().

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 96 of file OgreMaterial.h. Referenced by compile(), getBestTechnique(), getNumSupportedTechniques(), getSupportedTechnique(), getSupportedTechniqueIterator(), load(), operator=(), removeAllTechniques(), removeTechnique(), and unload().

Techniques Ogre::Material::mTechniques`[protected]`

Definition at line 95 of file OgreMaterial.h.

Referenced by compile(), createTechnique(), getNumTechniques(), 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().

bool Ogre::Material::mTransparencyCastsShadows`[protected]`

| Definition at line 104 of file OgreMaterial.h. Referenced by Material().

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

- OgreMaterial.h
- OgreMaterial.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:51:11 2004