API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

I

interfaceOccluderSource

@codexo/exojs-lighting / lighting / stable

Something that can say which edges block light in a region. Occluders are registered sources rather than a flag on a drawable. A flag would put lighting vocabulary on a class with no lighting concern, and it would tie the shadow silhouette to the sprite's shape - which is wrong often enough that a tree wants the shadow of its trunk, not of its alpha channel. Implement this to feed shadows from anything: a navmesh, a server message, a procedural generator. The stock occluders - PhysicsOccluder, TilemapOccluder, AlphaOccluder, MeshOccluder and PolygonOccluder - are ordinary implementations of the same interface, with no privilege over yours. ```ts lighting.occludeFrom({ collect(bounds, out) { out.addSegment(bounds.left, 0, bounds.right, 0); }, }); ```

0
props
1
methods
0
events
Import
import { OccluderSource } from '@codexo/exojs-lighting'

Something that can say which edges block light in a region.

Occluders are registered sources rather than a flag on a drawable. A flag would put lighting vocabulary on a class with no lighting concern, and it would tie the shadow silhouette to the sprite's shape - which is wrong often enough that a tree wants the shadow of its trunk, not of its alpha channel.

Implement this to feed shadows from anything: a navmesh, a server message, a procedural generator. The stock occluders - PhysicsOccluder, TilemapOccluder, AlphaOccluder, MeshOccluder and PolygonOccluder - are ordinary implementations of the same interface, with no privilege over yours.

```ts lighting.occludeFrom({ collect(bounds, out) { out.addSegment(bounds.left, 0, bounds.right, 0); }, }); ```

Methods1
Append the segments overlapping bounds to out. Called once per frame with the region the visible lights actually reach, so a source that can narrow its search by region should. Reporting more than bounds covers is allowed and only costs work; reporting less than it covers leaks light. bounds is valid for the duration of the call and is reused afterwards.
Source