Skip to content

Scene

Defined in: core/scene.ts:177

new Scene(tolerance?): Scene

Defined in: core/scene.ts:180

number = 0.25

Scene

appendedBuffers(name, fromDrawable): GroupBufferDelta

Defined in: core/scene.ts:497

GPU-ready buffers for ONLY the drawables appended at/after fromDrawable — the tail slices, computed in O(new). A backend whose buffers mirror the group 1:1 (append-only, same order) can apply this by appending: the index values are group-ABSOLUTE (no rebasing), because the new vertices sit at the same positions the group placed them. fromDrawable >= drawableCount yields an empty delta.

string

number

GroupBufferDelta


appendToGroup(name, build): void

Defined in: core/scene.ts:195

Append more drawables to an existing group (vs group(), which replaces it). New drawables’ integer drawableIds continue after the existing ones; a duplicate domain id (the caller’s string/number id) throws. NOTE: not atomic across a multi-drawable build — if a later drawable in the batch throws, earlier ones are already committed. Callers needing all-or-nothing (the engine append path) validate ids before calling.

string

(g) => void

void


buffers(name): GroupBuffers

Defined in: core/scene.ts:464

Assemble GPU-ready typed arrays for a group.

string

GroupBuffers


declutterIndex(name): DeclutterIndex

Defined in: core/scene.ts:382

The DeclutterIndex for a group — the transform-independent anchor grouping used by screen-space declutter. Built once and cached on the group; the per-frame caller projects ax/ay to screen and bins them, so the (string-keyed) grouping never re-runs on a zoom. Invalidated automatically when the group is rebuilt (group) or appended to (appendToGroup).

string

DeclutterIndex


drawableCount(name): number

Defined in: core/scene.ts:202

Number of drawables currently registered in a group.

string

number


drawableOf(name, id): DrawableVector | null

Defined in: core/scene.ts:447

The vector view of ONE drawable by domain id, or null when the id has no drawable (unknown, or culled at build time). O(1) lookup.

string

string | number

DrawableVector | null


drawables(name, from?): DrawableVector[]

Defined in: core/scene.ts:438

Return the vector view of a group’s drawables, optionally only those at/after from (so an incremental append can read just the new ones in O(new)).

string

number = 0

DrawableVector[]


group(name, build): void

Defined in: core/scene.ts:183

Build (or rebuild) a named group. The callback registers drawables.

string

(g) => void

void


range(name, id): DrawableRange

Defined in: core/scene.ts:342

The contiguous buffer slice a drawable occupies.

string

string | number

DrawableRange


setFill(name, id, color): void

Defined in: core/scene.ts:358

Set a drawable’s fill color (any CSS color string). Hot-swappable.

string

string | number

string

void


setFlag(name, id, flags): void

Defined in: core/scene.ts:370

Set a drawable’s flag byte (e.g. bit 0 = visible). Hot-swappable.

string

string | number

number

void


setStroke(name, id, color): void

Defined in: core/scene.ts:364

Set a drawable’s stroke color (any CSS color string). Hot-swappable.

string

string | number

string

void


styleTables(name): StyleTables

Defined in: core/scene.ts:454

Snapshot the per-drawable color/flag tables (see StyleTables).

string

StyleTables


writeDeclutterFlags(name, visibleByGroup): void

Defined in: core/scene.ts:409

Apply a per-anchor-group visibility verdict (1 = keep, 0 = hide) to the flag bytes, in place — one linear pass over the cached DeclutterIndex, with no per-id Map lookups. Drawables with no anchor (groupOf = -1) always stay visible. visibleByGroup is indexed by the same group index as ax/ay.

string

Uint8Array

void