Luxar Viewer API Documentation - v2026.10.19
    Preparing search index...

    GSplats data loader using spatial indices for efficient nD queries.

    Key features:

    • Chunk-based loading using spatial index
    • Handles all array encoding types (broadcasted, quantized, LUT, etc.)
    • Support for optional arrays (colors)

    Implements

    Index
    chunkIndex: ChunkSpatialIndex | null = null
    zarrLocation: Location<Readable>
    node: SceneNode
    _lifetime: LoaderLifetime = ...

    Disposed latch, lifetime signal, one-shot initialization and the per-call demand-load context (lifetime.calls) the wrapped arrays' getChunk reads through the () => this._lifetime.calls.signal / .probe thunks below (see LoaderLifetime, ActiveLoadContext).

    rangeLoader: RangeLoader
    zarrStore: Readable | null = null
    _accumulator: GSplatsDataAccumulator | null = null
    _accumulatorConfig: { capacity: number; ndim: number } | null = null
    _labelIndicesScratch: Uint32Array<ArrayBuffer> = ...
    colorComponents: 3 | 4 = 3

    Color layout of this dataset: 3 (RGB) or 4 (RGBA, alpha = per-splat opacity).

    l0Cache: DecompressedChunkCache | null = null
    prefetcher: ChunkPrefetcher | null = null
    sliceCache: SliceCache | null = null
    _initialLoadDone: boolean = false
    _toleranceOptions: ToleranceOptions | null = null
    events: LoaderEventEmitter = ...
    metrics: LoaderMetrics
    activeQueries: Map<string, QueryInfo> = ...
    nextQueryId: number = 0
    totalQueryCells: number = 0
    facadeCtx: SpatialFacadeCtx
    arrays: {
        centers?: Array<DataType, Readable>;
        amplitudes?: Array<DataType, Readable>;
        cholesky_factors_diag?: Array<DataType, Readable>;
        cholesky_factors_offdiag?: Array<DataType, Readable>;
        cholesky_factors?: Array<DataType, Readable>;
        colors?: Array<DataType, Readable>;
        label_ids?: Array<DataType, Readable>;
    } = {}
    • get prefetchByteUpperBound(): number

      Conservative whole-rung L0 footprint used to bound speculative ladder lookahead before the exact visible chunk set is known. Zarr scalar types top out at 8 bytes; counting every optional channel and whole stored rung deliberately overestimates sliced/broadcast arrays so lookahead cannot evict more useful cache entries on a large scene.

      Returns number

    • Thin wrapper around the shared registerGSplatsArrayBounds helper so the call sites read more naturally than passing the prefetcher and node path on every call.

      Parameters

      • arrayName: string
      • array: Array<DataType, Readable>

      Returns void

    • Initialize metadata once without loading any attribute payload chunks.

      priority classes the chunk_bounds read of an initialisation THIS call starts (B6: the progressive loader warms rung k+1 at 'refinement' while rung k loads). A later call without one needs the index now, so it raises an in-flight warm to demand — no priority inversion behind a warm. So the speculative entry points (planPrefetch, prefetchChunks, prefetchChunkBoundary) pass 'speculative': they are not a frame waiting on the index, and an untagged call from them would raise a refinement-class warm to demand.

      Runs under the disposed latch (LoaderLifetime.ensureInitialized): a disposed loader refuses to re-initialize, and one still in flight at dispose is discarded rather than repopulating the loader.

      Parameters

      Returns Promise<void>

    • Query visible splat ranges based on view state.

      Delegates the chunk-bounds AABB scan and range coalescing to the canonical SpatialQueryBuilder, which also handles the extend_to_all short-circuit. Returns a load-all range when no spatial index is available.

      Parameters

      Returns Promise<SplatRange[]>

    • Open the Cholesky factor array(s), supporting both the v3.1 split layout (cholesky_factors_diag + optional cholesky_factors_offdiag) and the legacy v3.0 single packed cholesky_factors. The off-diagonal array is absent for 1D gsplats. Recombination into the packed buffer happens in loadCholeskyRanges.

      Returns Promise<void>

    • Load Cholesky factors into the packed (N, k) form, recombining the v3.1 split arrays when present. For the legacy single-array layout this is a direct passthrough to loadArrayRanges. On success every packed position is written (diagonal ∪ off-diagonal = all k columns), so a reused target buffer never leaks stale values. The corrupt-file precondition (a d > 1 store missing the off-diagonal array) is checked BEFORE any write, so a throw never leaves the (possibly reused) target buffer half-populated.

      Parameters

      • ranges: SplatRange[]

        Visible splat ranges

      • ndim: number

        Dimensionality (k = ndim*(ndim+1)/2 packed elements/splat)

      • OptionaltargetBuffer: Float32Array<ArrayBufferLike>

        Optional packed output buffer (zero-alloc path)

      Returns Promise<Float32Array<ArrayBufferLike>>

    • Parameters

      • arrayName: string
      • ranges: SplatRange[]
      • elementsPerSplat: number
      • OptionaltargetBuffer: Float32Array<ArrayBufferLike>

      Returns Promise<Float32Array<ArrayBufferLike>>

    • Load color ranges with multi-type support (preserves original_dtype)

      This method handles the full encoding/decoding pipeline for colors, including original_dtype restoration for encoded arrays.

      Parameters

      • ranges: SplatRange[]
      • OptionaltargetBuffer:
            | Uint8Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>

      Returns Promise<
          | Uint8Array<ArrayBufferLike>
          | Float32Array<ArrayBufferLike>
          | Uint16Array<ArrayBufferLike>,
      >

    • Prefetch chunks for the given view state into the cache without producing geometry.

      Uses planned visible ranges when supplied; otherwise performs the same spatial index query as updateView(). Every distinct chunk the visible ranges touch, on every array, is fetched (L1/L2) and decoded into the L0 decompressed-chunk cache through the proxy's warmChunk — NOT through zarr get(), so no output selection is allocated or filled, and the demand load's abort signal and residency probe are not consulted (the warm-up uses signal only). The subsequent updateView() is then a fast L0 hit.

      Parameters

      Returns Promise<void>

    • Release pooled decoded buffers after a progressive parent has copied them. Earlier payloads remain valid because dispose() replaces the accumulator buffers rather than clearing their old arrays. This deliberately gives up pooling across view changes to release the progressive ladder's second copy.

      Returns void