Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
#include <Material.h>
Public Member Functions | |
void | addTextureUnit (TextureUnit *tu) |
Inserts a new texture unit in the material. | |
const Color & | getAmbient () const |
Gets the ambient color reflectance of the material. | |
bool | getDepthCheckEnabled () const |
Returns whether or not this material renders with depth-buffer checking on or not. | |
bool | getDepthWriteEnabled () const |
Returns whether or not this material renders with depth-buffer writing on or not. | |
SceneBlendFactor | getDestBlendFactor () const |
Retrieves the destination blending factor for the material. | |
const Color & | getDiffuse () const |
Gets the diffuse color reflectance of the material. | |
const Color & | getEmissive () const |
Gets the emissive color of the material. | |
const Color & | getFogColor () const |
Returns the fog color for the scene. | |
f32 | getFogDensity () const |
Returns the fog density for this pass. | |
f32 | getFogEnd () const |
Returns the fog end distance for this pass. | |
FogMode | getFogMode () const |
Returns the fog mode for this material. | |
bool | getFogOverride () const |
Returns true if this pass is to override the scene fog settings. | |
f32 | getFogStart () const |
Returns the fog start distance for this pass. | |
Shader * | getFragmentShader () |
Shader * | getGeometryShader () |
bool | getLightingEnabled () const |
Returns whether or not dynamic lighting is enabled. | |
u32 | getNumTextureUnits () const |
Returns the number of texture unit. | |
ShadeOptions | getShadingMode () const |
Returns the type of light shading to be used. | |
f32 | getShininess () const |
Gets the 'shininess' property of the material (affects specular highlights). | |
SceneBlendFactor | getSourceBlendFactor () const |
Retrieves the source blending factor for the material. | |
const Color & | getSpecular () const |
Gets the specular color reflectance of the material. | |
TextureUnit * | getTextureUnit (u32 index) const |
Retrieves a pointer to a texture unit so it may be modified. | |
Shader * | getVertexShader () |
bool | hasFragmentShader () |
bool | hasGeometryShader () |
bool | hasVertexShader () |
bool | isProgrammable () |
bool | isTransparent () const |
Returns true if this material has some element of transparency. | |
Material (const std::string &name, resource::Serializer *serializer) | |
void | removeAllTextureUnits () |
Removes all texture unit. | |
void | removeTextureUnit (u32 index) |
Removes a texture unit. | |
void | setAmbient (f32 red, f32 green, f32 blue) |
Sets the ambient color reflectance properties of this material. | |
void | setAmbient (const Color &ambient) |
void | setDepthCheckEnabled (bool enabled) |
Sets whether or not this material renders with depth-buffer checking on or not. | |
void | setDepthWriteEnabled (bool enabled) |
Sets whether or not this material renders with depth-buffer writing on or not. | |
void | setDiffuse (const Color &diffuse) |
void | setDiffuse (f32 red, f32 green, f32 blue) |
Sets the diffuse color reflectance properties of this material. | |
void | setEmissive (f32 red, f32 green, f32 blue) |
Sets the emissive color reflectance properties of this material. | |
void | setEmissive (const Color &emissive) |
void | setFog (bool overrideScene=true, FogMode mode=FM_NONE, const Color &color=Color::White, f32 density=0.001f, f32 start=0.0f, f32 end=1.0f) |
Sets the fogging mode applied for this material. | |
void | setFragmentShader (Shader *shader) |
void | setFragmentShader (const std::string &filename) |
void | setGeometryShader (Shader *shader) |
void | setGeometryShader (const std::string &filename) |
void | setLightingEnabled (bool enabled) |
Sets whether or not dynamic lighting is enabled. | |
void | setSceneBlending (const SceneBlendType sbt) |
Sets the kind of blending this material has with the existing contents of the scene. | |
void | setSceneBlending (const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor) |
Allows very fine control of blending this material with the existing contents of the scene. | |
void | setShadingMode (ShadeOptions mode) |
Sets the type of light shading required. | |
void | setShininess (f32 shininess) |
Sets the shininess of the material, affecting the size of specular highlights. | |
void | setSpecular (f32 red, f32 green, f32 blue) |
Sets the specular color reflectance properties of this material. | |
void | setSpecular (const Color &specular) |
void | setVertexShader (Shader *shader) |
void | setVertexShader (const std::string &filename) |
~Material () | |
Protected Member Functions | |
void | initProperties () |
void | unloadImpl () |
Protected Attributes | |
Color | mAmbient |
bool | mDepthCheck |
bool | mDepthWrite |
SceneBlendFactor | mDestBlendFactor |
Color | mDiffuse |
Color | mEmissive |
Color | mFogColor |
f32 | mFogDensity |
f32 | mFogEnd |
FogMode | mFogMode |
bool | mFogOverride |
f32 | mFogStart |
Shader * | mFragmentShader |
Shader * | mGeometryShader |
bool | mLightingEnabled |
ShadeOptions | mShadeOptions |
f32 | mShininess |
SceneBlendFactor | mSourceBlendFactor |
Color | mSpecular |
std::list< TextureUnit * > | mTextureUnits |
Shader * | mVertexShader |
Class encapsulates surface properties of a mesh.
To optimise rendering, changes in render state must be minimised. One of the most frequent render state changes are changes to materials, mostly to textures. An mesh can have only one material.
render::Material::Material | ( | const std::string & | name, |
resource::Serializer * | serializer | ||
) |
render::Material::~Material | ( | ) |
void render::Material::addTextureUnit | ( | TextureUnit * | tu | ) |
Inserts a new texture unit in the material.
References mTextureUnits.
const Color & render::Material::getAmbient | ( | ) | const |
Gets the ambient color reflectance of the material.
References mAmbient.
Referenced by render::RenderManager::setMaterial().
bool render::Material::getDepthCheckEnabled | ( | ) | const |
Returns whether or not this material renders with depth-buffer checking on or not.
References mDepthCheck.
Referenced by render::RenderManager::setMaterial().
bool render::Material::getDepthWriteEnabled | ( | ) | const |
Returns whether or not this material renders with depth-buffer writing on or not.
References mDepthWrite.
Referenced by render::RenderManager::setMaterial().
SceneBlendFactor render::Material::getDestBlendFactor | ( | ) | const |
Retrieves the destination blending factor for the material.
References mDestBlendFactor.
Referenced by render::RenderManager::setMaterial().
const Color & render::Material::getDiffuse | ( | ) | const |
Gets the diffuse color reflectance of the material.
References mDiffuse.
Referenced by render::RenderManager::setMaterial().
const Color & render::Material::getEmissive | ( | ) | const |
Gets the emissive color of the material.
References mEmissive.
Referenced by render::RenderManager::setMaterial().
const Color & render::Material::getFogColor | ( | ) | const |
Returns the fog color for the scene.
References mFogColor.
Referenced by render::RenderManager::setMaterial().
f32 render::Material::getFogDensity | ( | ) | const |
Returns the fog density for this pass.
References mFogDensity.
Referenced by render::RenderManager::setMaterial().
f32 render::Material::getFogEnd | ( | ) | const |
Returns the fog end distance for this pass.
References mFogEnd.
Referenced by render::RenderManager::setMaterial().
FogMode render::Material::getFogMode | ( | ) | const |
Returns the fog mode for this material.
References mFogMode.
Referenced by render::RenderManager::setMaterial().
bool render::Material::getFogOverride | ( | ) | const |
Returns true if this pass is to override the scene fog settings.
References mFogOverride.
Referenced by render::RenderManager::setMaterial().
f32 render::Material::getFogStart | ( | ) | const |
Returns the fog start distance for this pass.
References mFogStart.
Referenced by render::RenderManager::setMaterial().
Shader * render::Material::getFragmentShader | ( | ) |
References mFragmentShader.
Referenced by render::RenderManager::setMaterial().
Shader * render::Material::getGeometryShader | ( | ) |
References mGeometryShader.
Referenced by render::RenderManager::setMaterial().
bool render::Material::getLightingEnabled | ( | ) | const |
Returns whether or not dynamic lighting is enabled.
References mLightingEnabled.
Referenced by render::RenderManager::setMaterial().
u32 render::Material::getNumTextureUnits | ( | ) | const |
Returns the number of texture unit.
References mTextureUnits.
Referenced by render::RenderManager::setMaterial().
ShadeOptions render::Material::getShadingMode | ( | ) | const |
Returns the type of light shading to be used.
References mShadeOptions.
Referenced by render::RenderManager::setMaterial().
f32 render::Material::getShininess | ( | ) | const |
Gets the 'shininess' property of the material (affects specular highlights).
References mShininess.
Referenced by render::RenderManager::setMaterial().
SceneBlendFactor render::Material::getSourceBlendFactor | ( | ) | const |
Retrieves the source blending factor for the material.
References mSourceBlendFactor.
Referenced by render::RenderManager::setMaterial().
const Color & render::Material::getSpecular | ( | ) | const |
Gets the specular color reflectance of the material.
References mSpecular.
Referenced by render::RenderManager::setMaterial().
TextureUnit * render::Material::getTextureUnit | ( | u32 | index | ) | const |
Retrieves a pointer to a texture unit so it may be modified.
References mTextureUnits.
Referenced by render::RenderManager::setMaterial().
Shader * render::Material::getVertexShader | ( | ) |
References mVertexShader.
Referenced by render::RenderManager::setMaterial().
bool render::Material::hasFragmentShader | ( | ) |
References mFragmentShader.
Referenced by render::RenderManager::setMaterial().
bool render::Material::hasGeometryShader | ( | ) |
References mGeometryShader.
Referenced by render::RenderManager::setMaterial().
bool render::Material::hasVertexShader | ( | ) |
References mVertexShader.
Referenced by render::RenderManager::setMaterial().
void render::Material::initProperties | ( | ) | [protected] |
Reimplemented from resource::Resource.
References render::Color::Black, render::FM_NONE, mAmbient, mDepthCheck, mDepthWrite, mDestBlendFactor, mDiffuse, mEmissive, mFogColor, mFogDensity, mFogEnd, mFogMode, mFogOverride, mFogStart, mFragmentShader, mGeometryShader, mLightingEnabled, mShadeOptions, mShininess, mSourceBlendFactor, mSpecular, mTextureUnits, mVertexShader, render::SBF_ONE, render::SBF_ZERO, render::SO_GOURAUD, and render::Color::White.
Referenced by Material().
bool render::Material::isProgrammable | ( | ) |
References mFragmentShader, mGeometryShader, and mVertexShader.
bool render::Material::isTransparent | ( | ) | const |
Returns true if this material has some element of transparency.
References mDestBlendFactor, mSourceBlendFactor, render::SBF_DEST_ALPHA, render::SBF_DEST_COLOR, render::SBF_ONE_MINUS_DEST_ALPHA, render::SBF_ONE_MINUS_DEST_COLOR, and render::SBF_ZERO.
Referenced by render::RenderManager::findVisibleRenderables().
void render::Material::removeAllTextureUnits | ( | ) |
void render::Material::removeTextureUnit | ( | u32 | index | ) |
Removes a texture unit.
References mTextureUnits.
Sets the ambient color reflectance properties of this material.
References mAmbient.
void render::Material::setDepthCheckEnabled | ( | bool | enabled | ) |
Sets whether or not this material renders with depth-buffer checking on or not.
References mDepthCheck.
void render::Material::setDepthWriteEnabled | ( | bool | enabled | ) |
Sets whether or not this material renders with depth-buffer writing on or not.
References mDepthWrite.
Sets the diffuse color reflectance properties of this material.
References mDiffuse.
Sets the emissive color reflectance properties of this material.
References mEmissive.
void render::Material::setFog | ( | bool | overrideScene = true , |
FogMode | mode = FM_NONE , |
||
const Color & | color = Color::White , |
||
f32 | density = 0.001f , |
||
f32 | start = 0.0f , |
||
f32 | end = 1.0f |
||
) |
Sets the fogging mode applied for this material.
References mFogColor, mFogDensity, mFogEnd, mFogMode, mFogOverride, and mFogStart.
void render::Material::setFragmentShader | ( | Shader * | shader | ) |
References render::Shader::getShaderType(), mFragmentShader, and render::ST_FRAGMENT.
void render::Material::setFragmentShader | ( | const std::string & | filename | ) |
void render::Material::setGeometryShader | ( | Shader * | shader | ) |
References render::Shader::getShaderType(), mGeometryShader, and render::ST_GEOMETRY.
void render::Material::setGeometryShader | ( | const std::string & | filename | ) |
void render::Material::setLightingEnabled | ( | bool | enabled | ) |
Sets whether or not dynamic lighting is enabled.
References mLightingEnabled.
void render::Material::setSceneBlending | ( | const SceneBlendType | sbt | ) |
Sets the kind of blending this material has with the existing contents of the scene.
References render::SBF_DEST_COLOR, render::SBF_ONE, render::SBF_ONE_MINUS_SOURCE_ALPHA, render::SBF_ONE_MINUS_SOURCE_COLOR, render::SBF_SOURCE_ALPHA, render::SBF_SOURCE_COLOR, render::SBF_ZERO, render::SBT_ADD, render::SBT_MODULATE, render::SBT_REPLACE, render::SBT_TRANSPARENT_ALPHA, and render::SBT_TRANSPARENT_COLOR.
void render::Material::setSceneBlending | ( | const SceneBlendFactor | sourceFactor, |
const SceneBlendFactor | destFactor | ||
) |
Allows very fine control of blending this material with the existing contents of the scene.
References mDestBlendFactor, and mSourceBlendFactor.
void render::Material::setShadingMode | ( | ShadeOptions | mode | ) |
Sets the type of light shading required.
References mShadeOptions.
void render::Material::setShininess | ( | f32 | shininess | ) |
Sets the shininess of the material, affecting the size of specular highlights.
References mShininess.
Sets the specular color reflectance properties of this material.
References mSpecular.
void render::Material::setVertexShader | ( | Shader * | shader | ) |
References render::Shader::getShaderType(), mVertexShader, and render::ST_VERTEX.
void render::Material::setVertexShader | ( | const std::string & | filename | ) |
void render::Material::unloadImpl | ( | ) | [protected, virtual] |
Reimplemented from resource::Resource.
References render::Color::Black, render::FM_NONE, mAmbient, mDepthCheck, mDepthWrite, mDestBlendFactor, mDiffuse, mEmissive, mFogColor, mFogDensity, mFogEnd, mFogMode, mFogOverride, mFogStart, mFragmentShader, mGeometryShader, mLightingEnabled, mShadeOptions, mShininess, mSourceBlendFactor, mSpecular, mVertexShader, removeAllTextureUnits(), render::SBF_ONE, render::SBF_ZERO, render::SO_GOURAUD, and render::Color::White.
Color render::Material::mAmbient [protected] |
Referenced by getAmbient(), initProperties(), setAmbient(), and unloadImpl().
bool render::Material::mDepthCheck [protected] |
Referenced by getDepthCheckEnabled(), initProperties(), setDepthCheckEnabled(), and unloadImpl().
bool render::Material::mDepthWrite [protected] |
Referenced by getDepthWriteEnabled(), initProperties(), setDepthWriteEnabled(), and unloadImpl().
SceneBlendFactor render::Material::mDestBlendFactor [protected] |
Referenced by getDestBlendFactor(), initProperties(), isTransparent(), setSceneBlending(), and unloadImpl().
Color render::Material::mDiffuse [protected] |
Referenced by getDiffuse(), initProperties(), setDiffuse(), and unloadImpl().
Color render::Material::mEmissive [protected] |
Referenced by getEmissive(), initProperties(), setEmissive(), and unloadImpl().
Color render::Material::mFogColor [protected] |
Referenced by getFogColor(), initProperties(), setFog(), and unloadImpl().
f32 render::Material::mFogDensity [protected] |
Referenced by getFogDensity(), initProperties(), setFog(), and unloadImpl().
f32 render::Material::mFogEnd [protected] |
Referenced by getFogEnd(), initProperties(), setFog(), and unloadImpl().
FogMode render::Material::mFogMode [protected] |
Referenced by getFogMode(), initProperties(), setFog(), and unloadImpl().
bool render::Material::mFogOverride [protected] |
Referenced by getFogOverride(), initProperties(), setFog(), and unloadImpl().
f32 render::Material::mFogStart [protected] |
Referenced by getFogStart(), initProperties(), setFog(), and unloadImpl().
Shader* render::Material::mFragmentShader [protected] |
Referenced by getFragmentShader(), hasFragmentShader(), initProperties(), isProgrammable(), setFragmentShader(), and unloadImpl().
Shader* render::Material::mGeometryShader [protected] |
Referenced by getGeometryShader(), hasGeometryShader(), initProperties(), isProgrammable(), setGeometryShader(), and unloadImpl().
bool render::Material::mLightingEnabled [protected] |
Referenced by getLightingEnabled(), initProperties(), setLightingEnabled(), and unloadImpl().
ShadeOptions render::Material::mShadeOptions [protected] |
Referenced by getShadingMode(), initProperties(), setShadingMode(), and unloadImpl().
f32 render::Material::mShininess [protected] |
Referenced by getShininess(), initProperties(), setShininess(), and unloadImpl().
SceneBlendFactor render::Material::mSourceBlendFactor [protected] |
Referenced by getSourceBlendFactor(), initProperties(), isTransparent(), setSceneBlending(), and unloadImpl().
Color render::Material::mSpecular [protected] |
Referenced by getSpecular(), initProperties(), setSpecular(), and unloadImpl().
std::list<TextureUnit*> render::Material::mTextureUnits [protected] |
Referenced by addTextureUnit(), getNumTextureUnits(), getTextureUnit(), initProperties(), removeAllTextureUnits(), and removeTextureUnit().
Shader* render::Material::mVertexShader [protected] |
Referenced by getVertexShader(), hasVertexShader(), initProperties(), isProgrammable(), setVertexShader(), and unloadImpl().
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:08 by
Doxygen
(1.7.4)
|