Class c3dl.SpotLight
Extends
c3dl.Light, c3dl.PositionalLight.
A spotlight is a PositionalLight which can have a 'cone' of light used to
restrict what objects or parts of an object get lit. All vertices which
fall inside the code are lit.
One application of using a spotlight is making a headlight effect.
Defined in: spotlight.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
The cutoff value defines the spread of the cone of the spotlight.
|
|
|
Get the direction the spotlight is pointing which will be unit
length.
|
|
|
Get the intensity distribution of light within the cone of light the
spotlight creates.
|
|
|
setCutoff(cutoff)
The cutoff defines the spread (angle) of the cone of the spotlight.
|
|
|
setDirection(dir)
Set the direction of the spotlight.
|
|
|
setExponent(exponent)
Set the intensity distribution of the light within the cone the spotlight
creates.
|
- Methods borrowed from class c3dl.Light:
- getAmbient, getDiffuse, getName, getSpecular, getType, isOn, setAmbient, setDiffuse, setName, setOn, setSpecular
- Methods borrowed from class c3dl.PositionalLight:
- getAttenuation, getPosition, setAttenuation, setPosition
Method Detail
{float}
getCutoff()
The cutoff value defines the spread of the cone of the spotlight. The
value will either be 180 degrees or will range from 0 to 90 degrees. If
the value is 180, the spotlight will not have a cone.
- Returns:
- {float} the cutoff value.
{Array}
getDirection()
Get the direction the spotlight is pointing which will be unit
length.
- Returns:
- {Array} the direction where the spotlight is pointing which will be unit length.
{float}
getExponent()
Get the intensity distribution of light within the cone of light the
spotlight creates. Higher exponents result in a more focused light.
- Returns:
- {float} Exponent will range from 0 to 128 inclusive.
setCutoff(cutoff)
The cutoff defines the spread (angle) of the cone of the spotlight.
If the angle between the direction of the light and direction of spotlight
to the vertex being lit is less than the cutoff, the vertex will be lit.
- Parameters:
- {float} cutoff
- Measured in degrees. Must either be equal to 180 or range between 0 and 90.
setDirection(dir)
Set the direction of the spotlight. The 'dir' argument will be scaled to
a unit vector before being assigned if not already unit length.
- Parameters:
- {Array} dir
- Direction the spotlight is pointing. Will be scaled to a unit vector before being assigned if not already unit length.
setExponent(exponent)
Set the intensity distribution of the light within the cone the spotlight
creates. Higher exponent values will result in a more focused light.
- Parameters:
- {float} exponent
- Must range from 0 to 128 inclusive.