All vertex attributes on the Primitive and its
PrimitiveTargets are modified in place. If vertex
streams are shared with other Primitives, and overwriting the shared vertex
attributes is not desired, use compactPrimitive to pre-process
the Primitive or call transformMesh instead.
Applies a transform matrix to a Primitive.
All vertex attributes on the Primitive and its PrimitiveTargets are modified in place. If vertex streams are shared with other Primitives, and overwriting the shared vertex attributes is not desired, use compactPrimitive to pre-process the Primitive or call transformMesh instead.
Example:
import { fromTranslation } from 'gl-matrix/mat4'; import { transformPrimitive } from '@gltf-transform/functions'; // offset vertices, y += 10. transformPrimitive(prim, fromTranslation([], [0, 10, 0]));