Scene
Defined in: core/scene.ts:177
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Scene(
tolerance?):Scene
Defined in: core/scene.ts:180
Parameters
Section titled “Parameters”tolerance?
Section titled “tolerance?”number = 0.25
Returns
Section titled “Returns”Scene
Methods
Section titled “Methods”appendedBuffers()
Section titled “appendedBuffers()”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.
Parameters
Section titled “Parameters”string
fromDrawable
Section titled “fromDrawable”number
Returns
Section titled “Returns”appendToGroup()
Section titled “appendToGroup()”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.
Parameters
Section titled “Parameters”string
(g) => void
Returns
Section titled “Returns”void
buffers()
Section titled “buffers()”buffers(
name):GroupBuffers
Defined in: core/scene.ts:464
Assemble GPU-ready typed arrays for a group.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”declutterIndex()
Section titled “declutterIndex()”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).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”DeclutterIndex
drawableCount()
Section titled “drawableCount()”drawableCount(
name):number
Defined in: core/scene.ts:202
Number of drawables currently registered in a group.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
drawableOf()
Section titled “drawableOf()”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.
Parameters
Section titled “Parameters”string
string | number
Returns
Section titled “Returns”DrawableVector | null
drawables()
Section titled “drawables()”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)).
Parameters
Section titled “Parameters”string
number = 0
Returns
Section titled “Returns”group()
Section titled “group()”group(
name,build):void
Defined in: core/scene.ts:183
Build (or rebuild) a named group. The callback registers drawables.
Parameters
Section titled “Parameters”string
(g) => void
Returns
Section titled “Returns”void
range()
Section titled “range()”range(
name,id):DrawableRange
Defined in: core/scene.ts:342
The contiguous buffer slice a drawable occupies.
Parameters
Section titled “Parameters”string
string | number
Returns
Section titled “Returns”setFill()
Section titled “setFill()”setFill(
name,id,color):void
Defined in: core/scene.ts:358
Set a drawable’s fill color (any CSS color string). Hot-swappable.
Parameters
Section titled “Parameters”string
string | number
string
Returns
Section titled “Returns”void
setFlag()
Section titled “setFlag()”setFlag(
name,id,flags):void
Defined in: core/scene.ts:370
Set a drawable’s flag byte (e.g. bit 0 = visible). Hot-swappable.
Parameters
Section titled “Parameters”string
string | number
number
Returns
Section titled “Returns”void
setStroke()
Section titled “setStroke()”setStroke(
name,id,color):void
Defined in: core/scene.ts:364
Set a drawable’s stroke color (any CSS color string). Hot-swappable.
Parameters
Section titled “Parameters”string
string | number
string
Returns
Section titled “Returns”void
styleTables()
Section titled “styleTables()”styleTables(
name):StyleTables
Defined in: core/scene.ts:454
Snapshot the per-drawable color/flag tables (see StyleTables).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”writeDeclutterFlags()
Section titled “writeDeclutterFlags()”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.
Parameters
Section titled “Parameters”string
visibleByGroup
Section titled “visibleByGroup”Uint8Array
Returns
Section titled “Returns”void