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:

Ogre::Resource List of all members.

Public Methods

 Material (const String &name, bool deferLoad=false)
 Mandatory constructor - you must supply a name for the material. More...

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

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

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

int getHandle (void) const
 Returns the numerical handle for this material, if a more compact refence is required. More...

void setAmbient (Real red, Real green, Real blue)
 Sets the ambient colour reflectance properties of this material. More...

void setAmbient (const ColourValue &ambient)
 Sets the ambient colour reflectance properties of this material. More...

void setDiffuse (Real red, Real green, Real blue)
 Sets the diffuse colour reflectance properties of this material. More...

void setDiffuse (const ColourValue &diffuse)
 Sets the diffuse colour reflectance properties of this material. More...

void setSpecular (Real red, Real green, Real blue)
 Sets the specular colour reflectance properties of this material. More...

void setSpecular (const ColourValue &specular)
 Sets the specular colour reflectance properties of this material. More...

void setShininess (Real val)
 Sets the shininess of the material, affecting the size of specular highlights. More...

void setSelfIllumination (Real red, Real green, Real blue)
 Sets the amount of self-illumination an object has. More...

void setSelfIllumination (const ColourValue &selfIllum)
 Sets the amount of self-illumination an object has. More...

const ColourValuegetAmbient (void) const
 Gets the ambient colour reflectance of the material. More...

const ColourValuegetDiffuse (void) const
 Gets the diffuse colour reflectance of the material. More...

const ColourValuegetSpecular (void) const
 Gets the specular colour reflectance of the material. More...

const ColourValuegetSelfIllumination (void) const
 Gets the self illumination colour of the material. More...

Real getShininess (void) const
 Gets the 'shininess' property of the material (affects specular highlights). More...

TextureLayeraddTextureLayer (const String &textureName, int texCoordSet=0)
 Inserts a new texture layer in the material using primitives. More...

TextureLayergetTextureLayer (int index) const
 Retrieves a pointer to a texture layer so it may be modified. More...

void removeTextureLayer ()
 Removes the topmost texture layer from the material. More...

void removeAllTextureLayers (void)
 Removes all texture layers. More...

int getNumTextureLayers (void) const
 Returns the number of texture layers. More...

void setSceneBlending (const SceneBlendType sbt)
 Sets the kind of blending this material has with the existing contents of the scene. More...

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

SceneBlendFactor getSourceBlendFactor () const
 Retrieves the source blending factor for the material (as set using Materiall::setSceneBlending). More...

SceneBlendFactor getDestBlendFactor () const
 Retrieves the destination blending factor for the material (as set using Materiall::setSceneBlending). More...

bool isTransparent (void) const
 Determines if the material has any transparency with the rest of the scene (derived from scene blending op). More...

void setDepthCheckEnabled (bool enabled)
 Sets whether or not this material renders with depth-buffer checking on or not. More...

bool getDepthCheckEnabled (void) const
 Returns whether or not this material renders with depth-buffer checking on or not. More...

void setDepthWriteEnabled (bool enabled)
 Sets whether or not this material renders with depth-buffer writing on or not. More...

bool getDepthWriteEnabled (void) const
 Returns whether or not this material renders with depth-buffer writing on or not. More...

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

CompareFunction getDepthFunction (void) const
 Returns the function used to compare depth values when depth checking is on. More...

void setCullingMode (CullingMode mode)
 Sets the culling mode for this material based on the 'vertex winding'. More...

CullingMode getCullingMode (void) const
 Returns the culling mode for geometry rendered with this material. More...

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

ManualCullingMode getManualCullingMode (void) const
 Retrieves the manual culling mode for this material. More...

void setLightingEnabled (bool enabled)
 Sets whether or not dynamic lighting is enabled. More...

bool getLightingEnabled (void) const
 Returns whether or not dynamic lighting is enabled. More...

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

ShadeOptions getShadingMode (void) const
 Returns the type of light shading to be used. More...

void setTextureFiltering (TextureFilterOptions mode)
 Sets the type of texture filtering used when rendering. More...

TextureFilterOptions getTextureFiltering (void) const
 Returns the type of texture filtering used when rendering. More...

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 this material. More...

bool getFogOverride (void) const
 Returns true if this material is to override the scene fog settings. More...

FogMode getFogMode (void) const
 Returns the fog mode for this material. More...

const ColourValuegetFogColour (void) const
 Returns the fog colour for the scene. More...

Real getFogStart (void) const
 Returns the fog start distance for this material. More...

Real getFogEnd (void) const
 Returns the fog end distance for this material. More...

Real getFogDensity (void) const
 Returns the fog density for this material. More...

void load (void)
 Overridden from Resource. More...

void unload (void)
 Overridden from Resource. More...

bool _compareSurfaceParams (const Material &cmp) const
 Utility method for comparing material surface params. More...

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

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

void setDepthBias (ushort bias)
 Sets the depth bias to be used for this material. More...

ushort getDepthBias (void)
 Retrieves the depth bias value as set by setDepthValue. More...

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

void touch (void)
 'Touches' the resource to indicate it has been used. More...

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

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

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


Protected Methods

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

void assignNextHandle (void)
 Method for retrieving next handle (internal only). More...


Protected Attributes

ColourValue mAmbient
ColourValue mDiffuse
ColourValue mSpecular
ColourValue mEmissive
Real mShininess
int mHandle
 Numerical handle (constant). More...

SceneBlendFactor mSourceBlendFactor
SceneBlendFactor mDestBlendFactor
bool mDepthCheck
bool mDepthWrite
CompareFunction mDepthFunc
ushort mDepthBias
CullingMode mCullMode
ManualCullingMode mManualCullMode
bool mLightingEnabled
 Lighting enabled? More...

ShadeOptions mShadeOptions
 Shading options. More...

TextureFilterOptions mTextureFiltering
 Texture filtering. More...

bool mFogOverride
FogMode mFogMode
ColourValue mFogColour
Real mFogStart
Real mFogEnd
Real mFogDensity
bool mDeferLoad
 If true, loading of textures and setting up controllers is deferred until the 'load' method is called. More...

int mNumTextureLayers
 Number of texture layers. More...

TextureLayer mTextureLayers [OGRE_MAX_TEXTURE_LAYERS]
String mName
bool mIsLoaded
time_t mLastAccess
size_t mSize

Static Protected Attributes

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


Friends

class SceneManager
class MaterialManager

Detailed Description

Class encapsulates rendering properties of an object.

Remarks:
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 object may use multiple materials for different parts of it's sub-mesh, although it is normally advisable to restrict objects to one material if possible.

Ogre's material class encapsulates ALL aspects of the material, rather like 3D Studio's material. 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'.

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.

Todo:
Add bump-mapping support.


Constructor & Destructor Documentation

Ogre::Material::Material const String   name,
bool    deferLoad = false
 

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
deferLoad  If true, defers loading of texture resources etc until Material::load is called

Ogre::Material::Material  
 

Default constructor - uses a generated material name.


Member Function Documentation

bool Ogre::Material::_compareSurfaceParams const Material &    cmp const
 

Utility method for comparing material surface params.

Returns:
True if identical, false otherwise.

Material::TextureLayer * Ogre::Material::addTextureLayer const String   textureName,
int    texCoordSet = 0
 

Inserts a new texture layer in the material using primitives.

Remarks:
This layer is added on top of all previous layers. Previously this method allowed insertion at any point in the texture layer stack but this feature has been removed for efficiency. Note that the Material will automatically load the texture requested, with the default number of mipmaps and priority. If you wish to have more control, load the Texture manually yourself using the TextureManager::load method before you add the texture layer (textures already loaded will keep their settings).
Parameters:
name  The basic name of the texture e.g. brickwall.jpg, stonefloor.png
texCoordSet  The index of the texture coordinate set to use.

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

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

void Ogre::Material::assignNextHandle void    [protected]
 

Method for retrieving next handle (internal only).

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

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

void Ogre::Material::copyDetailsTo Material *    mat
 

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.

virtual void Ogre::Resource::destroy void    [inline, 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.

const ColourValue & Ogre::Material::getAmbient void    const
 

Gets the ambient colour reflectance of the material.

CullingMode Ogre::Material::getCullingMode void    const
 

Returns the culling mode for geometry rendered with this material.

See setCullingMode for more information.

ushort Ogre::Material::getDepthBias void   
 

Retrieves the depth bias value as set by setDepthValue.

bool Ogre::Material::getDepthCheckEnabled void    const
 

Returns whether or not this material renders with depth-buffer checking on or not.

See also:
setDepthCheckEnabled

CompareFunction Ogre::Material::getDepthFunction void    const
 

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

See also:
setDepthFunction

bool Ogre::Material::getDepthWriteEnabled void    const
 

Returns whether or not this material renders with depth-buffer writing on or not.

See also:
setDepthWriteEnabled

SceneBlendFactor Ogre::Material::getDestBlendFactor   const
 

Retrieves the destination blending factor for the material (as set using Materiall::setSceneBlending).

const ColourValue & Ogre::Material::getDiffuse void    const
 

Gets the diffuse colour reflectance of the material.

const ColourValue & Ogre::Material::getFogColour void    const
 

Returns the fog colour for the scene.

Real Ogre::Material::getFogDensity void    const
 

Returns the fog density for this material.

Note:
Only valid if getFogOverride is true.

Real Ogre::Material::getFogEnd void    const
 

Returns the fog end distance for this material.

Note:
Only valid if getFogOverride is true.

FogMode Ogre::Material::getFogMode void    const
 

Returns the fog mode for this material.

Note:
Only valid if getFogOverride is true.

bool Ogre::Material::getFogOverride void    const
 

Returns true if this material is to override the scene fog settings.

Real Ogre::Material::getFogStart void    const
 

Returns the fog start distance for this material.

Note:
Only valid if getFogOverride is true.

int Ogre::Material::getHandle void    const
 

Returns the numerical handle for this material, if a more compact refence is required.

Note:
This handle will only be assigned after adding the material to the SceneManager. Before this time it will be zero.

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

Gets the last time the resource was 'touched'.

bool Ogre::Material::getLightingEnabled void    const
 

Returns whether or not dynamic lighting is enabled.

ManualCullingMode Ogre::Material::getManualCullingMode void    const
 

Retrieves the manual culling mode for this material.

See also:
setManualCullingMode

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

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

Reimplemented from Ogre::Resource.

int Ogre::Material::getNumTextureLayers void    const [inline]
 

Returns the number of texture layers.

const ColourValue & Ogre::Material::getSelfIllumination void    const
 

Gets the self illumination colour of the material.

ShadeOptions Ogre::Material::getShadingMode void    const
 

Returns the type of light shading to be used.

Real Ogre::Material::getShininess void    const
 

Gets the 'shininess' property of the material (affects specular highlights).

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

Retrieves info about the size of the resource.

SceneBlendFactor Ogre::Material::getSourceBlendFactor   const
 

Retrieves the source blending factor for the material (as set using Materiall::setSceneBlending).

const ColourValue & Ogre::Material::getSpecular void    const
 

Gets the specular colour reflectance of the material.

TextureFilterOptions Ogre::Material::getTextureFiltering void    const
 

Returns the type of texture filtering used when rendering.

Material::TextureLayer * Ogre::Material::getTextureLayer int    index const
 

Retrieves a pointer to a texture layer so it may be modified.

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

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

bool Ogre::Material::isTransparent void    const
 

Determines if the material has any transparency with the rest of the scene (derived from scene blending op).

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

Overridden from Resource.

Remarks:
By default, Material's load their resources on demand, ie. when you add a texture layer with a texture name, that texture is loaded straight away. However, the Material also supports deferred loading for scripts ie. a Material can have a full definition, but has not loaded any textures yet or set up any Controller objects for animation etc. In this case the 'load' method does all these things.

Implements Ogre::Resource.

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

Assignment operator to allow easy copying between materials.

void Ogre::Material::removeAllTextureLayers void   
 

Removes all texture layers.

void Ogre::Material::removeTextureLayer  
 

Removes the topmost texture layer from the material.

void Ogre::Material::setAmbient const ColourValue   ambient
 

Sets the ambient colour reflectance properties of this material.

Remarks:
The base colour of a material is determined by how much red, green and blue light is reflects (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how much ambient light (directionless global light) is reflected. The default is full white, meaning objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light effects, or change the blend of colours to make the object have a base colour other than white.
Note:
This setting has no effect if dynamic lighting is disabled (see Material::setLightingEnabled).

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

Sets the ambient colour reflectance properties of this material.

Remarks:
The base colour of a material is determined by how much red, green and blue light is reflects (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how much ambient light (directionless global light) is reflected. The default is full white, meaning objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light effects, or change the blend of colours to make the object have a base colour other than white.
Note:
This setting has no effect if dynamic lighting is disabled (see Material::setLightingEnabled).

void Ogre::Material::setCullingMode CullingMode    mode
 

Sets the culling mode for this material based on the 'vertex winding'.

Remarks:
A typical way for the rendering engine to cull triangles is based on the 'vertex winding' of triangles. Vertex winding refers to the direction in which the vertices are passed or indexed to in the rendering operation as viewed from the camera, and will wither be clockwise or anticlockwise (that's 'counterclockwise' for you Americans out there ;) The default is CULL_CLOCKWISE i.e. that only triangles whose vertices are passed/indexed in anticlockwise order are rendered - this is a common approach and is used in 3D studio models for example. You can alter this culling mode if you wish but it is not advised unless you know what you are doing.

You may wish to use the CULL_NONE option for mesh data that you cull yourself where the vertex winding is uncertain.

void Ogre::Material::setDepthBias ushort    bias
 

Sets the depth bias to be used for this material.

Remarks:
When polygons are coplanar, you can get problems with 'depth fighting' where the pixels from the two polys compete for the same screen pixel. This is particularly a problem for decals (polys attached to another surface to represent details such as bulletholes etc.).

A way to combat this problem is to use a depth bias to adjust the depth buffer value used for the decal such that it is slightly higher than the true value, ensuring that the decal appears on top.

Parameters:
bias  The bias value, should be between 0 and 16.

void Ogre::Material::setDepthCheckEnabled bool    enabled
 

Sets whether or not this material renders with depth-buffer checking on or not.

Remarks:
If depth-buffer checking is on, whenever a pixel is about to be written to the frame buffer the depth buffer is checked to see if the pixel is in front of all other pixels written at that point. If not, the pixel is not written.

If depth checking is off, pixels are written no matter what has been rendered before. Also see setDepthFunction for more advanced depth check configuration.

See also:
setDepthFunction

void Ogre::Material::setDepthFunction CompareFunction    func
 

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

Remarks:
If depth checking is enabled (see setDepthCheckEnabled) a comparison occurs between the depth value of the pixel to be written and the current contents of the buffer. This comparison is normally CMPF_LESS_EQUAL, i.e. the pixel is written if it is closer (or at the same distance) than the current contents. If you wish you can change this comparison using this method.

void Ogre::Material::setDepthWriteEnabled bool    enabled
 

Sets whether or not this material renders with depth-buffer writing on or not.

Remarks:
If depth-buffer writing is on, whenever a pixel is written to the frame buffer the depth buffer is updated with the depth value of that new pixel, thus affecting future rendering operations if future pixels are behind this one.

If depth writing is off, pixels are written without updating the depth buffer Depth writing should normally be on but can be turned off when rendering static backgrounds or when rendering a collection of transparent objects at the end of a scene so that they overlap each other correctly.

void Ogre::Material::setDiffuse const ColourValue   diffuse
 

Sets the diffuse colour reflectance properties of this material.

Remarks:
The base colour of a material is determined by how much red, green and blue light is reflects (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how much diffuse light (light from instances of the Light class in the scene) is reflected. The default is full white, meaning objects reflect the maximum white light they can from Light objects.
Note:
This setting has no effect if dynamic lighting is disabled (see Material::setLightingEnabled).

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

Sets the diffuse colour reflectance properties of this material.

Remarks:
The base colour of a material is determined by how much red, green and blue light is reflects (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how much diffuse light (light from instances of the Light class in the scene) is reflected. The default is full white, meaning objects reflect the maximum white light they can from Light objects.
Note:
This setting has no effect if dynamic lighting is disabled (see Material::setLightingEnabled).

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 this material.

Remarks:
Fogging is an effect that is applied as polys are rendered. Sometimes, you want fog to be applied to an entire scene. Other times, you want it to be applied to a few polygons only. This material-level specification of fog parameters lets you easily manage both.

The SceneManager class also has a setFog method which applies scene-level fog. This method lets you change the fog behaviour for this material compared to the standard scene-level fog.

Parameters:
overrideScene  If true, you authorise this material to override the scene's fog params with it's own settings. If you specify false, so other parameters are necessary, and this is the default behaviour for materials.
mode  Only applicable if overrideScene is true. You can disable fog which is turned on for the rest of the scene by specifying FOG_NONE. Otherwise, set a material-specific fog mode as defined in the enum FogMode.
colour  The colour of the fog. Either set this to the same as your viewport background colour, or to blend in with a skydome or skybox.
expDensity  The density of the fog in FOG_EXP or FOG_EXP2 mode, as a value between 0 and 1. The default is 0.001.
linearStart  Distance in world units at which linear fog starts to encroach. Only applicable if mode is FOG_LINEAR.
linearEnd  Distance in world units at which linear fog becomes completely opaque. Only applicable if mode is FOG_LINEAR.

void Ogre::Material::setLightingEnabled bool    enabled
 

Sets whether or not dynamic lighting is enabled.

Parameters:
enabled  If true, dynamic lighting is performed on geometry with normals supplied, geometry without normals will not be displayed.

If false, no lighting is applied and all geometry will be full brightness.

void Ogre::Material::setManualCullingMode ManualCullingMode    mode
 

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

@pemarks In some situations you want to use manual culling of triangles rather than sending the triangles to the hardware and letting it cull them. This setting only takes effect on SceneManager's that use it (since it is best used on large groups of planar world geometry rather than on movable geometry since this would be expensive), but if used can cull geometry before it is sent to the hardware.

Note:
The default for this setting is MANUAL_CULL_BACK.
Parameters:
mode  The mode to use - see enum ManualCullingMode for details

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

Allows very fine control of blending this material with the existing contents of the scene.

Remarks:
Wheras the texture blending operations seen in the TextureLayer class are concerned with blending between texture layers, this blending is about combining the output of the material as a whole with the existing contents of the rendering target. This blending therefore allows object transparency and other special effects.

This version of the method allows complete control over the blending operation, by specifying the source and destination blending factors. The result of the blending operation is: <span align="center"> final = (texture * sourceFactor) + (pixel * destFactor) </span>

Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor enumerated type.

Parameters:
sourceFactor  The source factor in the above calculation, i.e. multiplied by the texture colour components.
destFactor  The destination factor in the above calculation, i.e. multiplied by the pixel colour components.

void Ogre::Material::setSceneBlending const SceneBlendType    sbt
 

Sets the kind of blending this material has with the existing contents of the scene.

Remarks:
Wheras the texture blending operations seen in the TextureLayer class are concerned with blending between texture layers, this blending is about combining the output of the material as a whole with the existing contents of the rendering target. This blending therefore allows object transparency and other special effects.

This method allows you to select one of a number of predefined blending types. If you require more control than this, use the alternative version of this method which allows you to specify source and destination blend factors.

Parameters:
sbt  One of the predefined SceneBlendType blending types

void Ogre::Material::setSelfIllumination const ColourValue   selfIllum
 

Sets the amount of self-illumination an object has.

Remarks:
If an object is self-illuminating, it does not need external sources to light it, ambient or otherwise. It's like the object has it's own personal ambient light. This property is rarely useful since you can already specify per-material ambient light, but is here for completeness.

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

Sets the amount of self-illumination an object has.

Remarks:
If an object is self-illuminating, it does not need external sources to light it, ambient or otherwise. It's like the object has it's own personal ambient light. This property is rarely useful since you can already specify per-material ambient light, but is here for completeness.

void Ogre::Material::setShadingMode ShadeOptions    mode
 

Sets the type of light shading required.

Note:
The default shading method is Gouraud shading.

void Ogre::Material::setShininess Real    val
 

Sets the shininess of the material, affecting the size of specular highlights.

void Ogre::Material::setSpecular const ColourValue   specular
 

Sets the specular colour reflectance properties of this material.

Remarks:
The base colour of a material is determined by how much red, green and blue light is reflects (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how much specular light (highlights from instances of the Light class in the scene) is reflected. The default is to reflect no specular light.
Note:
The size of the specular highlights is determined by the separate 'shininess' property.

This setting has no effect if dynamic lighting is disabled (see Material::setLightingEnabled).

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

Sets the specular colour reflectance properties of this material.

Remarks:
The base colour of a material is determined by how much red, green and blue light is reflects (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how much specular light (highlights from instances of the Light class in the scene) is reflected. The default is to reflect no specular light.
Note:
The size of the specular highlights is determined by the separate 'shininess' property.

This setting has no effect if dynamic lighting is disabled (see Material::setLightingEnabled).

void Ogre::Material::setTextureFiltering TextureFilterOptions    mode
 

Sets the type of texture filtering used when rendering.

Remarks:
This method sets the kind of texture filtering applied when rendering textures onto primitives. Filtering covers how the effects of minification and magnification are disguised by resampling.

void Ogre::Resource::touch void    [inline, inherited]
 

'Touches' the resource to indicate it has been used.

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

Overridden from Resource.

See also:
Resource

Reimplemented from Ogre::Resource.


Friends And Related Function Documentation

friend class MaterialManager [friend]
 

friend class SceneManager [friend]
 


Member Data Documentation

ColourValue Ogre::Material::mAmbient [protected]
 

CullingMode Ogre::Material::mCullMode [protected]
 

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

Default material settings - set up by SceneManager.

bool Ogre::Material::mDeferLoad [protected]
 

If true, loading of textures and setting up controllers is deferred until the 'load' method is called.

ushort Ogre::Material::mDepthBias [protected]
 

bool Ogre::Material::mDepthCheck [protected]
 

CompareFunction Ogre::Material::mDepthFunc [protected]
 

bool Ogre::Material::mDepthWrite [protected]
 

SceneBlendFactor Ogre::Material::mDestBlendFactor [protected]
 

ColourValue Ogre::Material::mDiffuse [protected]
 

ColourValue Ogre::Material::mEmissive [protected]
 

ColourValue Ogre::Material::mFogColour [protected]
 

Real Ogre::Material::mFogDensity [protected]
 

Real Ogre::Material::mFogEnd [protected]
 

FogMode Ogre::Material::mFogMode [protected]
 

bool Ogre::Material::mFogOverride [protected]
 

Real Ogre::Material::mFogStart [protected]
 

int Ogre::Material::mHandle [protected]
 

Numerical handle (constant).

Remarks:
This is assigned automatically, and is useful where small system indexes to materials are needed.

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

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

bool Ogre::Material::mLightingEnabled [protected]
 

Lighting enabled?

ManualCullingMode Ogre::Material::mManualCullMode [protected]
 

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

int Ogre::Material::mNumTextureLayers [protected]
 

Number of texture layers.

ShadeOptions Ogre::Material::mShadeOptions [protected]
 

Shading options.

Real Ogre::Material::mShininess [protected]
 

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

SceneBlendFactor Ogre::Material::mSourceBlendFactor [protected]
 

ColourValue Ogre::Material::mSpecular [protected]
 

TextureFilterOptions Ogre::Material::mTextureFiltering [protected]
 

Texture filtering.

TextureLayer Ogre::Material::mTextureLayers[OGRE_MAX_TEXTURE_LAYERS] [protected]
 

Copyright © 2002 by The OGRE Team