Skip to content

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.

new LightingWorld(scene, ambient?, errorBoundary?): LightingWorld

Defined in: lighting/src/LightingWorld.ts:48

Scene

AmbientLightOptions = {}

ErrorBoundary

LightingWorld

readonly scene: Scene

Defined in: lighting/src/LightingWorld.ts:38

get ambientColor(): number

Defined in: lighting/src/LightingWorld.ts:80

RGB ambient tint used by visual renderers.

number


get ambientLevel(): number

Defined in: lighting/src/LightingWorld.ts:75

Scalar light present where no source reaches.

number


get occluders(): ReadonlySet<LightOccluder>

Defined in: lighting/src/LightingWorld.ts:70

Every effectively enabled occluder in this scene.

ReadonlySet<LightOccluder>


get sources(): ReadonlySet<LightSource>

Defined in: lighting/src/LightingWorld.ts:65

Every effectively enabled light source in this scene.

ReadonlySet<LightSource>

_attachRenderer(renderer): void

Defined in: lighting/src/LightingWorld.ts:349

Internal

LightingRenderer

void


_render(frame): void

Defined in: lighting/src/LightingWorld.ts:359

Internal

LightingRenderFrame

void


destroy(): void

Defined in: lighting/src/LightingWorld.ts:373

Release the renderer and clear registered scene state.

void


levelAt(x, y): number

Defined in: lighting/src/LightingWorld.ts:94

Return the combined light level at a world-space point.

number

number

number


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.

Float32Array

LightGrid

Float32Array


registerOccluder(occluder): void

Defined in: lighting/src/LightingWorld.ts:338

Register renderer-neutral shadow geometry.

LightOccluder

void


registerSource(source): void

Defined in: lighting/src/LightingWorld.ts:327

Register a source. Components call this while effectively enabled.

LightSource

void


setAmbient(level, color?): void

Defined in: lighting/src/LightingWorld.ts:85

Set the ambient light level and optionally its RGB tint.

number

number = ...

void


unregisterOccluder(occluder): void

Defined in: lighting/src/LightingWorld.ts:344

Remove renderer-neutral shadow geometry without destroying it.

LightOccluder

void


unregisterSource(source): void

Defined in: lighting/src/LightingWorld.ts:333

Remove a source without destroying it.

LightSource

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.