52
Chapter 3: Specifying the Appearance of Geometries
Shininess describes how much of the surroundings are reflected by an object, for example,
a mirror would have a large shininess value so that surrounding objects would be seen
in it. Values range from 0.0, for a very dull surface, to 1.0, for a highly polished surface.
The default value is 0.2.
Transparency describes how opaque or clear an object is, for example, water might be
more clear than opaque. Values range from 0.0, for opaque, to 1.0, for complete
transparency. The default value is 0.0.
Material Example
The following example shows the material settings for gold:
csMaterial *gold = new csMaterial;
gold->setAmbientColor(.3, .1, .1);
gold->setDiffuseColor(.8, .7, .2);
gold->setSpecularColor(.4, .3, .1);
gold->setShininess(.4);
Since gold is opaque, the default value, 0.0, for transparency suffices.
Filling Geometries
The setPolyMode() method specifies how to render the elementary polygons that
compose a geometry. The following values for the method are valid:
POINT_PMODE
The polygon is rendered as points.
LINE_PMODE
The polygon is rendered as a line. This option is equivalent to rendering
the geometry as a wireframe.
FILL_PMODE
The polygon is rendered as filled.
For example, if you use POINT_PMODE, a triangle would appear as three points.
LINE_PMODE would render a triangle as a set of three lines; FILL_PMODE would
render the triangle as filled.