Enabling and Disabling Lights (Windows CE 5.0)
Once you assign a set of light properties for a light source in a scene, the light source can be activated by calling the IDirect3DMobileDevice::LightEnable method for the device. New light sources are disabled by default. The LightEnable method accepts two parameters. Set the first parameter to the zero-based index of the light source to be affected by the method, and set the second parameter to TRUE to enable the light or FALSE to disable it.
The following code example shows the use of this method by enabling the first light source in the device's list of light source properties.
/*
* For the purposes of this example, the d3dmDevice variable
* is a valid pointer to an IDirect3DMobileDevice interface.
*/
HRESULT hr;
hr = pd3dmDevice->LightEnable(0, TRUE);
if (FAILED(hr))
{
// Code to handle the error goes here.
}
If you enable or disable a light that has no properties that are set with IDirect3DMobileDevice::SetLight, the LightEnable method creates a light source with the properties shown in following table and enables or disables it.
Member | Default |
---|---|
Type | D3DLIGHT_DIRECTIONAL |
Diffuse | (R:1, G:1, B:1, A:0) |
Specular | (R:0, G:0, B:0, A:0) |
Ambient | (R:0, G:0, B:0, A:0) |
Position | (0, 0, 0) |
Direction | (0, 0, 1) |
Range | 0 |
Falloff | 0 |
Attenuation0 | 0 |
Attenuation1 | 0 |
Attenuation2 | 0 |
Theta | 0 |
Phi | 0 |
See Also
Send Feedback on this topic to the authors