Applications use the methods of the Direct3DRMLight interface to interact with light objects.
The methods of the Direct3DRMLight interface can be organized into the following groups.
Attenuation GetConstantAttenuation GetLinearAttenuation GetQuadraticAttenuation SetConstantAttenuation SetLinearAttenuation SetQuadraticAttenuation Color GetColor SetColor SetColorRGB Enable frames GetEnableFrame SetEnableFrame Light types GetType SetType Range GetRange SetRange Spotlight options GetPenumbra GetUmbra SetPenumbra SetUmbra
The Direct3DRMLight interface inherits the following methods from the Direct3DRMObject interface.
Obtain the Direct3DRMLight object by using the Direct3DRM3.CreateLight or Direct3DRM3.CreateLightRGB method.
Retrieves the color of the current Direct3DRMLight object.
Syntax
object.GetColor( ) As Long
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns the color.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the constant attenuation factor for the Direct3DRMLight object.
Syntax
object.GetConstantAttenuation( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns the constant attenuation value.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
Lights that have a location (those that are not infinitely far away) can have attenuation factors to calculate the attenuation of the light based on the distance from the light.
The formula for the total attenuation factor is:
1 / [constant_attenuation_factor + distance * linear_attenuation_factor + (distance**2) * quadratic_attenuation_factor]
The total attenuation factor cannot be greater than 1. When attenuation factors are not provided, the default values are 1.0 for the constant attenuation factor, 0.0 for the linear attenuation factor, and 0.0 for the quadratic attenuation factor.
See Also
Retrieves the enable frame for a light.
Syntax
object.GetEnableFrame( ) As Direct3DRMFrame3
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns a Direct3DRMFrame3 object if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the linear attenuation factor for a light.
Syntax
object.GetLinearAttenuation( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns the linear attenuation value.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
Lights that have a location (those that are not infinitely far away) can have attenuation factors to calculate the attenuation of the light based on distance from the light.
The formula for the total attenuation factor is:
1 / [constant_attenuation_factor + distance * linear_attenuation_factor + (distance**2) * quadratic_attenuation_factor]
The total attenuation factor cannot be greater than 1. When attenuation factors are not provided, the default values are 1.0 for the constant attenuation factor, 0.0 for the linear attenuation factor, and 0.0 for the quadratic attenuation factor.
See Also
Retrieves the penumbra angle of a spotlight.
Syntax
object.GetPenumbra( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns the penumbra value in radians.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the quadratic attenuation factor for a light.
Syntax
object.GetQuadraticAttenuation( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns the quadratic attenuation value.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
Lights that have a location (those that are not infinitely far away) can have attenuation factors to calculate the attenuation of the light based on distance from the light.
The formula for the total attenuation factor is:
1 / [constant_attenuation_factor + distance * linear_attenuation_factor + (distance**2) * quadratic_attenuation_factor]
The total attenuation factor cannot be greater than 1. When attenuation factors are not provided, the default values are 1.0 for the constant attenuation factor, 0.0 for the linear attenuation factor, and 0.0 for the quadratic attenuation factor.
See Also
Retrieves the range of the current Direct3DRMLight object.
Syntax
object.GetRange( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns a value describing the range.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the type of a given light.
Syntax
object.GetType( ) As CONST_D3DRMLIGHTTYPE
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns one of the members of the CONST_D3DRMLIGHTTYPE enumerated type.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the umbra angle of the Direct3DRMLight object. The default is 0.4 radians.
Syntax
object.GetUmbra( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
Return Value
Returns the umbra angle in radians.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Sets the color of the given light.
Syntax
object.SetColor(c As Long)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- c
- New color for the light. Make sure to set the alpha component as well as the red, green, and blue color components or your objects might not be visible. Colors are represented by a Long, consisting of 4 bytes. The high byte is the alpha component and the subsequent bytes define red, green, and blue. Use CreateColorRGBA from the DirectX7 object to more easily construct a color or use SetColorRGB if you only want full alpha.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add a color key to a Direct3DRMLightInterpolator object.
See Also
Sets the red, green, and blue color components of the given light.
Syntax
object.SetColorRGB(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- r, g, and b
- New color for the light.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add an RGB color key to a Direct3DRMLightInterpolator object.
Sets the constant attenuation factor for a light.
Syntax
object.SetConstantAttenuation(atn As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- atn
- New constant attenuation factor.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
Lights that have a location (those that are not infinitely far away) can have attenuation factors to calculate the attenuation of the light based on the distance from the light.
The formula for the total attenuation factor is:
1 / [constant_attenuation_factor + distance * linear_attenuation_factor + (distance**2) * quadratic_attenuation_factor]
The total attenuation factor cannot be greater than 1. When attenuation factors are not provided, the default values are 1.0 for the constant attenuation factor, 0.0 for the linear attenuation factor, and 0.0 for the quadratic attenuation factor.
This method is also used to add a constant attenuation key to a Direct3DRMLightInterpolator object.
See Also
Sets the enable frame for a light.
Syntax
object.SetEnableFrame(f As Direct3DRMFrame3)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- f
- Direct3DRMFrame3 interface for the Direct3DRMLight object. Child frames of this frame are also enabled for this light source.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Sets the linear attenuation factor for a light.
Syntax
object.SetLinearAttenuation(atn As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- atn
- New linear attenuation factor.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
Lights that have a location (those that are not infinitely far away) can have attenuation factors to calculate the attenuation of the light based on distance from the light.
The formula for the total attenuation factor is:
1 / [constant_attenuation_factor + distance * linear_attenuation_factor + (distance**2) * quadratic_attenuation_factor]
The total attenuation factor cannot be greater than 1. When attenuation factors are not provided, the default values are 1.0 for the constant attenuation factor, 0.0 for the linear attenuation factor, and 0.0 for the quadratic attenuation factor.
This method is also used to add a linear attenuation key to a Direct3DRMLightInterpolator object.
See Also
Sets the angle of the penumbra cone.
Syntax
object.SetPenumbra(p As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- p
- New penumbra angle in radians. This angle must be greater than or equal to the angle of the umbra. If you set the penumbra angle to less than the umbra angle, the umbra angle will be set equal to the penumbra angle. The default value is 0.5 radians.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add a penumbra angle key to a Direct3DRMLightInterpolator object.
See Also
Sets the quadratic attenuation factor for a light.
Syntax
object.SetQuadraticAttenuation(atn As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- atn
- New quadratic attenuation factor.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
Lights that have a location (those that are not infinitely far away) can have attenuation factors to calculate the attenuation of the light based on distance from the light.
The formula for the total attenuation factor is:
1 / [constant_attenuation_factor + distance * linear_attenuation_factor + (distance**2) * quadratic_attenuation_factor]
The total attenuation factor cannot be greater than 1. When attenuation factors are not provided, the default values are 1.0 for the constant attenuation factor, 0.0 for the linear attenuation factor, and 0.0 for the quadratic attenuation factor.
This method is also used to add a quadratic attenuation key to a Direct3DRMLightInterpolator object.
See Also
Sets the range of a spotlight. The light affects objects that are within the range only.
Syntax
object.SetRange(mg As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- mg
- New range. The default value is 256 modeling-space units.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
The range property is for spotlights only. This method is also used to add a range key to a Direct3DRMLightInterpolator object.
See Also
Changes the light's type.
Syntax
object.SetType(t As CONST_D3DRMLIGHTTYPE)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- t
- New light type specified by one of the members of the CONST_D3DRMLIGHTTYPE enumerated type.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Sets the angle of the umbra cone.
Syntax
object.SetUmbra(u As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMLight object.
- u
- New umbra angle in radians. This angle must be less than or equal to the angle of the penumbra. If you set the umbra angle to greater than the penumbra angle, the penumbra angle will be set equal to the umbra angle. The default value is 0.4 radians.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add an umbra angle key to a Direct3DRMLightInterpolator object.
See Also
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.