threepipe
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

plugin-gltf-transform.md 2.0KB


prev:

text: '@threepipe/plugin-geometry-generator'
link: './plugin-geometry-generator'

next:

text: '@threepipe/plugins-extra-importers'
link: './plugins-extra-importers'

@threepipe/plugin-gltf-transform

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

ExampleSource CodeAPI Reference

NPM Package

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:

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')