SDK JS
    Preparing search index...

    Class BvcDecoder

    The in-process (cpu-wasm) BVC decoder: parses the container header on open and streams quantized per-tile geometry from decodeTiles, all on the calling thread.

    For large scenes prefer BvcWorkerDecoder (same contract, decode fanned out to a worker pool), or let createBvcDecoder pick the best backend for the runtime. Decoded tiles are quantized structure-of-arrays typed arrays; dequantization happens downstream in the GPU shaders.

    import { BvcDecoder } from '@bitruvius/bvc';

    const decoder = new BvcDecoder();
    const model = await decoder.open(bytes);
    for await (const tile of decoder.decodeTiles(model, bytes)) {
    // upload tile to GPU
    }

    Implements

    • Decoder
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    backend: DecodeBackend

    The backend this instance reports — always 'cpu-wasm' unless overridden.

    Methods

    • Stream the container's tiles, decoding each on the calling thread and yielding them in index order.

      Parameters

      • model: DecodedModel

        The DecodedModel returned by open for these bytes.

      • bytes: Uint8Array

        The same .bvc container bytes passed to open.

      • Optionalopts: DecodeOptions

        Optional DecodeOptions: signal to abort (checked before each tile), and onTile(tile, index) invoked as each tile finishes.

      Returns AsyncIterable<DecodedTile>

      An async iterable of DecodedTile — a DecodedSplatTile or DecodedPointTile of quantized structure-of-arrays typed arrays (newly owned by JS, ready to transfer and upload to the GPU).

      The provided signal's abort reason if aborted before a tile is produced; also rejects on wasm init failure (see open).

    • Release decoder resources. No-op: the in-process path holds nothing between calls.

      Returns void

    • Parse the BVC container header (cheap — no per-tile geometry decode).

      Parameters

      • bytes: Uint8Array

        The full .bvc container bytes.

      Returns Promise<DecodedModel>

      The DecodedModel: profile ('splat' or 'pointcloud'), meta (per-axis scale/offset for points, or fractional-bits/SH-degree for splats), and tileCount. Pass it (with the same bytes) to decodeTiles.

      Initializes the wasm on first use; rejects if wasm load/init fails (e.g. the runtime lacks WASM SIMD, or no wasmBytes/wasmUrl could be resolved off the main thread). Throws if bytes are not a valid container.