RenderWare V2.1

Previous Page Index Next Page

RwPolygon3d *

RwSetPolygonColorStruct(RwPolygon3d *polygon, RwRGBColor *color);

Description

Sets the color of the polygon’s material.

Arguments

polygon Pointer to the polygon.

color Pointer to the color.

Return Value

The argument polygon if successful, and NULL otherwise.

Comments

This function is identical to RwSetPolygonColor() with the exception that it takes an RwRGBColor structure as the color specification rather than individual RwReals for the red, green and blue components of the color. This can be useful as a call-back in RwForAll…() functions.

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

RwSetMaterialColorStruct(RwGetPolygonMaterial(polygon), color);

See Also

RwGetPolygonColor()

RwSetMaterialColor()

RwSetMaterialColorStruct()

RwSetPolygonColor()

RwSetSurfaceColor()