RenderWare V2.1

Previous Page Index Next Page

RwPolygon3d *

RwSetPolygonSurface(RwPolygon3d *polygon, RwReal ka, RwReal kd, RwReal ks);

Description

Sets the surface attributes (ambient, diffuse, and specular reflection coefficients) of the polygon’s material.

Arguments

polygon Pointer to the polygon.

ka Ambient reflection coefficient in the range CREAL(0.0) to CREAL(1.0).

kd Diffuse reflection coefficient in the range CREAL(0.0) to CREAL(1.0).

ks Specular reflection coefficient in the range CREAL(0.0) to CREAL(1.0).

Return Value

The argument polygon if successful, and NULL otherwise.

Comments

RenderWare optimizes memory usage by sharing materials across multiple polygons. Setting a polygon material property with this function will cause the polygon to have it’s own copy of the material, not shared by any other polygons. Unless this is the desired effect, it is more memory efficient to use the corresponding material function RwSetMaterialSurface() to change the underlying polygon material. This change will then be propagated to all polygons which use the material. The following line of code demonstrates how this is achieved:

RwSetMaterialSurface(RwGetPolygonMaterial(polygon),
ka, kd, ks);

See Also

RwGetPolygonAmbient()

RwGetPolygonDiffuse()

RwGetPolygonSpecular()

RwSetMaterialSurface()

RwSetPolygonAmbient()

RwSetPolygonDiffuse()

RwSetPolygonSpecular()

RwSetSurface()