SDK JS
    Preparing search index...

    Class WorkerSpzGltfSplatDecoder

    Off-main-thread SpzGltfSplatDecoder: fans .glb tile decodes out to a WorkerPool of module workers so the heavy entropy decode (and the wasm→JS array copies) never block the render thread. Drop-in for SpzGltfSplatDecoder (same decode(glb) contract from @bitruvius/geo-core's GltfSplatDecoder), so the streaming engine + layer don't know the difference.

    Also implements the optional PackingGltfSplatDecoder capability via decodePackedEnu, letting @bitruvius/tiles3d move the O(N-splat) ENU rebase/pack into the worker too. Call dispose to tear the pool down.

    import { Tiles3DSplatLayer } from '@bitruvius/sdk-maplibre';
    import { WorkerSpzGltfSplatDecoder } from '@bitruvius/turbo-spz';

    const decoder = new WorkerSpzGltfSplatDecoder();
    map.addLayer(new Tiles3DSplatLayer(tilesetUrl, { decoder }));
    // size the engine's decode queue to keep every worker busy:
    console.log(decoder.concurrency);

    Implements

    • GltfSplatDecoder
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    concurrency: number

    Worker pool size — size the engine's decode concurrency to match.

    Methods

    • Decode one .glb gaussian-splat tile on a pool worker.

      Parameters

      • glb: ArrayBuffer

        The .glb tile bytes; transferred into the worker (decoded once, not reused after the call).

      Returns Promise<GltfSplatCloud>

      The decoded GltfSplatCloud (parallel Float32Arrays in the tile's glb-local frame). Same shape as SpzGltfSplatDecoder.decode.

      If the wasm fails to initialize in the worker, or if glb is not a valid SPZ-compressed gaussian-splat tile — the worker rejects.

    • Optional PackingGltfSplatDecoder capability: decode AND rebase/pack into the shared ENU splat-texture layout IN THE WORKER, so the O(N-splat) pack never runs on the main thread. Output-identical to the engine's main-thread decode() + packEnu() fallback.

      Parameters

      • glb: ArrayBuffer

        The .glb tile bytes; transferred into the worker.

      • enuFromEcef: Mat4

        Column-major 4×4 matrix mapping ECEF → the scene's shared local ENU frame (meters). Shared across tiles; cloned to the worker, not transferred.

      • tileTransform: Mat4

        Column-major 4×4 tile→ECEF transform from the 3D-Tiles traversal (the accumulated tile world matrix). Cloned to the worker.

      • lod: number

        The tile's geometric error (LOD value); baked per-splat into the spare texel slot so the renderer can apply LOD-adaptive splat dilation.

      Returns Promise<PackedSplatTile>

      A PackedSplatTile (from @bitruvius/tiles3d): the GPU-ready packed texture data plus tightly-packed ENU xyz positions for the global depth sort.

      If the wasm fails to initialize in the worker, or if glb is not a valid SPZ-compressed gaussian-splat tile — the worker rejects.

    • Terminate all pool workers and release them. Safe to call more than once.

      Returns void