Class: Light

Light

new Light() → {Light}

Default Constructor

Defines a simple light source

Source:
Returns:
New instance of Light
Type
Light

Members

(static) eLightType :enum|eLightType

Light type enum
Type:
  • enum | eLightType
Source:

Methods

getColor() → {Array.<Float>}

Return the color of light
Source:
Returns:
color of light [R, G, B, A]
Type
Array.<Float>

getDirection() → {vec3}

Get the direction of the light
Source:
Returns:
direction vector of light [X, Y, Z]
Type
vec3

getDropOff() → {Number}

Return dropoff value
Source:
Returns:
Current DropOff value
Type
Number

getFar() → {Number}

Return far distance
Source:
Returns:
Current far distance
Type
Number

getInner() → {Number}

Return Inner cone angle of spotlight
Source:
Returns:
Current inner spotlight cone angle
Type
Number

getIntensity() → {Number}

Return the Intensity of the light
Source:
Returns:
Current Intensity value
Type
Number

getLightType() → {enum|eLightType}

Return the current light type
Source:
Returns:
current Light Type
Type
enum | eLightType

getNear() → {Number}

Return near distance
Source:
Returns:
Current near distance
Type
Number

getOuter() → {Number}

Return outer cone angle of spotlight
Source:
Returns:
Current outer spotlight cone angle
Type
Number

getPosition() → {vec3}

Return the position of the light
Source:
Returns:
position of light [X, Y, Z]
Type
vec3

isLightCastShadow() → {Boolean}

Return the current state of light casting shadow
Source:
Returns:
true if light is casting shadow
Type
Boolean

isLightOn() → {Boolean}

Return the Light on state
Source:
Returns:
true if light is on
Type
Boolean

set2DPosition(p) → {void}

Set the 2D position of the light in World Coordinate
Parameters:
Name Type Description
p Array.<Float> 2D position {X, Y]
Source:
Returns:
Type
void

setColor(c) → {void}

Set the light color
Parameters:
Name Type Description
c Array.<Float> color of light [R, G, B, A]
Source:
Returns:
Type
void

setDirection(d) → {void}

Set the direction of the light
Parameters:
Name Type Description
d vec3 direction vector [X, Y, Z]
Source:
Returns:
Type
void

setDropOff(d) → {void}

Set how quickly does light intensity drops off between inner/outer, Near/Far, a larger Drop off number results in “softer/smoother” transition from full illumination to no illumination
Parameters:
Name Type Description
d Number new DropOff value
Source:
Returns:
Type
void

setFar(f) → {void}

Set far distance. Anything farther than distance will not be illuminated by this light
Parameters:
Name Type Description
f Number new far distance
Source:
Returns:
Type
void

setInner(r) → {void}

Set the inner cone angle of the spot light. less than inner angle is illuminated
Parameters:
Name Type Description
r Number new inner angle
Source:
Returns:
Type
void

setIntensity(i) → {void}

Set the Intensity of the light.
Parameters:
Name Type Description
i Number new Intensity value
Source:
Returns:
Type
void

setLightCastShadowTo(on) → {void}

Set the light to cast shadows
Parameters:
Name Type Description
on Boolean state to set casting of shadows
Source:
Returns:
Type
void

setLightTo(on) → {void}

Set the light on state
Parameters:
Name Type Description
on Boolean state to set light on
Source:
Returns:
Type
void

setLightType(t) → {void}

Set the Light type
Parameters:
Name Type Description
t enum | eLightType light type
Source:
Returns:
Type
void

setNear(n) → {void}

Set near distance. Anything less than this distance is illuminated
Parameters:
Name Type Description
n Number new Near distance
Source:
Returns:
Type
void

setOuter(r) → {void}

Set the outer cone angle of the spot light. greater than outter angle is not illuminated
Parameters:
Name Type Description
r Number new outer angle
Source:
Returns:
Type
void

setXPos(x) → {void}

Set the X position of the light
Parameters:
Name Type Description
x Float position of light
Source:
Returns:
Type
void

setYPos(y) → {void}

Set the Y position of the light
Parameters:
Name Type Description
y Float position of light
Source:
Returns:
Type
void

setZPos(z) → {void}

Set the Z position of the light
Parameters:
Name Type Description
z Float position of light
Source:
Returns:
Type
void