Given a list of compatible Mesh Primitives, returns new Primitive
containing their vertex data. Compatibility requires that all Primitives share the
same Materials, draw mode, and vertex attribute types. Primitives
using morph targets cannot currently be joined.
Example:
import { joinPrimitives } from'@gltf-transform/functions';
// Succeeds if Primitives are compatible, or throws an error.const result = joinPrimitives(mesh.listPrimitives());
for (const prim of mesh.listPrimitives()) {
prim.dispose();
}
mesh.addPrimitive(result);
Given a list of compatible Mesh Primitives, returns new Primitive containing their vertex data. Compatibility requires that all Primitives share the same Materials, draw mode, and vertex attribute types. Primitives using morph targets cannot currently be joined.
Example:
import { joinPrimitives } from '@gltf-transform/functions'; // Succeeds if Primitives are compatible, or throws an error. const result = joinPrimitives(mesh.listPrimitives()); for (const prim of mesh.listPrimitives()) { prim.dispose(); } mesh.addPrimitive(result);