Class sandy.core.light.Light3D

Description

Field Index

MAX_POWER, onLightUpdatedEVENT

Method Index

new Light3D()
addEventListener(), broadcastEvent(), calculate(), destroy(), dispatchEvent(), getDirectionVector(), getNormalizedPower(), getPower(), removeEventListener(), setDirection(), setDirectionVector(), setPower()

Constructor Detail

Light3D

public function Light3D(d:Vector, pow:Number)

Create a new Light3D.

Parameters

Field Detail

onLightUpdatedEVENT

static public onLightUpdatedEVENT:EventType
The Light3D onLightUpdated Event. Broadcasted when the light properties have changed

MAX_POWER

static public MAX_POWER:Number

Method Detail

setPower

public function setPower(n:Number)

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

nNumber a Number between 0 and MAX_POWER. This number is the light intensity.

getPower

public function getPower(Void):Number

Returns the power of the light.

Return

Number a number between 0 - MAX_POWER.

getNormalizedPower

public function getNormalizedPower():Number

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

Return

Number a number between 0 and 1

getDirectionVector

public function getDirectionVector(Void):Vector

setDirection

public function setDirection(x:Number, y:Number, z:Number):Void

Set the position of the Light3D.

Parameters

xthe x coordinate
ythe y coordinate
zthe z coordinate

setDirectionVector

public function setDirectionVector(pDir:Vector):Void

calculate

public function calculate(normal:Vector):Number

Calculate the strength of this light based on the supplied normal

Return

Number the strength between 0 and 1

destroy

public function destroy(Void):Void

addEventListener

public function addEventListener(t:String, oL):Void

Adds passed-in oL listener for receiving passed-in t event type.

Take a look at example below to see all possible method call.

Example var oEB : IEventDispatcher = new EventBroadcaster(this); oEB.addEventListener( myClass.onSometingEVENT, myFirstObject); oEB.addEventListener( myClass.onSometingElseEVENT, this, __onSomethingElse); oEB.addEventListener( myClass.onSometingElseEVENT, this, Delegate.create(this, __onSomething) );

Parameters

tName of the Event.
oLListener object.

removeEventListener

public function removeEventListener(t:String, oL):Void

Removes passed-in oL listener that suscribed for passed-in t event.

Example var oEB : IEventDispatcher = new EventBroadcaster(this); oEB.removeEventListener( myClass.onSometingEVENT, myFirstObject); oEB.removeEventListener( myClass.onSometingElseEVENT, this);

Parameters

tName of the Event.
oLListener object.

dispatchEvent

public function dispatchEvent(o:Object):Void

Wrapper for Macromedia EventDispatcher polymorphism.

Example var oEB : IEventDispatcher = new EventBroadcaster(this); oEB.dispatchEvent( {type:'onSomething', target:this, param:12} );

Parameters

oEvent object.

broadcastEvent

public function broadcastEvent(e:IEvent):Void

Broadcasts event to suscribed listeners.

Example using full Pixlib API var oEB : IEventDispatcher = new EventBroadcaster(this); var e : IEvent = new BasicEvent( myClass.onSomeThing, this); oEB.addEventListener( myClass.onSomeThing, this); oEB.broadcastEvent( e );

Parameters

ean IEvent instance