RenderWare V2.1

Previous Page Index Next Page

RwPolygon3d *

RwSetPolygonTextureModes(RwPolygon3d *polygon, RwTextureModes modes);

Description

Sets the texture modes of a polygon’s material. Texture modes permit fine grain control over the rendering of textures.

Arguments

polygon Pointer to the polygon.

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

Return Value

The argument polygon if successful, and NULL otherwise.

Comments

The texture modes are:

• rwLIT The texture will be lit according to the current light sampling type of the material (rwFACET or rwVERTEX).

• rwFORESHORTEN The texture will be foreshortened in a perspectively correct manner.

• rwFILTER A filter will be applied to the texture to reduce the effect of pixelation due to aliasing.

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

Unlike RwAddTextureModeToPolygon(), which simply adds one or more texture modes to a polygon’s material’s set of modes, RwSetPolygonTextureModes() 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 RwSetMaterialTextureModes() 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:

RwSetMaterialTextureModes(RwGetPolygonMaterial(polygon),
modes);

See Also

RwAddTextureModeToPolygon()

RwGetPolygonTextureModes()

RwRemoveTextureModeFromPolygon()

RwSetMaterialTextureModes()

RwSetPolygonLightSampling()

RwSetPolygonTexture()

RwSetSurfaceTextureModes()