次の方法で共有


Retrieving Light Properties (Windows Embedded CE 6.0)

1/6/2010

You can retrieve all the properties for an existing light source from C++ by calling the IDirect3DMobileDevice::GetLight method for the device. When calling the GetLight method, pass in the first parameter the zero-based index of the light source for which the properties will be retrieved, and supply the address of a D3DMLIGHT structure in the second parameter. The device fills the D3DMLIGHT structure to describe the lighting properties it uses for the light source at that index.

The following code example shows this process.

/*
 * For the purposes of this example, the pd3dmDevice variable
 * is a valid pointer to an IDirect3DMobileDevice interface.
 */
HRESULT hr;
D3DMLIGHT light;

// Get the property information for the first light.
hr = pd3dmDevice->GetLight(0, &light);
if (FAILED(hr))
{
    // Code to handle the error goes here.
}

If you supply an index outside the range of the light sources assigned in the device, the GetLight method fails, returning D3DMERR_INVALIDCALL (see D3DMERR Values).

See Also

Concepts

Using Lights