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 Vec3 optional Light source position if it is a point light, otherwise it is a light direction vector.
ambient Vec3 optional Ambient RGB color.
diffuse Vec3 optional Diffuse RGB color.
specular Vec3 optional Specular RGB color.
shininess number optional Specular shininess.

Members

protected_activeboolean

Light activity.

protected_ambientVec3

Ambient color.

protected_diffuseVec3

Diffuse color.

protected_namestring

Light name.

protected_positionVec3

Light position.

protected_renderNodeRenderNode

Render node where light is shines.

protected_shininessnumber

Shininess.

protected_specularVec3

Specular color.

directionalboolean

True if the light is directional.

Methods

addTo(renderNode){LightSource}

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

clone(){LightSource}

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

getPosition(){Vec3}

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

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

setAmbient3v(rgb){LightSource}

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

setBlack(){LightSource}

Sets light to black.
Returns:
Type Description
LightSource

setDiffuse(){LightSource}

Set diffuse color.
Returns:
Type Description
LightSource

setDiffuse3v(rgb){LightSource}

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

setPosition(position){LightSource}

Set light source position, or if it is a directional type sets light direction vector.
Name Type Description
position Vec3 Light position or direction vector.
Returns:
Type Description
LightSource

setPosition3v(position){LightSource}

Set light source position, or if it is a directional type sets light direction vector.
Name Type Description
position Vec3 Light position or direction vector.
Returns:
Type Description
LightSource

setShininess(){LightSource}

Set material shininess.
Returns:
Type Description
LightSource

setSpecular(){LightSource}

Set specular color.
Returns:
Type Description
LightSource

setSpecular3v(rgb){LightSource}

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