Model loading · function

gltfToMeshes

Turn a document into meshes in world space, one per primitive.

Explained in Importing models.

function gltfToMeshes(doc: GltfDocument, buffers: readonly Uint8Array[], options?: GltfReadOptions):
import { gltfToMeshes } from '@driftengine/assets';

Parameters

ParameterTypeDescription
docGltfDocument
buffersreadonly Uint8Array[]
options?GltfReadOptions

In depth

One MeshData per primitive rather than per glTF mesh, because a primitive is the unit that carries a single material — and a MeshData has one material's worth of vertex attributes. Merging them would mean losing the distinction the file was drawing.