Microsoft DirectX 8.0 (C++)

Light Color Types and Sources

Light sources in Microsoft® Direct3D® emit diffuse, ambient, and specular colors as distinct light components that factor into lighting computations independently of each other. Similarly, the vertices that the system renders can use discrete diffuse, ambient, specular, and emissive colors, as defined by their vertex format.

For a C++ application, these vertex colors are used by the system only when you set the D3DRS_COLORVERTEX render state to TRUE. Vertex color sources are selectable; that is, you can configure the system to select the source for the vertex-color portions of lighting formulas at run time. The D3DRS_AMBIENTMATERIALSOURCE, D3DRS_DIFFUSEMATERIALSOURCE, and D3DRS_SPECULARMATERIALSOURCE render states control the source from which the system draws the associated colors during lighting calculations. You can set each render state to a member of the D3DMATERIALCOLORSOURCE enumerated type, which defines values that cause the system to use the current material, or a color from the vertex, as the color source.