-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRACOLoader: Web Worker support #15249
Conversation
34c3b24
to
b820d32
Compare
TBH, I personally prefer this approach since it's a very clear and compact implementation. |
@sunag I notice you're using the Draco decoder directly in SEA3DLoader rather than using DRACOLoader — if you'd be interested in using something like this, instead, I'm glad to rename the file as WWDRACOLoader to not be glTF-specific. |
There are a couple open things here:
|
Edit: It was too late yesterday evening. I re-wrote the post to make it clearer.
The examples below configures PR for the preview versions of
|
Thank you @donmccurdy. Certainly this could happen in the next updates. |
@donmccurdy nice that the new decoder code has no longer dependencies to three.js! 👍 |
b820d32
to
d938dac
Compare
Ok, this PR is in better shape now. I think we can now answer a few of the questions mentioned earlier: (1) Let's replace DRACOLoader, rather than adding a glTF-specific variant of it. There are several breaking changes from the original DRACOLoader:
None of these affect usage in GLTFLoader, so the new and old versions are both compatible with the existing GLTFLoader. The initialization changes slightly: // Before
var dracoLoader = new THREE.DRACOLoader();
THREE.DRACOLoader.setDecoderPath( 'js/libs/draco/gltf/' )
loader.setDRACOLoader( dracoLoader );
// After
var dracoLoader = new THREE.DRACOLoader();
dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' )
loader.setDRACOLoader( dracoLoader ); |
The file in this PR is named |
c102383
to
bfb1c3d
Compare
I've added the changes directly to DRACOLoader (not a new loader), and I think this is ready – here's a demo of my viewer, using the web workers: |
Thanks! |
#17365 👍 |
Possible solution to #13648 — a drop-in replacement for DRACOLoader, intended for use with GLTFLoader. A glTF file may contain multiple compressed meshes, and this loader allows each mesh to be decompressed by a configurable number of workers, without using the main thread.
For simplicity, I omitted some functionality of DRACOLoader that glTF does not use, such as point clouds. The result is 150 lines shorter than DRACOLoader.Usage:
The alternative would be #13664 (comment), which involves LoaderSupport. That's more code, but also has some additional features. I'm not sure how to weigh those tradeoffs at the moment.