transformPrimitive

  • transformPrimitive(prim: Primitive, matrix: mat4): void
  • 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]));
    
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.