Skip to content

@threepipe/plugin-gltf-transform

Exports GLTFDracoExportPlugin that extends the default gltf exporter to compress the file after export.

ExampleSource CodeAPI Reference

NPM Package

bash
npm install @threepipe/plugin-gltf-transform

To use, simply add the plugin to the viewer and export using the viewer.export or viewer.exportScene functions. This also adds UI options to AssetExporterPlugin which are used when exporting using the plugin or using viewer.exportScene

The plugin overloads the default gltf exporter in the asset manager with GLTFDracoExporter. Using the gltf-transform library, it compresses the exported gltf file using the khr_draco_mesh_compression extension.

Note - Only glb export supported right now.

Sample Usage:

typescript
import {ThreeViewer, downloadBlob} from 'threepipe'
import {GLTFDracoExportPlugin} from '@threepipe/plugin-gltf-transform'

const viewer = new ThreeViewer({...})
viewer.addPluginSync(GLTFDracoExportPlugin)

await viewer.load('file.glb')

const blob = await viewer.exportScene({
  compress: true, // this must be specified, by default it's false.
  viewerConfig: true, // to export with viewer, scene and plugin settings
})
// download the file
downloadBlob(blob, 'scene.glb')

ThreePipe - Make 3D applications on the web