Code: Select all
D3DRS_CULLMODE
Specifies how back-facing triangles are culled, if at all. This can be set to one member of the D3DCULL enumerated type. The default value is D3DCULL_CCW.
Code: Select all
if (resetAllRenderstates || (lastmaterial.FrontfaceCulling != material.FrontfaceCulling) || (lastmaterial.BackfaceCulling != material.BackfaceCulling))
{
if (material.FrontfaceCulling && material.BackfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW|D3DCULL_CCW);
else
if (material.FrontfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
else
if (material.BackfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
else
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
Honestly, I would have expected BackcaceCulling to be changed to CullMode and three seperate values added. This is compatible with both OpenGL and D3D, and can be easily imlemented in the software driver for consistency.
Travis