RenderWare V2.1

Previous Page Index Next Page

RwPolygon3d *

RwSetPolygonColor(RwPolygon3d *polygon,
RwReal r, RwReal g, RwReal b);

Description

Sets the color of the polygon’s material.

Arguments

polygon Pointer to the polygon.

r Red component of the color, in the range CREAL(0.0) to CREAL(1.0).

g Green component of the color, in the range CREAL(0.0) to CREAL(1.0).

b Blue component of the color, in the range CREAL(0.0) to CREAL(1.0).

Return Value

The argument polygon if successful, and NULL otherwise.

Comments

This function is identical to RwSetPolygonColorStruct() with the exception that it takes individual RwReals for the red, green and blue components of the color rather than an RwRGBColor structure as the color specification.

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 RwSetMaterialColor() 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:

RwSetMaterialColor(RwGetPolygonMaterial(polygon), r, g, b);

See Also

RwSetMaterialColor()

RwSetMaterialColorStruct()

RwSetPolygonColorStruct()

RwSetSurfaceColor()