Skip to content

模型导出

GLTF Export

▶ 在线运行案例

你将学到什么

  • GLTFExporter.parse 导出场景
  • { binary: true }glb;否则 gltf JSON
  • embedImages: true 内嵌贴图

效果说明

加载 house.obj,点击「导出模型」下载 scene.glb

js
exporter.parse(scene, (result) => {
    const blob = result instanceof ArrayBuffer
        ? new Blob([result], { type: 'model/gltf-binary' })
        : new Blob([JSON.stringify(result)], { type: 'model/gltf+json' });
    // download blob...
}, { binary: true, onlyVisible: true, embedImages: true });

小结

基础案例 · Three.js · 33/35