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

    Loader implementation that uses spatial indices for efficient nD queries.

    Key features:

    • Queries spatial index to find visible point ranges
    • Loads all attributes with identical ranges (fixes alignment bug)
    • Projects nD points to 3D display space
    • Real-time monitoring and performance tracking

    Implements

    Index
    chunkIndex: PointsChunkIndex | null = null
    totalPointsNoIndex: number = 0
    _effectiveRadiusConfig: EffectiveRadiusConfig | null = null
    zarrLocation: Location<Readable>
    node: SceneNode
    _onceInit: OnceInit = ...
    arrays: {
        positions?: Array<DataType, Readable>;
        colors?: Array<DataType, Readable>;
        radii?: Array<DataType, Readable>;
        sharpness?: Array<DataType, Readable>;
        scalars?: Array<DataType, Readable>;
    } = {}

    Type Declaration

    • Optionalpositions?: Array<DataType, Readable>
    • Optionalcolors?: Array<DataType, Readable>
    • Optionalradii?: Array<DataType, Readable>
    • Optionalsharpness?: Array<DataType, Readable>
    • Optionalscalars?: Array<DataType, Readable>

      optional scalars array for colormap lookup.

    rangeLoader: RangeLoader
    _accumulator: LoadedPointsDataAccumulator | null = null
    _accumulatorConfig:
        | { capacity: number; ndim: number; totalPoints: number }
        | null = null
    colorComponents: 3 | 4 = 3

    Components per color item, learned from the zarr colors shape at open time: 3 = RGB, 4 = RGBA (alpha = per-point opacity). Strides the accumulator buffers and the projection compaction. Mirrors GSplatsSpatialIndexLoader.colorComponents.

    events: LoaderEventEmitter = ...
    metrics: LoaderMetrics
    activeQueries: Map<string, QueryInfo> = ...
    nextQueryId: number = 0
    facadeCtx: SpatialFacadeCtx
    totalQueryCells: number = 0
    zarrStore: Readable | null = null
    l0Cache: DecompressedChunkCache | null = null
    _activeProbe: ResidencyAccumulator | null = null
    _activeSignal: AbortSignal | null = null
    prefetcher: ChunkPrefetcher | null = null
    sliceCache: SliceCache | null = null
    _initialLoadDone: boolean = false
    • Register array shape with the prefetcher for upper-bounds checking. Thin wrapper around the shared registerPointsArrayBounds helper so the three call sites in initialize() keep their compact form.

      Parameters

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

      Returns void

    • Warm the cache for the given viewState without producing geometry.

      Mirrors GSplatsSpatialIndexLoader.prefetchChunks so the dimension animation controller can fire prefetchChunks(nextSlice) while the current frame renders, hiding network latency. The returned typed arrays are discarded — only the L0 + L1 + L2 caches and the prefetch queue's seen/parsed-cache get populated as a side-effect.

      Parameters

      Returns Promise<void>

    • Query spatial index for visible point ranges.

      Tolerance is computed by the points-specific calculateSpatialQueryTolerance (EffectiveRadiusConfig-aware) and passed to the canonical SpatialQueryBuilder via its tolerance option. Falls back to a uniform tolerance derived from viewState.tolerance/maxRadius for nodes without an EffectiveRadiusConfig.

      The builder also handles the extend_to_all short-circuit; we only emit the defensive metadata-missing warning ourselves.

      Parameters

      Returns Promise<PointRange[]>

    • Allocate output buffer for decoded data. For encoded arrays, always use Float32Array (decoder output). For direct arrays, match the source dtype.

      Parameters

      • totalElements: number
      • isEncoded: boolean
      • dtype: string

      Returns
          | Uint8Array<ArrayBufferLike>
          | Float32Array<ArrayBufferLike>
          | Uint16Array<ArrayBufferLike>
          | Float16Array<ArrayBufferLike>

    • Load an array_ref attribute. Delegates to the shared RangeLoader.loadRangesResolvingRef helper, which opens the target, recomputes per-item element count from the target's shape, and runs RangeLoader.loadRanges against it.

      actualElementsPerPoint is passed as the non-ref hint; when an array_ref is in play it's ignored in favour of the target's shape.

      Parameters

      • attrs: ArrayMetadata
      • ranges: LoadRange[]
      • output: Float32Array
      • totalPoints: number
      • actualElementsPerPoint: number

      Returns Promise<number>

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

      Delegates to the shared color-attribute helper used by the lines and gsplats facades. Handles direct (uint8/uint16/float32 native), encoded (quantized / LUT / broadcasted decoded to Float32 then cast back to original_dtype), and array_ref dispatch in one call.

      Kept separate from loadRanges (used for positions / radii / sharpness) because:

      • Colors hard-code RGB (3 channels per item) — the shared helper does too.
      • Positions / scalars need Float16 preservation that the shared helper's Float32-only direct path would silently widen.

      Parameters

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

    • Load array data for specified point ranges.

      This method handles multiple encoding strategies:

      • Broadcasted: Load once, replicate
      • Quantized: Load ranges, dequantize
      • LUT: Load indices, decode with lookup table
      • Array Reference: Resolve target, dispatch based on target encoding
      • Generic Encoded: Decode full array, extract ranges
      • Direct: Load ranges directly

      Parameters

      • arrayName: string

        Name of the array to load (positions, radii, sharpness). For colors, use loadColorRanges which delegates to the shared color-attribute helper.

      • ranges: PointRange[]

        Point ranges to load

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

      Typed array with loaded data, or null if array doesn't exist

    • Main-thread, WASM-accelerated nD → 3D projection. Thin delegate to projectPointsTo3D in point-loader/projection.ts. The wasm backend (compiled or TS-reference fallback) is resolved by the caller via getPointsBackend(ndim).

      Parameters

      • wasm: WasmModule
      • positions:
            | Uint8Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>
            | Float16Array<ArrayBufferLike>
            | null
      • colors:
            | Uint8Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>
            | Float16Array<ArrayBufferLike>
            | null
      • radii:
            | Uint8Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>
            | Float16Array<ArrayBufferLike>
            | null
      • sharpness:
            | Uint8Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>
            | Float16Array<ArrayBufferLike>
            | null
      • viewState: ViewState
      • ranges: PointRange[]
      • OptionaltargetBuffers: ProjectionTargetBuffers | null
      • Optionalscalars:
            | Uint8Array<ArrayBufferLike>
            | Float32Array<ArrayBufferLike>
            | Uint16Array<ArrayBufferLike>
            | Float16Array<ArrayBufferLike>
            | null

      Returns LoadedPointsData

    • Load spatial_extend_dims from scene_dimensions stored in root zarr attributes.

      This derives the spatial extension flags from the scene_dimensions which is the single source of truth for dimension configuration. Each dimension has a spatial flag indicating whether points physically extend through it.

      For displayed dimensions, we always treat them as spatial (they're in the view plane). For non-displayed dimensions:

      • spatial=true: Points extend as hyperspheres (use effective radius)
      • spatial=false: Categorical/discrete dimension (exact match required)

      Returns Promise<boolean[] | null>

      Array of booleans indicating spatial extension per dimension, or null if unavailable

    • 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