Applies a transform matrix to every Primitive in the given Mesh.
For every Primitive in the Mesh, the operation first applies
compactPrimitive to isolate vertex streams, then calls
transformPrimitive. Transformed Mesh will no longer share vertex
attributes with any other Meshes — attributes are cloned before
transformation.
Applies a transform matrix to every Primitive in the given Mesh.
For every Primitive in the Mesh, the operation first applies compactPrimitive to isolate vertex streams, then calls transformPrimitive. Transformed Mesh will no longer share vertex attributes with any other Meshes — attributes are cloned before transformation.
Example:
import { fromTranslation } from 'gl-matrix/mat4'; import { transformMesh } from '@gltf-transform/functions'; // offset vertices, y += 10. transformMesh(mesh, fromTranslation([], [0, 10, 0]));