Class c3dl.PositionalLight
Extends
c3dl.Light.
A PositionalLight inherits from Light. Unlike DirectionalLight,
a PositionalLight can have an attenuation factor.
Defined in: positionallight.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
Get the attenuation factors of this light.
|
|
|
Get the position of the light.
|
|
|
setAttenuation(attenuation)
Set the attenuation factors of this light.
|
|
|
setPosition(Position)
Set the position of this light.
|
- Methods borrowed from class c3dl.Light:
- getAmbient, getDiffuse, getName, getSpecular, getType, isOn, setAmbient, setDiffuse, setName, setOn, setSpecular
Method Detail
{Array}
getAttenuation()
Get the attenuation factors of this light. This is an array of three values
which include constant attenuation, linear attenuation and quadratic attenuation.
- Returns:
- {Array} The attenuation factors
{Array}
getPosition()
Get the position of the light.
- Returns:
- {Array} the position of the light.
setAttenuation(attenuation)
Set the attenuation factors of this light.
the attenuation factor is calculated:
attenuation factor = 1 / (C + L*D + Q*D^2)
C = constant attenuation, 0th element
L = linear attenuation, 1st element
Q = quadratic attenuation, 2nd element
D = distance between light and vertex.
C = constant attenuation, 0th element
L = linear attenuation, 1st element
Q = quadratic attenuation, 2nd element
D = distance between light and vertex.
- Parameters:
- {Array} attenuation
setPosition(Position)
Set the position of this light.
- Parameters:
- {Array} Position
- of the light relative to world space.