Class: LightSource

og.LightSource

new og.LightSource(name, params)

Represents basic light source.
Name Type Description
name string optional Light source name.
params Object optional Light parameters:
Name Type Description
position og.math.Vector3 optional Light source position if it is a point light, otherwise it is a light direction vector.
ambient og.math.Vector3 optional Ambient RGB color.
diffuse og.math.Vector3 optional Diffuse RGB color.
specular og.math.Vector3 optional Specular RGB color.
shininess number optional Specular shininess.

Members

protected_activeboolean

Light activity.

protected_ambientog.math.Vector3

Ambient color.

protected_diffuseog.math.Vector3

Diffuse color.

protected_namestring

Light name.

protected_positionog.math.Vector3

Light position.

protected_renderNodeog.scene.RenderNode

Render node where light is shines.

protected_shininessnumber

Shininess.

protected_specularog.math.Vector3

Specular color.

directionalboolean

True if the light is directional.

Methods

Adds current light to the render node scene.
Name Type Description
renderNode og.scene.RenderNode Render node scene.
Returns:
Type Description
og.LightSource
Creates clone of the current light object.
Returns:
Type Description
og.LightSource
Returns light source position, or if it is a directional type sets light direction vector.
Returns:
Type Description
og.math.Vector3 - Light source position/direction.

isActive(){boolean}

Gets light activity.
Returns:
Type Description
boolean
Removes from render node scene.

setActive(active)

Set light activity. If activity is false the light doesn't shine.
Name Type Description
active boolean Light activity.
Set ambient color.
Name Type Description
rgb og.math.Vector3 Ambient color.
Returns:
Type Description
og.LightSource
Sets light to black.
Returns:
Type Description
og.LightSource
Set diffuse color.
Name Type Description
rgb og.math.Vector3 Diffuse color.
Returns:
Type Description
og.LightSource
Set light source position, or if it is a directional type sets light direction vector.
Name Type Description
position og.math.Vector3 Light position or direction vector.
Returns:
Type Description
og.LightSource

setShininess(shininess){og.LightSource}

Set material shininess.
Name Type Description
shininess number Material shininess.
Returns:
Type Description
og.LightSource
Set specular color.
Name Type Description
rgb og.math.Vector3 Specular color.
Returns:
Type Description
og.LightSource