Constructor
new LightSystemPlugin(textureSizeopt, ambientColoropt)
Create the global light system plugin.
| Name | Type | Attributes | Description |
|---|---|---|---|
textureSize | Vector2 | <optional> | Size of the lightmap texture (defaults to mainCanvasSize) |
ambientColor | Color | <optional> | Color applied to unlit areas of the scene (defaults to BLACK = pitch dark). Set a small RGB like rgb(0.1,0.1,0.15) for a faint "moonlight" baseline so unlit areas aren't fully black. |
- Source
// simplest usage
new LightSystemPlugin();Members
ambientColor
Properties| Type | Description |
|---|---|
| Color | Baseline color applied to unlit areas of the scene. Defaults to BLACK (pitch dark). Set to a small RGB for a faint ambient. The lightmap is cleared to this color each frame, then lights add on top, then the result multiplies the scene. |
- Source
compositeShader
Properties| Type | Description |
|---|---|
| WebGLProgram | Shader for compositing the lightmap over the main scene |
- Source
compositeVAO
Properties| Type | Description |
|---|---|
| WebGLVertexArrayObject | Vertex array object for the composite shader |
- Source
enabled
Properties| Type | Description |
|---|---|
| boolean | When false, the render pass is skipped entirely |
- Source
lightShader
Properties| Type | Description |
|---|---|
| WebGLProgram | Shader for drawing per-Light falloff blobs into the lightmap |
- Source
lightVAO
Properties| Type | Description |
|---|---|
| WebGLVertexArrayObject | Vertex array object for the light shader |
- Source
texture
Properties| Type | Description |
|---|---|
| WebGLTexture | The lightmap texture |
- Source
textureSize
Properties| Type | Description |
|---|---|
| Vector2 | Size of the lightmap texture (set at construction; falls back to mainCanvasSize at init time) |
- Source
Methods
drawLight(light)
Draw a single Light's falloff blob into the currently bound lightmap. Called by Light.renderLight() during the plugin's render pass.
| Name | Type | Description |
|---|---|---|
light | Light |
- Source