Splats · class

SplatCapture

A capture assembled from blocks, one .drft chunk at a time.

Explained in Gaussian splats.

class SplatCapture
import { SplatCapture } from '@driftengine/splats';

In depth

Allocated once at the final count and filled progressively, which is what makes a streaming load cost nothing extra: the GPU textures are sized for the whole capture at registration, each block is a sub-upload into storage that already exists, and the drawn count rises. Growing an array as blocks land would mean reallocating and re-uploading a capture's worth of texels several times during a load, which is more work than the load itself.

Every block is a sparse version of the whole capture, because the container writes them that way — see coarseFirstOrder. So a prefix of the arrived splats is a recognisable place at lower density rather than one finished corner, and the load opens on something worth looking at. That property lives in the writer; what lives here is that nothing is re-ordered or re-allocated on the way in.

The unarrived tail is zeroed, which puts it at the origin with no size. Nothing draws it: the caller sorts and draws ready splats and the sorter is told the same number.

Constructor

new

constructor(options: SplatCaptureOptions)
ParameterTypeDescription
optionsSplatCaptureOptions

Properties

NameTypeDescription
datareadonlySplatData

Accessors

NameTypeDescription
readygetnumberHow many splats have landed. The count to sort, to draw and to upload up to.

Methods

append

append(records: Uint32Array, count: number): SplatAppend

Copy one block's records in, deriving what the CPU needs from what the file carried.

ParameterTypeDescription
recordsUint32Array
countnumber
More

Positions and extents come back out of the records rather than being stored beside them, which is the whole reason a .drft splat block is thirty-two bytes a splat rather than forty-eight: the first three words are the position's own float bits and the eighth is the extent's. See packSplats, which is what puts them there.