wasm-spatial-core
    Preparing search index...

    Class GltfBuilder

    glTF 2.0 builder — collect meshes and materials, then export as GLB or JSON.

    Index
    • Add a material with base color (RGBA 0–1 range).

      Parameters

      • r: number
      • g: number
      • b: number
      • a: number

      Returns number

    • Add a mesh with positions, indices, and optional normals.

      • positions: Flat Float32Array [x0, y0, z0, x1, y1, z1, ...]
      • indices: Flat Uint32Array [i0, i1, i2, ...]
      • normals: Optional flat Float32Array [nx0, ny0, nz0, ...] (may be null)
      • material_index: Material index (0-based), or -1 for no material.

      Parameters

      • positions: Float32Array
      • indices: Uint32Array
      • normals: Float32Array
      • material_index: number

      Returns void

    • Export as glTF JSON string (no binary — positions/indices as base64).

      Returns string