ReadonlyonFires once per rendering group per render tick when content changed.
Handlers should be cheap and not mutate sources synchronously (mutations
will schedule the next rebuild, but nested flush() calls during a
handler are no-ops).
Register a source with this aggregator. Sources contribute to the
combined slab for their renderingGroupId, in addSource order
within a group. Adding a source schedules a rebuild.
Throws if the source is already registered (with this or another aggregator) — sources are single-owner.
Release per-group buffer slack accumulated by doubling-on-growth.
Useful after a load phase finishes (e.g. after LineGeometryBuilder.build
resolves) when no further growth is expected — at peak the combined
buffer can hold up to 2× the current segment count.
threshold (default 1.5) compacts a group only when capacity > count * threshold. Groups with no segments are released to zero capacity.
Safe between rebuilds; data is preserved so consumers reading the slab
before the next rebuild see the same content.
Tear down. Removes scene observers, clears combined buffers, detaches all sources (without disposing them — that's the caller's call). Idempotent.
Force a synchronous rebuild and emit. Use for tests, headless rendering, or scripts that need the post-mutation state immediately. Not for the render hot path — defeats RAF coalescing.
Nested flush() calls (e.g. from inside an onRebuild handler) are
no-ops: the reentrancy guard prevents recursion.
True after dispose().
True when frustum culling is active.
Detach a source. Schedules a rebuild of the group the source belonged
to. The source's own dispose() is not called — caller decides.
Toggle per-source frustum culling. When on, an onBeforeRender observer
recomputes each source's world-space AABB visibility against the active
camera's frustum every frame; sources fully outside the frustum are
skipped during combine. When off (default), no per-frame observer is
installed and every visible source contributes regardless of camera.
Toggling re-dirties all groups so the next rebuild reflects the new culling state.
Combines multiple
LineSources into one slab per rendering group, ready for upload to aLineRenderer. The aggregator owns the combined buffers, grows them in place (doubling) as needed, and rebuilds once per render tick — driven byscene.onBeforeRenderObservableviaaddOnceso idle frames pay zero observer overhead.Lifecycle:
Self-disposes when the host
Sceneis disposed.