API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
interfaceOccluderSource
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); }, }); ```
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); }, }); ```
collect(bounds: ReadonlyRectangleRead-only view of a Rectangle: every accessor and non-mutating query a rectangle offers, with none of its writers. Returned by APIs that hand out a LIVE intern…, out: OccluderSinkWhere an OccluderSource writes what blocks light. The main channel is line segments in world space: an occluder has no thickness, no interior and no material,…): void