?/TD> |
Microsoft DirectX 9.0 |
Usually material colors are used for lighting. However, you can specify that material colors—emissive, ambient, diffuse, and specular—are to be overridden by diffuse or specular vertex colors. This is done by calling IDirect3DDevice9::SetRenderState and setting the device state variables listed in the following table.
Device state variable | Meaning | Type | Default |
---|---|---|---|
D3DRS_AMBIENTMATERIALSOURCE | Defines where to get ambient material color. | D3DMATERIALCOLORSOURCE | D3DMCS_MATERIAL |
D3DRS_DIFFUSEMATERIALSOURCE | Defines where to get diffuse material color. | D3DMATERIALCOLORSOURCE | D3DMCS_COLOR1 |
D3DRS_SPECULARMATERIALSOURCE | Defines where to get specular material color. | D3DMATERIALCOLORSOURCE | D3DMCS_COLOR2 |
D3DRS_EMISSIVEMATERIALSOURCE | Defines where to get emissive material color. | D3DMATERIALCOLORSOURCE | D3DMCS_MATERIAL |
D3DRS_COLORVERTEX | Disables or enables use of vertex colors. | BOOL | TRUE |
The alpha/transparency value always comes only from the diffuse color's alpha channel.
The fog value always comes only from the specular color's alpha channel.
D3DMATERIALCOLORSOURCE can have the following values.