UNPKG

@gltf-transform/functions

Version:

Functions for common glTF modifications, written using the core API

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