troisjs / trois

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

DRACO loader support #185

Closed kartsims closed 1 year ago

kartsims commented 1 year ago

hey, first of all THANK YOU for this awesome library!

here's a PR to support DRACOLoader to load compressed GLTF models. at the moment they fail to load, and the current implementation of Trois doesn't allow to access the GLTFLoader before actually loading the file afaik

it allows tu use much lighter models, and is the default compression algorithm when exporting models with blender, so I believe it's a rather common use case

I've done everything in this PR to blend in the rest of the code, but feel free to let me know if you see something you dislike

you can check out this branch of my repo if you want an implementation example (I included test files and usage)

bluelemonade commented 1 year ago

i updated the library npm update -g troisjs in a vue3 cli project

But I got the 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)

why.

kartsims commented 1 year ago

@bluelemonade you should probably open an issue if you suspect something is wrong with the library

if you are having trouble implementing it, stack overflow is a good place to get help

the library currently does not support DRACOLoader, and you have commented on a PR that is addressing this specific issue

klevron commented 1 year ago

Thanks 👍