joinPrimitives

  • joinPrimitives(prims: Primitive[], _options?: JoinPrimitiveOptions): Primitive
  • 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);
    
Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.