Class Light
Represent a light in a 3D world.
Defined in: benchgl.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Light(options)
Creates a new Light.
|
Method Attributes | Method Name and Description |
---|---|
setActive(active)
Switches the light on and off.
|
|
setAmbient(r, g, b)
Sets the ambient color of this Light.
|
|
setConstantAttenuation(constant)
Sets the constant attenuation factor of this Light.
|
|
setCutoff(cutoff)
Sets the cutoff of this Light.
|
|
setDiffuse(r, g, b)
Sets the diffuse color of this Light.
|
|
setDirection(x, y, z)
Sets the direction of this Light.
|
|
setExponent(exponent)
Sets the exponent of this Light's intensity.
|
|
setLinearAttenuation(linear)
Sets the linear attenuation factor of this Light.
|
|
setPosition(x, y, z)
Sets the position of this Light.
|
|
setQuadraticAttenuation(quadratic)
Sets the quadratic attenuation factor of this Light.
|
|
setSpecular(r, g, b)
Sets the specular color of this Light.
|
Class Detail
Light(options)
Creates a new Light.
- Parameters:
- {Object} options Optional
- Contains parameters to create the light.
- {Object} options.position Optional
- Holds the position of the light.
- {Object} options.diffuse Optional
- Holds the diffuse color.
- {Object} options.specular Optional
- Holds the specular color.
- {Object} options.direction Optional
- Holds the direction of the light.
- {Number} options.cutoff Optional
- Holds the cutoff factor.
- {Number} options.exponent Optional
- Holds the cutoff factor.
- {Number} options.constant Optional
- Holds the costant attenuation factor.
- {Number} options.linear Optional
- Holds the linear attenuation factor.
- {Number} options.quadratic Optional
- Holds the quadratic attenuation factor.
- {Number} options.active Optional
- Activate the light.
Method Detail
{Light}
setActive(active)
Switches the light on and off.
- Parameters:
- {Boolean} active
- True to activate this Light, false otherwise.
- Returns:
- {Light} Returns this Light.
{Light}
setAmbient(r, g, b)
Sets the ambient color of this Light.
- Parameters:
- {Number} r
- The red component of the color.
- {Number} g
- The green component of the color.
- {Number} b
- The blue component of the color.
- Returns:
- {Light} Returns this Light.
{Light}
setConstantAttenuation(constant)
Sets the constant attenuation factor of this Light.
- Parameters:
- {Number} constant
- The attenuation factor to set.
- Returns:
- {Light} Returns this Light.
{Light}
setCutoff(cutoff)
Sets the cutoff of this Light.
- Parameters:
- {Number} cutoff
- The cutoff to set.
- Returns:
- {Light} Returns this Light.
{Light}
setDiffuse(r, g, b)
Sets the diffuse color of this Light.
- Parameters:
- {Number} r
- The red component of the color.
- {Number} g
- The green component of the color.
- {Number} b
- The blue component of the color.
- Returns:
- {Light} Returns this Light.
{Light}
setDirection(x, y, z)
Sets the direction of this Light.
- Parameters:
- {Number} x
- The x coordinate to set.
- {Number} y
- The y coordinate to set.
- {Number} z
- The z coordinate to set.
- Returns:
- {Light} Returns this Light.
{Light}
setExponent(exponent)
Sets the exponent of this Light's intensity.
- Parameters:
- {Number} exponent
- The exponent to set.
- Returns:
- {Light} Returns this Light.
{Light}
setLinearAttenuation(linear)
Sets the linear attenuation factor of this Light.
- Parameters:
- {Number} linear
- The attenuation factor to set.
- Returns:
- {Light} Returns this Light.
{Light}
setPosition(x, y, z)
Sets the position of this Light.
- Parameters:
- {Number} x
- The x coordinate to set.
- {Number} y
- The y coordinate to set.
- {Number} z
- The z coordinate to set.
- Returns:
- {Light} Returns this Light.
{Light}
setQuadraticAttenuation(quadratic)
Sets the quadratic attenuation factor of this Light.
- Parameters:
- {Number} quadratic
- The attenuation factor to set.
- Returns:
- {Light} Returns this Light.
{Light}
setSpecular(r, g, b)
Sets the specular color of this Light.
- Parameters:
- {Number} r
- The red component of the color.
- {Number} g
- The green component of the color.
- {Number} b
- The blue component of the color.
- Returns:
- {Light} Returns this Light.