LightSystem. Light

A Light is an EngineObject that contributes a soft additive blob of color to the LightSystem plugin's lightmap.

Constructor

new Light(pos, radius, coloropt, fadeRangeopt)

Create a light object and add it to the engine object list

Parameters:
NameTypeAttributesDescription
posVector2

World space position

radiusnumber

Total extent of the light in world units

colorColor<optional>

Color of the light; alpha modulates intensity

fadeRangenumber<optional>

Width of the soft edge in world units (defaults to radius)

Example
new Light(vec2(5, 5), 4, rgb(1, 0.5, 0));        // orange light, full soft blob
new Light(vec2(0, 0), 8, rgb(1, 1, 1), 2);       // white core with 2-unit soft halo

Extends

  • EngineObject

Members

fadeRange

Properties
TypeDescription
number

Width of the soft edge in world units

radius

Properties
TypeDescription
number

Total extent of the light in world units

Methods

render()

Lights are invisible in the main render pass — they only contribute to the lightmap via renderLight().

renderLight()

Draw this light's falloff blob into the lightmap. Called by LightSystemPlugin during its render pass. No-op when the plugin or WebGL is unavailable.