Class c3dl.DirectionalLight
Extends
c3dl.Light.
A DirectionalLight inherits from Light. It does not have a position
such as a PositionalLight. It only has a direction. Think if a
directional light as being infinately far from the scene, but its light
rays travelling in the direction specified. Since it has no position,
it will always light a side of an object.
When specifying the direction, you are specifying where the light rays are going towards.
A DirectionalLight is useful when a scene contains an 2D array of objects aligned in a square. If
all the objects are to be light the same way, a directional light would be a good choice to add
to the scene.
Defined in: directionallight.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
Get the direction of this light.
|
|
|
setDirection(dir)
Set the direction of this light.
|
- Methods borrowed from class c3dl.Light:
- getAmbient, getDiffuse, getName, getSpecular, getType, isOn, setAmbient, setDiffuse, setName, setOn, setSpecular
Method Detail
{Array}
getDirection()
Get the direction of this light. The default direction of the light is [0,0,1].
- Returns:
- {Array} the direction of the light which will be unit length.
setDirection(dir)
Set the direction of this light. The 'dir' argument will be scaled to
a unit vector before being assigned if not already unit length.
- Parameters:
- {Array} dir
- Will be scaled to a unit vector before being assigned if not already unit length.