Direct3DRMLight

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.

Direct3DRMLight.GetColor

Direct3DRMLight

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

Direct3DRMLight.SetColor

Direct3DRMLight.GetConstantAttenuation

Direct3DRMLight

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

Direct3DRMLight.SetConstantAttenuation

Direct3DRMLight.GetEnableFrame

Direct3DRMLight

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

Direct3DRMLight.SetEnableFrame

Direct3DRMLight.GetLinearAttenuation

Direct3DRMLight

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

Direct3DRMLight.SetLinearAttenuation

Direct3DRMLight.GetPenumbra

Direct3DRMLight

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

Direct3DRMLight.SetPenumbra

Direct3DRMLight.GetQuadraticAttenuation

Direct3DRMLight

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

Direct3DRMLight.SetQuadraticAttenuation

Direct3DRMLight.GetRange

Direct3DRMLight

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

Direct3DRMLight.SetRange

Direct3DRMLight.GetType

Direct3DRMLight

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

Direct3DRMLight.SetType

Direct3DRMLight.GetUmbra

Direct3DRMLight

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

Direct3DRMLight.SetUmbra

Direct3DRMLight.SetColor

Direct3DRMLight

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

Direct3DRMLight.GetColor

Direct3DRMLight.SetColorRGB

Direct3DRMLight

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.

Direct3DRMLight.SetConstantAttenuation

Direct3DRMLight

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

Direct3DRMLight.GetConstantAttenuation

Direct3DRMLight.SetEnableFrame

Direct3DRMLight

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

Direct3DRMLight.GetEnableFrame

Direct3DRMLight.SetLinearAttenuation

Direct3DRMLight

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

Direct3DRMLight.GetLinearAttenuation

Direct3DRMLight.SetPenumbra

Direct3DRMLight

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

Direct3DRMLight.GetPenumbra

Direct3DRMLight.SetQuadraticAttenuation

Direct3DRMLight

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

Direct3DRMLight.GetQuadraticAttenuation

Direct3DRMLight.SetRange

Direct3DRMLight

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

Direct3DRMLight.GetRange

Direct3DRMLight.SetType

Direct3DRMLight

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

Direct3DRMLight.GetType

Direct3DRMLight.SetUmbra

Direct3DRMLight

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

Direct3DRMLight.GetUmbra


Top of Page Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.