#include <OgreMaterial.h>
Inheritance diagram for Ogre::Material:
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. | |
Technique * | createTechnique (void) |
Creates a new Technique for this Material. | |
Technique * | getTechnique (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. | |
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) |
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. | |
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 |
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 |
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.
|
Definition at line 97 of file OgreMaterial.h. |
|
Definition at line 84 of file OgreMaterial.h. Referenced by getLodDistanceIterator(). |
|
distance list used to specify LOD
Definition at line 83 of file OgreMaterial.h. |
|
Definition at line 172 of file OgreMaterial.h. Referenced by getSupportedTechniqueIterator(), and getTechniqueIterator(). |
|
Definition at line 94 of file OgreMaterial.h. |
|
Mandatory constructor - you must supply a name for the material.
Definition at line 55 of file OgreMaterial.cpp. References applyDefaults(), mCompilationRequired, Ogre::Resource::mIsLoaded, and Ogre::Resource::mName. |
|
Default constructor - uses a generated material name.
Definition at line 42 of file OgreMaterial.cpp. References mCompilationRequired, Ogre::Resource::mIsLoaded, mLodDistances, Ogre::Resource::mName, and mReceiveShadows. |
|
Definition at line 66 of file OgreMaterial.cpp. References removeAllTechniques(). |
|
Tells the material that it needs recompilation.
Definition at line 540 of file OgreMaterial.cpp. References mCompilationRequired, and Ogre::Resource::mIsLoaded. Referenced by Ogre::Technique::_notifyNeedsRecompile(). |
|
Internal method which sets the material up from the default settings.
Definition at line 188 of file OgreMaterial.cpp. References mCompilationRequired, and mDefaultSettings. Referenced by Material(). |
|
Creates a new copy of this material with the same settings but a new name.
Definition at line 156 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(). |
|
'Compiles' this Material.
Definition at line 278 of file OgreMaterial.cpp. References mBestTechniqueList, mCompilationRequired, Ogre::Resource::mName, mSupportedTechniques, and mTechniques. Referenced by Ogre::SceneManager::initShadowVolumeMaterials(), and load(). |
|
Copies the details of this material into another, preserving the target's handle and name (unlike operator=) but copying everything else.
Definition at line 175 of file OgreMaterial.cpp. References Ogre::Resource::mHandle, Ogre::Resource::mName, and Ogre::ResourceHandle. Referenced by Ogre::SceneManager::setSkyBox(). |
|
Creates a new Technique for this Material.
Definition at line 195 of file OgreMaterial.cpp. References mCompilationRequired, and mTechniques. Referenced by operator=(), Ogre::parseTechnique(), and Ogre::MeshSerializerImpl_v1::readMaterial(). |
|
A method to make the resource delete itself.
Definition at line 137 of file OgreResource.h. |
|
Gets the best supported technique.
Definition at line 209 of file OgreMaterial.cpp. References Except, mBestTechniqueList, Ogre::Resource::mName, and mSupportedTechniques. Referenced by Ogre::SubEntity::getTechnique(), Ogre::Renderable::getTechnique(), Ogre::Entity::reevaluateVertexProcessing(), and Ogre::SceneManager::setSkyBox(). |
|
Definition at line 120 of file OgreResource.h. References Ogre::ResourceHandle. Referenced by clone(), Ogre::BspLevel::loadQuake3Level(), and Ogre::ResourceManager::unload(). |
|
Gets the last time the resource was 'touched'.
Definition at line 108 of file OgreResource.h. |
|
Gets an iterator over the list of distances at which each LOD comes into effect.
Definition at line 584 of file OgreMaterial.cpp. References LodDistanceIterator, and mLodDistances. Referenced by Ogre::MaterialSerializer::writeMaterial(). |
|
Gets the LOD index to use at the given distance.
Definition at line 562 of file OgreMaterial.cpp. References getLodIndexSquaredDepth(), and Ogre::Real. |
|
Gets the LOD index to use at the given squared distance.
Definition at line 567 of file OgreMaterial.cpp. References mLodDistances, and Ogre::Real. Referenced by getLodIndex(). |
|
Gets the material's name (note - not a texture name).
Reimplemented from Ogre::Resource. Definition at line 115 of file OgreMaterial.cpp. References Ogre::Resource::mName. Referenced by Ogre::logParseError(), Ogre::MaterialSerializer::parseScriptLine(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), and Ogre::MaterialSerializer::writeMaterial(). |
|
Gets the number of levels-of-detail this material has, based on Technique::setLodIndex.
Definition at line 188 of file OgreMaterial.h. |
|
Returns whether or not objects using this material will receive shadows.
Definition at line 149 of file OgreMaterial.h. Referenced by Ogre::RenderPriorityGroup::addRenderable(), and Ogre::MaterialSerializer::writeMaterial(). |
|
Retrieves info about the size of the resource.
Definition at line 93 of file OgreResource.h. Referenced by Ogre::ResourceManager::unload(). |
|
Gets an iterator over all the Techniques which are supported by the current card.
Definition at line 260 of file OgreMaterial.cpp. References mSupportedTechniques, and TechniqueIterator. |
|
Gets the indexed technique.
Definition at line 203 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::MeshSerializerImpl_v1::readTextureLayer(), Ogre::BspSceneManager::renderStaticGeometry(), Ogre::TerrainSceneManager::setWorldGeometry(), and Ogre::PanelGuiElement::updateTextureGeometry(). |
|
Get an iterator over the Techniques in this Material.
Definition at line 255 of file OgreMaterial.cpp. References mTechniques, and TechniqueIterator. |
|
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(). |
|
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 265 of file OgreMaterial.cpp. References mTechniques. Referenced by Ogre::Quake3Shader::createAsMaterial(), and Ogre::SceneManager::materialLess::operator()(). |
|
|
Assignment operator to allow easy copying between materials.
Definition at line 72 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(). |
|
Removes all the techniques in this Material.
Definition at line 241 of file OgreMaterial.cpp. References mBestTechniqueList, mCompilationRequired, mSupportedTechniques, and mTechniques. Referenced by operator=(), Ogre::parseMaterial(), and ~Material(). |
|
Removes the technique at the given index.
Definition at line 230 of file OgreMaterial.cpp. References mBestTechniqueList, mCompilationRequired, mSupportedTechniques, and mTechniques. |
|
Sets the ambient colour reflectance properties for every Pass in every Technique.
Definition at line 338 of file OgreMaterial.cpp. References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setAmbient(). |
|
Sets the ambient colour reflectance properties for every Pass in every Technique.
Definition at line 327 of file OgreMaterial.cpp. References Ogre::green, mTechniques, and Ogre::Real. Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(), and setAmbient(). |
|
Sets whether or not colour buffer writing is enabled for each Pass.
Definition at line 428 of file OgreMaterial.cpp. References mTechniques. |
|
Sets the culling mode for each pass based on the 'vertex winding'.
Definition at line 438 of file OgreMaterial.cpp. References Ogre::CullingMode, and mTechniques. Referenced by Ogre::Quake3Shader::createAsMaterial(), and Ogre::BspLevel::loadQuake3Level(). |
|
Sets the depth bias to be used for each Pass.
Definition at line 489 of file OgreMaterial.cpp. References mTechniques, and Ogre::ushort. |
|
Sets whether or not each Pass renders with depth-buffer checking on or not.
Definition at line 398 of file OgreMaterial.cpp. References mTechniques. Referenced by Ogre::BorderPanelGuiElement::setBorderMaterialName(), Ogre::TTYGuiElement::setFontName(), Ogre::TextAreaGuiElement::setFontName(), and Ogre::GuiElement::setMaterialName(). |
|
Sets the function used to compare depth values when depth checking is on.
Definition at line 418 of file OgreMaterial.cpp. References Ogre::CompareFunction, and mTechniques. |
|
Sets whether or not each Pass renders with depth-buffer writing on or not.
Definition at line 408 of file OgreMaterial.cpp. References mTechniques. Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::SceneManager::setSkyBox(), Ogre::SceneManager::setSkyDome(), and Ogre::SceneManager::setSkyPlane(). |
|
Sets the diffuse colour reflectance properties of every Pass in every Technique.
Definition at line 353 of file OgreMaterial.cpp. References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setDiffuse(). |
|
Sets the diffuse colour reflectance properties of every Pass in every Technique.
Definition at line 343 of file OgreMaterial.cpp. References Ogre::green, mTechniques, and Ogre::Real. Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(), and setDiffuse(). |
|
Sets the fogging mode applied to each pass.
Definition at line 478 of file OgreMaterial.cpp. References Ogre::FogMode, mTechniques, and Ogre::Real. |
|
Sets whether or not dynamic lighting is enabled for every Pass.
Definition at line 458 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(). |
|
Sets the distance at which level-of-detail (LOD) levels come into effect.
Definition at line 547 of file OgreMaterial.cpp. References mLodDistances. Referenced by Ogre::parseLodDistances(). |
|
Sets the manual culling mode, performed by CPU rather than hardware.
Definition at line 448 of file OgreMaterial.cpp. References Ogre::ManualCullingMode, and mTechniques. Referenced by Ogre::Quake3Shader::createAsMaterial(). |
|
Sets whether objects using this material will receive shadows.
Definition at line 147 of file OgreMaterial.h. Referenced by Ogre::parseReceiveShadows(). |
|
Allows very fine control of blending every Pass with the existing contents of the scene.
Definition at line 529 of file OgreMaterial.cpp. References mTechniques, and Ogre::SceneBlendFactor. |
|
Sets the kind of blending every pass has with the existing contents of the scene.
Definition at line 519 of file OgreMaterial.cpp. References mTechniques, and Ogre::SceneBlendType. Referenced by Ogre::Quake3Shader::createAsMaterial(), and Ogre::Font::load(). |
|
Sets the amount of self-illumination of every Pass in every Technique.
Definition at line 393 of file OgreMaterial.cpp. References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setSelfIllumination(). |
|
Sets the amount of self-illumination of every Pass in every Technique.
Definition at line 383 of file OgreMaterial.cpp. References Ogre::green, mTechniques, and Ogre::Real. Referenced by setSelfIllumination(). |
|
Sets the type of light shading required.
Definition at line 468 of file OgreMaterial.cpp. References mTechniques, and Ogre::ShadeOptions. |
|
Sets the shininess properties of every Pass in every Technique.
Definition at line 373 of file OgreMaterial.cpp. References mTechniques, and Ogre::Real. Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(). |
|
Sets the specular colour reflectance properties of every Pass in every Technique.
Definition at line 368 of file OgreMaterial.cpp. References Ogre::ColourValue::b, Ogre::ColourValue::g, Ogre::ColourValue::r, and setSpecular(). |
|
Sets the specular colour reflectance properties of every Pass in every Technique.
Definition at line 358 of file OgreMaterial.cpp. References Ogre::green, mTechniques, and Ogre::Real. Referenced by Ogre::MeshSerializerImpl_v1::readMaterial(), and setSpecular(). |
|
Sets the anisotropy level to be used for all textures.
Definition at line 509 of file OgreMaterial.cpp. References mTechniques. |
|
Set texture filtering for every texture unit in every Technique and Pass.
Definition at line 499 of file OgreMaterial.cpp. References mTechniques, and Ogre::TextureFilterOptions. |
|
@copydoc Resource::touch
Reimplemented from Ogre::Resource. Definition at line 538 of file OgreMaterial.h. Referenced by Ogre::RenderQueue::addRenderable(), and Ogre::SceneManager::createShadowTextures(). |
|
Unloads the material, frees resources etc.
Reimplemented from Ogre::Resource. Definition at line 141 of file OgreMaterial.cpp. References Ogre::Resource::mIsLoaded, and mSupportedTechniques. |
|
Definition at line 79 of file OgreMaterial.h. |
|
Definition at line 78 of file OgreMaterial.h. |
|
Definition at line 98 of file OgreMaterial.h. Referenced by compile(), getBestTechnique(), operator=(), removeAllTechniques(), and removeTechnique(). |
|
Does this material require compilation?
Definition at line 101 of file OgreMaterial.h. Referenced by _notifyNeedsRecompile(), applyDefaults(), compile(), createTechnique(), Material(), operator=(), removeAllTechniques(), and removeTechnique(). |
|
Default material settings - set up by SceneManager.
Definition at line 39 of file OgreMaterial.cpp. Referenced by applyDefaults(). |
|
Definition at line 57 of file OgreResource.h. Referenced by Ogre::ResourceManager::add(), clone(), copyDetailsTo(), and operator=(). |
|
|
Definition at line 59 of file OgreResource.h. Referenced by operator=(). |
|
Definition at line 102 of file OgreMaterial.h. Referenced by getLodDistanceIterator(), getLodIndexSquaredDepth(), Material(), operator=(), and setLodLevels(). |
|
|
Definition at line 103 of file OgreMaterial.h. |
|
Definition at line 60 of file OgreResource.h. Referenced by Ogre::D3D9Texture::_setFinalAttributes(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), and operator=(). |
|
Definition at line 96 of file OgreMaterial.h. Referenced by compile(), getBestTechnique(), getSupportedTechniqueIterator(), load(), operator=(), removeAllTechniques(), removeTechnique(), and unload(). |
|
Definition at line 95 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(). |
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:26:30 2004