# D3DMLIGHT (Windows CE 5.0)

### In this article

This structure is used to describe lights in Direct3D Mobile.

```
typedef struct _D3DMLIGHT { D3DMLIGHTTYPE Type; D3DMCOLORVALUE Diffuse; D3DMCOLORVALUE Specular; D3DMCOLORVALUE Ambient; D3DMVECTOR Position; D3DMVECTOR Direction; float Range; float Attenuation0; float Attenuation1; float Attenuation2;} D3DMLIGHT;
```

#### Members

**Type**

A D3DMLIGHTTYPE enumeration value describing the type of light.**Diffuse**

A D3DMCOLORVALUE structure describing the color of the light's contribution to the diffuse light present in the scene.**Specular**

A**D3DMCOLORVALUE**structure describing the color of the light's contribution to the specular light present in the scene.**Ambient**

A**D3DMCOLORVALUE**structure describing the color of the light's contribution to the ambient light present in the scene.**Position**

A D3DMVECTOR structure describing the position of the light in world space. The vector's members are in IEEE 32-bit floating point, and w is assumed to be equal to 1.0. This vector is only valid for point lights.**Direction**

A**D3DMVECTOR**structure describing the direction that the light is facing. This vector is only valid for directional lights.**Range**

A float value describing the distance at which output from a light is cut off. This is a floating point scalar in world space and only applicable for point lights.**Attenuation0**

Afloat value describing the linear light attenuation parameter for calculating the attenuation factor in the lighting equation. The range of this value is zero to positive infinity. See the Remarks section.**Attenuation1**

A float value describing the squared attenuation parameter for calculating the attenuation factor in the lighting equation. The range of this value is zero to positive infinity. See the Remarks section.**Attenuation2**

A float value describing the exponential attenuation parameter for calculating the attenuation factor in the lighting equation. The range of this value is zero to positive infinity. See the Remarks section.

#### Remarks

The members of the **D3DMCOLORVALUE** and **D3DMVECTOR** structures are of the D3DMVALUE type. Therefore, they can be either IEEE 32 bit floating point values or16.16 fixed point values. You must provide the interpretations for these members' values by setting the D3DMFORMAT value in any method calls that use **D3DMLIGHT**.

The attenuation members are values that specify how light intensity changes over distance. Attenuation values are ignored for directional lights. These members represent attenuation constants. For information on attenuation, see Lighting Equations. Valid values for these members range from 0.0 to positive infinity. For non-directional lights, all three attenuation values should not be set to 0.0 at the same time.

#### Requirements

**OS Versions:** Windows CE 5.0 and later.

**Header:** D3dmtypes.h.

#### See Also

Send Feedback on this topic to the authors