Packagesandy.core.light
Classpublic class Light3D
InheritanceLight3D Inheritance flash.events.EventDispatcher

The Light3D class is used for creating the light of the world.

The light in Sandy is a light source at infinity, emitting parallel whit light.
The direction of light and the intensity can be varied



Public Properties
 PropertyDefined by
  MAX_POWER : Number = 150
[static] Maximum value accepted.
Light3D
Public Methods
 MethodDefined by
  
Light3D(p_oD:Vector, p_nPow:Number)
Creates a new light source.
Light3D
  
calculate(normal:Vector):Number
Calculate the strength of this light based on the supplied normal
Light3D
  
destroy():void
Light3D
  
Returns the direction of the light.
Light3D
  
Returns the power of the light normalized to the range 0 -> 1
Light3D
  
getPower():Number
Returns the intensity of the light.
Light3D
  
setDirection(x:Number, y:Number, z:Number):void
Set the position of the {
Light3D
  
Light3D
  
setPower(p_nPow:Number):void
The the power of the light.
Light3D
Events
 EventSummaryDefined by
    Light3D
Property detail
MAX_POWERproperty
public static var MAX_POWER:Number = 150

Maximum value accepted. If the default value (150) seems too big or too small for you, you can change it. But be aware that the actual lighting calculations are normalised i.e. 0 -> MAX_POWER becomes 0 -> 1

Constructor detail
Light3D()constructor
public function Light3D(p_oD:Vector, p_nPow:Number)

Creates a new light source.

Parameters
p_oD:Vector — The direction of the emitted light.
 
p_nPow:Number — Intensity of the emitted light.
Method detail
calculate()method
public function calculate(normal:Vector):Number

Calculate the strength of this light based on the supplied normal

Parameters
normal:Vector

Returns
Number — Number the strength between 0 and 1
destroy()method 
public function destroy():void
getDirectionVector()method 
public function getDirectionVector():Vector

Returns the direction of the light.

Returns
Vector — The light direction
getNormalizedPower()method 
public function getNormalizedPower():Number

Returns the power of the light normalized to the range 0 -> 1

Returns
Number — Number a number between 0 and 1
getPower()method 
public function getPower():Number

Returns the intensity of the light.

Returns
Number — The intensity as a number between 0 - MAX_POWER.
setDirection()method 
public function setDirection(x:Number, y:Number, z:Number):void

Set the position of the {

Parameters
x:Number — the x coordinate
 
y:Number — the y coordinate
 
z:Number — the z coordinate
setDirectionVector()method 
public function setDirectionVector(pDir:Vector):voidParameters
pDir:Vector
setPower()method 
public function setPower(p_nPow:Number):void

The the power of the light. A number between 0 and MAX_POWER is necessary. The highter the power of the light is, the less the shadows are visibles.

Parameters
p_nPow:Number — Number a Number between 0 and MAX_POWER. This number is the light intensity.
Event detail
lightUpdatedevent 
Event object type: sandy.events.SandyEvent