Class: LightSource

og/light/LightSource~LightSource

Represents basic light source.

new LightSource(name, params)

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

Members

protected_activeboolean

Light activity.

protected_ambientog.Vec3

Ambient color.

protected_diffuseog.Vec3

Diffuse color.

protected_namestring

Light name.

protected_positionog.Vec3

Light position.

protected_renderNodeog.scene.RenderNode

Render node where light is shines.

protected_shininessnumber

Shininess.

protected_specularog.Vec3

Specular color.

directionalboolean

True if the light is directional.

Methods

addTo(renderNode){og.LightSource}

Adds current light to the render node scene.
Name Type Description
renderNode og.scene.RenderNode Render node scene.
Returns:
Type Description
og.LightSource

clone(){og.LightSource}

Creates clone of the current light object.
Returns:
Type Description
og.LightSource

getPosition(){og.Vec3}

Returns light source position, or if it is a directional type sets light direction vector.
Returns:
Type Description
og.Vec3 - 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.

setAmbient(rgb){og.LightSource}

Set ambient color.
Name Type Description
rgb og.Vec3 Ambient color.
Returns:
Type Description
og.LightSource

setBlack(){og.LightSource}

Sets light to black.
Returns:
Type Description
og.LightSource

setDiffuse(rgb){og.LightSource}

Set diffuse color.
Name Type Description
rgb og.Vec3 Diffuse color.
Returns:
Type Description
og.LightSource

setPosition(position){og.LightSource}

Set light source position, or if it is a directional type sets light direction vector.
Name Type Description
position og.Vec3 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

setSpecular(rgb){og.LightSource}

Set specular color.
Name Type Description
rgb og.Vec3 Specular color.
Returns:
Type Description
og.LightSource