Menu - Top - Home - Donate to Me

H3DU.Lights

Back to documentation index.

H3DU.Lights()

A collection of light sources. It stores the scene's ambient color as well as data on one or more light sources. When constructed, the list of light sources will be empty.

NOTE: The default shader program assumes that all colors specified in this object are in companded sRGB.

Members

Methods

H3DU.Lights.MAX_LIGHTS (constant)

Maximum number of lights supported by the default shader program.

Default Value: 3

H3DU.Lights#sceneAmbient

Ambient color for the scene. This is the color of the light that shines on every part of every object equally and in every direction. In the absence of other lighting effects, all objects will be given this color.

Ambient light is a simplified simulation of the real-world effect of light bouncing back and forth between many different objects in an area. One example of this phenomenon is sunlight reaching an indoor room without directly hitting it, such that the sunlight bounces off the walls and so illuminates most of the room pretty much uniformly. Ambient lights simulate this phenomenon.

NOTE: In the default shader program, this property is only used on objects that use H3DU.Material, not H3DU.PbrMaterial.

Default Value: "[0.2,0.2,0.2]"

H3DU.Lights#getCount()

Gets the number of lights defined in this object.

Return Value

Return value. (Type: number)

H3DU.Lights#getLight(index)

Gets information about the light source at the given index.

Parameters

Return Value

The corresponding light source object. (Type: H3DU.LightSource)

H3DU.Lights#setAmbient(r, g, b, [a])

Sets the color of the scene's ambient light.

Parameters

Return Value

This object. (Type: H3DU.Lights)

H3DU.Lights#setBasic()

Resets this object to a basic configuration for light sources: one light source with its default values, and the default value for sceneAmbient.

Return Value

This object. (Type: H3DU.Lights)

H3DU.Lights#setDirectionalLight(index, direction, [diffuse], [specular])

Sets a directional light.

Parameters

Return Value

This object. (Type: H3DU.Lights)

H3DU.Lights#setParams(index, params)

Sets parameters for the light source at the given index.

Parameters

Return Value

This object. (Type: H3DU.Lights)

H3DU.Lights#setPointLight(index, position, [diffuse], [specular])

Sets a point light.

Parameters

Return Value

This object. (Type: H3DU.Lights)

Back to documentation index.