Selva Compute API Reference - v2.1.0
    Preparing search index...

    Function parseBinaryMeshBatch

    • Parses a binary mesh batch blob in the SLVA wire format.

      The blob layout is:

        [4]  magic        = "SLVA" (0x53 0x4C 0x56 0x41)
      [4] version = uint32 (currently 1)
      [4] metadataLen = uint32 byte length of UTF-8 metadata JSON
      [N] metadata = UTF-8 JSON (materials, groups, sourceComponentId, ...)
      [4] flags = uint32 (bit 0: 0 = int16 quantized, 1 = float32 raw)
      [24] origin = 3 x float64
      [24] scale = 3 x float64 (step per int16 unit; identity for float32)
      [4] vertexCount = uint32 number of vertices (positions = vertexCount * 3 components)
      [V] vertices = int16[vertexCount*3] OR float32[vertexCount*3]
      [4] indexCount = uint32 number of indices
      [I] indices = uint32[indexCount]

      For int16 vertices: world position = origin + (q + 32767) * scale. This matches Three.js BufferAttribute(arr, 3, true) (normalized: true) semantics when the per-mesh transform encodes origin + scale.

      For float32: origin = (0, 0, 0), scale = (1, 1, 1), vertices are raw world positions.

      Parameters

      • input: string | ArrayBuffer | Uint8Array<ArrayBufferLike>

        The blob, as either an ArrayBuffer/Uint8Array (binary transport) or a base64-encoded string (today's JSON-envelope transport).

      Returns ParsedBinaryMeshBatch

      Decoded metadata plus typed-array views into the geometry payload.

      On invalid magic, unknown version, or truncated input.