LightingSystem
Hierarchy
- System
- LightingSystem
Index
Constructors
constructor
Parameters
optionaloptions: LightingSystemOptions
Returns LightingSystem
Properties
publicreadonlysystemType
Determine whether the system is called in the SystemType.Update or the SystemType.Draw phase. Update is first, then Draw.
staticpriority
System can execute in priority order, by default all systems are priority 0. Lower values indicated higher priority. For a system to execute before all other a lower priority value (-1 for example) must be set. For a system to execute after all other a higher priority value (10 for example) must be set.
Methods
publicinitialize
optionalinheritedpostupdate
Optionally run a postupdate after the system processes matching entities
Parameters
scene: Scene
elapsed: number
Time in milliseconds since the last frame
Returns void
optionalinheritedpreupdate
Optionally run a preupdate before the system processes matching entities
Parameters
scene: Scene
elapsed: number
Time in milliseconds since the last frame
Returns void
publicupdate
Update all entities that match this system's types
Parameters
elapsed: number
Time in milliseconds
Returns void
Composite canvas-driven visibility system tracking ambient, darkness, light masks, and ray projected shadow volumes.
Renders via a Canvas graphic on a screen-space ScreenElement named 'lighting'. The raster pipeline per frame: ambient-blended darkness veil → room rect fills/clips → camera frustum cull → per-light destination-out punch (with occluder shadows subtracted) → colored tint passes.
Enabled scene-wide via EngineOptions.lighting, or add an instance manually to a scene's world.
Potentially performance impacting — the overlay is rasterized with the 2D Canvas API and re-uploaded to the GPU every frame.
Known limitations: circle occluder radii scale uniformly with
Math.min(scale.x, scale.y)so a non-uniformly scaled occluder won't cast an elliptical shadow, darkness room rects have no independent rotation of their own (though they do rotate along with the camera), and polygon shadow volumes can split at corners when the silhouette edge is not face on to the light.