LightingWorld
Defined in: lighting/src/LightingWorld.ts:28
Per-scene light state.
levelAt(x, y) reports a continuous value from 0 to 1. The ambient level
and every radial source contribution are added, then clamped. A source
contributes in proportion to how much of its lamp an enabled occluder
leaves visible from the point, which for a point lamp is all of it or none;
levelGridInto answers the same question for a whole grid in one call.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LightingWorld(
scene,ambient?,errorBoundary?):LightingWorld
Defined in: lighting/src/LightingWorld.ts:48
Parameters
Section titled “Parameters”Scene
ambient?
Section titled “ambient?”AmbientLightOptions = {}
errorBoundary?
Section titled “errorBoundary?”ErrorBoundary
Returns
Section titled “Returns”LightingWorld
Properties
Section titled “Properties”
readonlyscene:Scene
Defined in: lighting/src/LightingWorld.ts:38
Accessors
Section titled “Accessors”ambientColor
Section titled “ambientColor”Get Signature
Section titled “Get Signature”get ambientColor():
number
Defined in: lighting/src/LightingWorld.ts:80
RGB ambient tint used by visual renderers.
Returns
Section titled “Returns”number
ambientLevel
Section titled “ambientLevel”Get Signature
Section titled “Get Signature”get ambientLevel():
number
Defined in: lighting/src/LightingWorld.ts:75
Scalar light present where no source reaches.
Returns
Section titled “Returns”number
occluders
Section titled “occluders”Get Signature
Section titled “Get Signature”get occluders():
ReadonlySet<LightOccluder>
Defined in: lighting/src/LightingWorld.ts:70
Every effectively enabled occluder in this scene.
Returns
Section titled “Returns”ReadonlySet<LightOccluder>
sources
Section titled “sources”Get Signature
Section titled “Get Signature”get sources():
ReadonlySet<LightSource>
Defined in: lighting/src/LightingWorld.ts:65
Every effectively enabled light source in this scene.
Returns
Section titled “Returns”ReadonlySet<LightSource>
Methods
Section titled “Methods”_attachRenderer()
Section titled “_attachRenderer()”_attachRenderer(
renderer):void
Defined in: lighting/src/LightingWorld.ts:349
Internal
Parameters
Section titled “Parameters”renderer
Section titled “renderer”Returns
Section titled “Returns”void
_render()
Section titled “_render()”_render(
frame):void
Defined in: lighting/src/LightingWorld.ts:359
Internal
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy():
void
Defined in: lighting/src/LightingWorld.ts:373
Release the renderer and clear registered scene state.
Returns
Section titled “Returns”void
levelAt()
Section titled “levelAt()”levelAt(
x,y):number
Defined in: lighting/src/LightingWorld.ts:94
Return the combined light level at a world-space point.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number
levelGridInto()
Section titled “levelGridInto()”levelGridInto(
out,grid):Float32Array
Defined in: lighting/src/LightingWorld.ts:156
Sample a rectangular grid of light levels into out, row by row, one
sample at each cell’s centre. Every cell holds what levelAt returns for
that centre.
Each source is summed over the cells its radius reaches, against the occluders within that radius, so the cost grows with the lit area rather than with the whole grid.
Parameters
Section titled “Parameters”Float32Array
Returns
Section titled “Returns”Float32Array
registerOccluder()
Section titled “registerOccluder()”registerOccluder(
occluder):void
Defined in: lighting/src/LightingWorld.ts:338
Register renderer-neutral shadow geometry.
Parameters
Section titled “Parameters”occluder
Section titled “occluder”Returns
Section titled “Returns”void
registerSource()
Section titled “registerSource()”registerSource(
source):void
Defined in: lighting/src/LightingWorld.ts:327
Register a source. Components call this while effectively enabled.
Parameters
Section titled “Parameters”source
Section titled “source”Returns
Section titled “Returns”void
setAmbient()
Section titled “setAmbient()”setAmbient(
level,color?):void
Defined in: lighting/src/LightingWorld.ts:85
Set the ambient light level and optionally its RGB tint.
Parameters
Section titled “Parameters”number
color?
Section titled “color?”number = ...
Returns
Section titled “Returns”void
unregisterOccluder()
Section titled “unregisterOccluder()”unregisterOccluder(
occluder):void
Defined in: lighting/src/LightingWorld.ts:344
Remove renderer-neutral shadow geometry without destroying it.
Parameters
Section titled “Parameters”occluder
Section titled “occluder”Returns
Section titled “Returns”void
unregisterSource()
Section titled “unregisterSource()”unregisterSource(
source):void
Defined in: lighting/src/LightingWorld.ts:333
Remove a source without destroying it.
Parameters
Section titled “Parameters”source
Section titled “source”Returns
Section titled “Returns”void
Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/lighting.md.