draco

  • Applies Draco compression using KHR_draco_mesh_compression. Draco compression can reduce the size of triangle geometry.

    This function is a thin wrapper around the KHRDracoMeshCompression extension.

    Example

    import { NodeIO } from '@gltf-transform/core';
    import { KHRDracoMeshCompression } from '@gltf-transform/extensions';
    import { draco } from '@gltf-transform/functions';
    import draco3d from 'draco3dgltf';
    
    const io = new NodeIO()
        .registerExtensions([KHRDracoMeshCompression])
        .registerDependencies({
            'draco3d.encoder': await draco3d.createEncoderModule()
        });
    
    await document.transform(
      draco({method: 'edgebreaker'})
    );
    
    await io.write('compressed.glb', document);
    

    Compression is deferred until generating output with an I/O class.

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.