Material Settings
51
Material Settings
The material field in csAppearance defines the surface qualities of a geometry, such as
how well it reflects light, what color it reflects, and what color it emits. The material field
is of type csMaterial, which has the following set...() methods:
void setAmbientIntensity(csFloat ambientintensity);
void setAmbientColor (const csVec3f& ambientColor);
void setDiffuseColor(const csVec3f& diffuseColor);
void setDiffuseColor(float v0, float v1, float v2);
void setSpecularColor(const csVec3f& specularColor);
void setSpecularColor(float v0, float v1, float v2);
void setEmissiveColor(const csVec3f& emissiveColor);
void setEmissiveColor(float v0, float v1, float v2);
void setAmbientIndex(csShort ambientIndex);
void setDiffuseIndex(csShort diffuseIndex);
void setSpecularIndex(csShort specularIndex);
void setShininess(csFloat shininess);
void setTransparency(csFloat transparency);
csMaterial also has a corresponding set of get...() methods.
Ambient color is the color of the light reflected from an object when lit by another ambient
object in the scene. The default value is [0.2, 0.2, 0.2]. Ambient intensity refers to the
strength of the reflection—a value between 0.0 and 1.0 where 1.0 is a strong reflection.
Ambient index refers to a color lookup table in which each ambient color is paired with
an index number for easy look-ups.
Diffuse color is an object’s base color. The default value is [0.8, 0.8, 0.8]. Diffuse index
refers to a color lookup table in which each diffuse color is paired with an index number
for easy look-ups.
Specular color is the reflected color of an object’s highlights. Specular intensity refers to
the strength of the reflection. The default value is [0.0, 0.0, 0.0]. Specular index refers to a
color lookup table in which each specular color is paired with an index number for easy
look ups.
Emissive color is the color emitted by an object. A lamp shade for example, might have a
base color of yellow. When the lamp is turned on, however, the emissive color might be
white. The default value is [0.0, 0.0, 0.0].