RenderWare V2.1

Previous Page Index Next Page

RwPolygon3d *

RwSetPolygonMaterialModes(RwPolygon3d *polygon,
RwMaterialModes modes);

Description

Sets the Material modes of a polygon’s material. Material modes permit fine grain control over the rendering of Materials.

Arguments

polygon Pointer to the polygon.

modes A bitfield representing a Material mode (or "bitwise or" of modes).

Return Value

The argument polygon if successful, and NULL otherwise.

Comments

The following material modes are supported:

• rwDOUBLE The material will be rendered double sided.

For further information see the Material Modes section in Chapter 2: Data Types.

Unlike RwAddMaterialModeToPolygon(), which simply adds one or more Material modes to a polygon’s material’s set of modes, RwSetPolygonMaterialModes() replaces a polygon’s material’s entire set of modes with those specified.

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

RwSetMaterialModes(RwGetPolygonMaterial(polygon),
modes);

See Also

RwAddMaterialModeToMaterial()

RwAddMaterialModeToPolygon()

RwAddMaterialModeToSurface()

RwGetMaterialModes()

RwGetPolygonMaterialModes()

RwRemoveMaterialModeFromMaterial()

RwRemoveMaterialModeFromPolygon()

RwRemoveMaterialModeFromSurface()

RwSetMaterialModes()

RwSetPolygonMaterialModes()

RwSetSurfaceMaterialModes()