Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Protected Member Functions | Protected Attributes
render::Material Class Reference

#include <Material.h>

Inheritance diagram for render::Material:
resource::Resource engine::Object

List of all members.

Public Member Functions

void addTextureUnit (TextureUnit *tu)
 Inserts a new texture unit in the material.
const ColorgetAmbient () 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 ColorgetDiffuse () const
 Gets the diffuse color reflectance of the material.
const ColorgetEmissive () const
 Gets the emissive color of the material.
const ColorgetFogColor () 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.
ShadergetFragmentShader ()
ShadergetGeometryShader ()
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 ColorgetSpecular () const
 Gets the specular color reflectance of the material.
TextureUnitgetTextureUnit (u32 index) const
 Retrieves a pointer to a texture unit so it may be modified.
ShadergetVertexShader ()
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
ShadermFragmentShader
ShadermGeometryShader
bool mLightingEnabled
ShadeOptions mShadeOptions
f32 mShininess
SceneBlendFactor mSourceBlendFactor
Color mSpecular
std::list< TextureUnit * > mTextureUnits
ShadermVertexShader

Detailed Description

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.


Constructor & Destructor Documentation

render::Material::Material ( const std::string &  name,
resource::Serializer serializer 
)
render::Material::~Material ( )

Member Function Documentation

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 ( )
Shader * render::Material::getGeometryShader ( )
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 ( )
bool render::Material::hasFragmentShader ( )
bool render::Material::hasGeometryShader ( )
bool render::Material::hasVertexShader ( )
void render::Material::initProperties ( ) [protected]
bool render::Material::isProgrammable ( )
bool render::Material::isTransparent ( ) const
void render::Material::removeAllTextureUnits ( )

Removes all texture unit.

References mTextureUnits.

Referenced by unloadImpl().

void render::Material::removeTextureUnit ( u32  index)

Removes a texture unit.

References mTextureUnits.

void render::Material::setAmbient ( f32  red,
f32  green,
f32  blue 
)

Sets the ambient color reflectance properties of this material.

References mAmbient.

void render::Material::setAmbient ( const Color ambient)

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.

void render::Material::setDiffuse ( const Color diffuse)

References mDiffuse.

void render::Material::setDiffuse ( f32  red,
f32  green,
f32  blue 
)

Sets the diffuse color reflectance properties of this material.

References mDiffuse.

void render::Material::setEmissive ( const Color emissive)

References mEmissive.

void render::Material::setEmissive ( f32  red,
f32  green,
f32  blue 
)

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)
void render::Material::setFragmentShader ( const std::string &  filename)
void render::Material::setGeometryShader ( Shader shader)
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)
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.

void render::Material::setSpecular ( const Color specular)

References mSpecular.

void render::Material::setSpecular ( f32  red,
f32  green,
f32  blue 
)

Sets the specular color reflectance properties of this material.

References mSpecular.

void render::Material::setVertexShader ( Shader shader)
void render::Material::setVertexShader ( const std::string &  filename)
void render::Material::unloadImpl ( ) [protected, virtual]

Member Data Documentation


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:08 by Doxygen (1.7.4)