Create a new Points data accumulator with multi-type support
Initial capacity in number of points (default: 1024)
Number of dimensions in source data (default: 3)
Total points in dataset for metadata tracking (default: 0)
PrivatepositionPrivatecolorPrivateradiiPrivatesharpnessPrivatescalarper-point scalar buffer for colormap lookup.
PrivatetypesPrivatehasPrivatehasPrivatehasPrivatehastracks whether scalars were ever filled this session.
Private_Flips to true on dispose(). Getters/fill/getData throw a
descriptive error if called after disposal so caller bugs don't
silently operate on the empty-buffer state.
PrivateusedHighest point index touched by any fill() call. Lets
ensureCapacity() copy only the live prefix into the new buffers
instead of the full capacity — when growing 1024 → 1536 after
filling 800 points, the position copy goes from 12288 floats down
to 2400 floats, a 5× reduction on the hot loading path.
PrivatecolorComponents per color item: 3 (RGB) or 4 (RGBA — alpha = per-point opacity).
PrivatecapacityPrivateallocationsPrivatetotalPrivatendimPrivatetotalPrivateusedDeclare the color layout (3 = RGB, 4 = RGBA) BEFORE the first color
fill. The loader knows the layout from the zarr array shape at open
time; the accumulator needs it to size every color buffer. Throws if
colors were already written with a different layout — the layout is a
property of the dataset, not of an individual load. Mirrors
LoadedGSplatsDataAccumulator.configureColorComponents.
Ensure accumulator has sufficient capacity, growing if needed
Uses the shared 1.5x-capped-at-needed growth strategy (./growth.ts) to
minimize reallocation events while avoiding
excessive memory overhead. Growth preserves attribute types (Uint8/Uint16/Float32).
Minimum required capacity (number of points)
true if capacity was grown, false if already sufficient
Get LoadedPointsData with NATIVE types (zero-copy subarrays)
Returns views (subarrays) into accumulator buffers with native types preserved. No conversion or copying occurs. Computes fresh bounds from positions.
Number of points to return (must be ≤ capacity)
LoadedPointsData with subarrays pointing to accumulator buffers
const data = accumulator.getData(5000);
// data.positions is a subarray of accumulator.positionBuffer
// data.colors might be Uint8Array, Uint16Array, or Float32Array
console.log('Actual type:', data.colors?.constructor.name);
console.log('Dtype:', data.metadata.dtypes.colors); // 'uint8', 'uint16', or 'float32'
PrivateinitializeDetect and initialize buffer types on first fill
Fill accumulator buffers at offset with point data
Detects attribute types on first fill and creates appropriately-typed buffers. Subsequent fills must use matching types. Preserves native types (no conversion).
Starting point index to fill from
Partial point data to fill (any subset of attributes)
3D positions (Float32Array, size: count*3)
Optional colors (Float32Array|Uint8Array|Uint16Array, size: count*3)
Optional radii (Float32Array|Uint8Array, size: count)
Optional sharpness (Float32Array|Uint8Array, size: count)
// First fill: detects types (Uint8 colors)
accumulator.fill(0, {
positions: new Float32Array([1,2,3]),
colors: new Uint8Array([255, 128, 0])
});
// Accumulator now has Uint8Array colorBuffer
// Subsequent fills: must use same types
accumulator.fill(1, {
positions: new Float32Array([4,5,6]),
colors: new Uint8Array([0, 255, 128]) // Must be Uint8Array
});
Update accumulator metadata
Updates metadata fields for the accumulated points. Note: bounds parameter is ignored - getData() always computes fresh bounds from positions.
Partial metadata update
Optionalndim?: numberNumber of dimensions
OptionaltotalPoints?: numberTotal points in full dataset
OptionalusedSpatialIndex?: booleanWhether spatial index was used for loading
Optionalbounds?: Box3Ignored (computed in getData())
OptionalusedEffectiveRadius?: booleanTracked but not used in return
Get statistics
Whether attribute types have been initialized via fill()
Introspection — true if dispose() has been called.
PrivateassertThrows if a mutating call lands on a disposed accumulator. Read-only getters return the empty buffers so disposal assertions can inspect the cleared state without raising.
Direct accessor for the scalar buffer (used by loaders writing through).
The accumulator starts with a zero-length scalar buffer to avoid
reserving 4 B/point on the common no-scalars path. The first
getScalarBuffer() call allocates to current capacity so the
spatial-index loader's direct-write path (loadVertexRanges →
scalarBuffer) writes into a real buffer.
Dispose (release memory)
Points data accumulator with FULL multi-type support
Handles Float32Array, Uint8Array, and Uint16Array natively (no conversion) to maintain memory efficiency and consistency with multi-type GPU buffer pool.
Type is detected on first fill() and remains fixed for the accumulator's lifetime.