Platform SDK: DirectX

D3DLIGHT7

The D3DLIGHT7 structure defines a set of lighting properties. This structure is used with the IDirect3DDevice7::GetLight and IDirect3DDevice7::SetLight methods.

typedef struct _D3DLIGHT7 {
    D3DLIGHTTYPE    dltType;            
    D3DCOLORVALUE   dcvDiffuse;         
    D3DCOLORVALUE   dcvSpecular;        
    D3DCOLORVALUE   dcvAmbient;         
    D3DVECTOR       dvPosition;         
    D3DVECTOR       dvDirection;        
    D3DVALUE        dvRange;            
    D3DVALUE        dvFalloff;          
    D3DVALUE        dvAttenuation0;     
    D3DVALUE        dvAttenuation1;     
    D3DVALUE        dvAttenuation2;     
    D3DVALUE        dvTheta;            
    D3DVALUE        dvPhi;              
} D3DLIGHT7, *LPD3DLIGHT7;

Members

dltType
Type of the light source. This value is one of the members of the D3DLIGHTTYPE enumerated type.
dcvDiffuse
Diffuse color emitted by the light. This member is a D3DCOLORVALUE structure.
dcvSpecular
Specular color emitted by the light. This member is a D3DCOLORVALUE structure.
dcvAmbient
Ambient color emitted by the light. This member is a D3DCOLORVALUE structure.
dvPosition
Position of the light in world space. This member has no meaning for directional lights and is ignored in that case.
dvDirection
Direction that the light is pointing in world space. This member only has meaning for directional and spotlights. This vector need not be normalized, but it should have a nonzero length.
dvRange
Distance beyond which the light has no effect. The maximum allowable value for this member is D3DLIGHT_RANGE_MAX, which is defined as the square root of FLT_MAX. This member does not affect directional lights.
dvFalloff
Decrease in illumination between a spotlight's inner cone (the angle specified by dvTheta ) and the outer edge of the outer cone (the angle specified by dvPhi ). This feature was implemented for DirectX 5.0. For details on how dvFalloff values affect a spotlight, see Spotlight Falloff Model.

The effect of falloff on the lighting is subtle. Furthermore, a small performance penalty is incurred by shaping the falloff curve. For these reasons, most developers set this value to 1.0.

dvAttenuation0, dvAttenuation1, and dvAttenuation2
Values specifying how the light intensity changes over distance. (Attenuation does not affect directional lights.) These members represent attenuation constants. For information about how these attenuation values affect lighting in a scene, see Light Attenuation Over Distance. Valid values for these members range from 0.0 to infinity.
dvTheta
Angle, in radians, of a spotlight's inner cone—that is, the fully illuminated spotlight cone. This value must be in the range from 0 through the value specified by dvPhi.
dvPhi
Angle, in radians, defining the outer edge of the spotlight's outer cone. Points outside this cone are not lit by the spotlight. This value must be between 0 and pi.

Remarks

This structure, introduced with DirectX 7.0, supersedes the D3DLIGHT2 and D3DLIGHT structures used with previous versions of DirectX.

This structure differs from the D3DLIGHT2 structure in that it provides members for independent diffuse, specular, and ambient colors of a light. Each color value is used in the lighting module of Direct3D Immediate Mode to determine the lighting in a scene.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dtypes.h.

See Also

IDirect3DDevice7::GetLight, IDirect3DDevice7::SetLight, D3DLIGHTTYPE, Lighting and Materials