transformMesh

  • transformMesh(mesh: Mesh, matrix: mat4, overwrite?: boolean, skipIndices?: Set<number>): void
  • Applies a transform matrix to every Primitive in the given Mesh.

    Method:

    • If any primitives are shared by other meshes, they will be detached.
    • If any vertex streams are shared by primitives of other meshes, vertex data will be overwritten unless overwrite=false or the indices are masked. If overwrite=false, a detached copy of the vertex stream is made before applying the transform.
    • Primitives within the mesh sharing vertex streams will continue to share those streams.
    • For indexed primitives, only indexed vertices are modified.

    Example:

    import { fromTranslation } from 'gl-matrix/mat4';
    import { transformMesh } from '@gltf-transform/functions';
    
    // offset vertices, y += 10.
    transformMesh(mesh, fromTranslation([], [0, 10, 0]));
    
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.