Constructor
new Light(pos, radius, coloropt, fadeRangeopt)
Create a light object and add it to the engine object list
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
pos | Vector2 | World space position | |
radius | number | Total extent of the light in world units | |
color | Color | <optional> | Color of the light; alpha modulates intensity |
fadeRange | number | <optional> | Width of the soft edge in world units (defaults to radius) |
- Source
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 haloExtends
- EngineObject
Members
fadeRange
Properties| Type | Description |
|---|---|
| number | Width of the soft edge in world units |
- Source
radius
Properties| Type | Description |
|---|---|
| number | Total extent of the light in world units |
- Source
Methods
render()
Lights are invisible in the main render pass — they only contribute to the lightmap via renderLight().
- Source
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.
- Source