Taos API Reference
    Preparing search index...

    Function buildDrawables

    • Builds rebased drawables for every primitive of a loaded glTF, given the f64 contentToWorld matrix that maps the model's local (Y-up) space into the engine world frame. Shared by tile content and the geolocation anchor.

      Each primitive's positions are baked into small, origin-relative WORLD space on the CPU in f64 (full = contentToWorld · nodeWorld applied per vertex), then uploaded as a fresh Mesh drawn with an IDENTITY model matrix. This is the same scheme the quantized-mesh terrain path uses, and it's essential for tiles authored far from their body's center — the Moon's glTF tiles carry absolute Moon-centered coordinates (~1.7M m). Handing those straight to the GPU and letting the f32 vertex shader do model · position loses ~decimeters of precision in clip space (large-magnitude multiply + the cancellation back to the origin), so the densely-refined sub-meter triangles on crater rims collapse to degenerate slivers the rasterizer drops — the speckle / "triangles not filling" holes. Baking in f64 keeps the GPU multiply identity (no large numbers reach it) AND keeps shared edges between neighboring tiles bit-identical (watertight), since the same ECEF point maps through the same f64 path to the same f32 world position in either tile. The floating-origin shift is applied by the draw loop on top of the identity matrix.

      Parameters

      • device: GPUDevice
      • gltf: GltfStaticModel
      • contentToWorld: Mat4d
      • collectCollision: boolean = false
      • Optionalskirt: { center: Vec3d; scale: number }

        When set, append a radial skirt to each primitive (see buildTileSkirts). center is the body center in engine-world space; scale multiplies the depth.

      • collectPick: boolean = false

        Collect a CPU pick soup (world positions + indices + per-vertex feature id) for ray-pick feature selection (needs the gltf decoded with featureIds).

      Returns {
          drawables: TileDrawable[];
          triangles: number;
          bytes: number;
          collision?: { positions: Float32Array; indices: Uint32Array };
          pick?: PickableMesh;
      }