C# Class Axiom.Core.Light

Representation of a dynamic light source in the scene.
Lights are added to the scene like any other object. They contain various parameters like type, position, attenuation (how light intensity fades with distance), color etc.

The defaults when a light is created is pure white diffuse light, with no attenuation (does not decrease with distance) and a range of 1000 world units.

Lights are created by using the SceneManager.CreateLight method. They can subsequently be added to a SceneNode if required to allow them to move relative to a node in the scene. A light attached to a SceneNode is assumed to have a base position of (0,0,0) and a direction of (0,0,1) before modification by the SceneNode's own orientation. If note attached to a SceneNode, the light's position and direction is as set using Position and Direction.

Remember also that dynamic lights rely on modifying the color of vertices based on the position of the light compared to an object's vertex normals. Dynamic lighting will only look good if the object being lit has a fair level of tesselation and the normals are properly set. This is particularly true for the spotlight which will only look right on highly tessellated models.

Inheritance: Axiom.Core.MovableObject, IComparable
Datei anzeigen Open project: mono-soc-2011/axiom Class Usage Examples

Public Properties

Property Type Description
DefaultDirection Vector3
animableAttributes string[]

Protected Properties

Property Type Description
attenuationConst float
attenuationLinear float
attenuationQuad float
derivedDirection Vector3
derivedPosition Vector3
diffuse ColorEx
direction Vector3
frustumClipVolumes PlaneBoundedVolumeList
lastParentOrientation Axiom.Math.Quaternion
lastParentPosition Vector3
localTransformDirty bool
nearClipVolume Axiom.Math.PlaneBoundedVolume
ownShadowFarDistance bool
position Vector3
powerScale Real
range float
shadowFarDistance Real
shadowFarDistanceSquared Real
specular ColorEx
spotFalloff float
spotInner float
spotOuter float
tempSquaredDist float
type LightType

Public Methods

Method Description
CompareTo ( object obj ) : int

Used to compare this light to another light for sorting.

CreateAnimableValue ( string valueName ) : Axiom.Animating.AnimableValue
GetAs4DVector ( ) : Vector4

Gets the details of this light as a 4D vector.

Getting details of a light as a 4D vector can be useful for doing general calculations between different light types; for example the vector can represent both position lights (w=1.0f) and directional lights (w=0.0f) and be used in the same calculations.

Light ( ) : System

Default constructor.

Light ( string name ) : System

Normal constructor. Should not be called directly, but rather the SceneManager.CreateLight method should be used.

NotifyCurrentCamera ( Camera camera ) : void
ResetCustomShadowCameraSetup ( ) : void

Reset the shadow camera setup to the default.

SetAttenuation ( float range, float constant, float linear, float quadratic ) : void

Sets the attenuation parameters of the light in a single call.

SetSpotlightRange ( float innerAngle, float outerAngle ) : void

SetSpotlightRange ( float innerAngle, float outerAngle, float falloff ) : void

Sets the spotlight parameters in a single call.

Update ( ) : void

Updates this lights position.

UpdateRenderQueue ( RenderQueue queue ) : void

Private Methods

Method Description
GetFrustumClipVolumes ( Camera camera ) : PlaneBoundedVolumeList

Internal method for calculating the clip volumes outside of the frustum which can be used to determine which objects are casting shadow on the frustum as a whole.

Each of the volumes is a pyramid for a point/spot light and a cuboid for a directional light.

GetNearClipVolume ( Camera camera ) : PlaneBoundedVolume

Internal method for calculating the 'near clip volume', which is the volume formed between the near clip rectangle of the camera and the light.

This volume is a pyramid for a point/spot light and a cuboid for a directional light. It can used to detect whether an object could be casting a shadow on the viewport. Note that the reference returned is to a shared volume which will be reused across calls to this method.

Method Details

CompareTo() public method

Used to compare this light to another light for sorting.
public CompareTo ( object obj ) : int
obj object
return int

CreateAnimableValue() public method

public CreateAnimableValue ( string valueName ) : Axiom.Animating.AnimableValue
valueName string
return Axiom.Animating.AnimableValue

GetAs4DVector() public method

Gets the details of this light as a 4D vector.
Getting details of a light as a 4D vector can be useful for doing general calculations between different light types; for example the vector can represent both position lights (w=1.0f) and directional lights (w=0.0f) and be used in the same calculations.
public GetAs4DVector ( ) : Vector4
return Vector4

Light() public method

Default constructor.
public Light ( ) : System
return System

Light() public method

Normal constructor. Should not be called directly, but rather the SceneManager.CreateLight method should be used.
public Light ( string name ) : System
name string
return System

NotifyCurrentCamera() public method

public NotifyCurrentCamera ( Camera camera ) : void
camera Camera
return void

ResetCustomShadowCameraSetup() public method

Reset the shadow camera setup to the default.
public ResetCustomShadowCameraSetup ( ) : void
return void

SetAttenuation() public method

Sets the attenuation parameters of the light in a single call.
public SetAttenuation ( float range, float constant, float linear, float quadratic ) : void
range float
constant float
linear float
quadratic float
return void

SetSpotlightRange() public method

public SetSpotlightRange ( float innerAngle, float outerAngle ) : void
innerAngle float
outerAngle float
return void

SetSpotlightRange() public method

Sets the spotlight parameters in a single call.
public SetSpotlightRange ( float innerAngle, float outerAngle, float falloff ) : void
innerAngle float
outerAngle float
falloff float
return void

Update() public method

Updates this lights position.
public Update ( ) : void
return void

UpdateRenderQueue() public method

public UpdateRenderQueue ( RenderQueue queue ) : void
queue Axiom.Graphics.RenderQueue
return void

Property Details

DefaultDirection public_oe static_oe property

public static Vector3 DefaultDirection
return Vector3

animableAttributes public_oe static_oe property

public static string[] animableAttributes
return string[]

attenuationConst protected_oe property

protected float attenuationConst
return float

attenuationLinear protected_oe property

protected float attenuationLinear
return float

attenuationQuad protected_oe property

protected float attenuationQuad
return float

derivedDirection protected_oe property

Derived direction of this light.
protected Vector3 derivedDirection
return Vector3

derivedPosition protected_oe property

Derived position of this light.
protected Vector3 derivedPosition
return Vector3

diffuse protected_oe property

Diffuse color.
protected ColorEx,Axiom.Core diffuse
return ColorEx

direction protected_oe property

Direction of this light.
protected Vector3 direction
return Vector3

frustumClipVolumes protected_oe property

protected PlaneBoundedVolumeList frustumClipVolumes
return PlaneBoundedVolumeList

lastParentOrientation protected_oe property

Stored version of parent orientation.
protected Quaternion,Axiom.Math lastParentOrientation
return Axiom.Math.Quaternion

lastParentPosition protected_oe property

Stored version of parent position.
protected Vector3 lastParentPosition
return Vector3

localTransformDirty protected_oe property

protected bool localTransformDirty
return bool

nearClipVolume protected_oe property

Stored version of the last near clip volume tested.
protected PlaneBoundedVolume,Axiom.Math nearClipVolume
return Axiom.Math.PlaneBoundedVolume

ownShadowFarDistance protected_oe property

protected bool ownShadowFarDistance
return bool

position protected_oe property

Position of this light.
protected Vector3 position
return Vector3

powerScale protected_oe property

protected Real powerScale
return Real

range protected_oe property

protected float range
return float

shadowFarDistance protected_oe property

protected Real shadowFarDistance
return Real

shadowFarDistanceSquared protected_oe property

protected Real shadowFarDistanceSquared
return Real

specular protected_oe property

Specular color.
protected ColorEx,Axiom.Core specular
return ColorEx

spotFalloff protected_oe property

protected float spotFalloff
return float

spotInner protected_oe property

protected float spotInner
return float

spotOuter protected_oe property

protected float spotOuter
return float

tempSquaredDist protected_oe property

Used for sorting. Internal for "friend" access to SceneManager.
protected float tempSquaredDist
return float

type protected_oe property

Type of light.
protected LightType type
return LightType