convertPrimitiveToTriangles

  • convertPrimitiveToTriangles(prim: Primitive): void
  • Converts a TRIANGLE_STRIP or TRIANGLE_LOOP Primitive to TRIANGLES, which is more widely supported. Any other topology given as input (points or lines) will throw an error.

    Example:

    import { convertPrimitiveToTriangles } from '@gltf-transform/functions';
    
    console.log(prim.getMode()); // 5 (TRIANGLE_STRIP)
    convertPrimitiveToTriangles(prim);
    console.log(prim.getMode()); // 4 (TRIANGLES)
    
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.