troisjs / trois

✨ ThreeJS + VueJS 3 + ViteJS ⚡
https://troisjs.github.io
MIT License
4.19k stars 299 forks source link

Draco supporting #151

Closed Aziz87 closed 2 years ago

Aziz87 commented 2 years ago

If you need use DracoLoader

<GltfModel src="/models/optimized/VIKING/BODY/VIKING_BODY_1.glb" @beforeLoad="initDraco">

methods:{ initDraco(loader){ const dracoLoader = new DRACOLoader(); dracoLoader.setDecoderPath('https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/js/libs/draco/'); // use a full url path loader.setDRACOLoader(dracoLoader); } }

Aziz87 commented 2 years ago

is recept

bluelemonade commented 1 year ago

hi,

I tried to import the dracoloader.js, but where can I find it?

<GltfModel src="./export-bibel-3/Bibel30kPBR_2048.glb" @load="onReady" @beforeLoad="initDraco" @progress="onProgress" @error="onError" :rotation="{ x: 0, z: 0 }"/>

in vue3 import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';

const initDraco = () => {  // loader
      const dracoLoader = new DRACOLoader(); 
      dracoLoader.setDecoderPath('https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/js/libs/draco/');
    }

i got:

onError Error: THREE.GLTFLoader: No DRACOLoader instance provided. at new GLTFDracoMeshCompressionExtension (GLTFLoader.js?34ad:1305:1) at GLTFLoader.parse (GLTFLoader.js?34ad:357:1) at Object.eval [as onLoad] (GLTFLoader.js?34ad:194:1) at eval (three.module.js?5a89:38709:1)

how can i load this file in troiejs