-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
GLTFExporter WebWorker Support #23857
Conversation
Looks great thanks! @takahirox any concerns? |
I haven't tested yet but looks good to me. |
Let me convert this to a draft for just a bit longer. I'm still having challenges with the images being corrupted when exporting as a glb. |
Found the fix, forgot to return the promise correctly. Everything seems good now, ready for review 👍 |
@robertlong Do you have an online demo or test? It will help us review. |
Yes, but let me create a smaller one in CodeSandbox. |
Here's the example: Live Demo: https://robertlong.github.io/three-gltf-exporter-webworker/ |
canvas.toBlob( function ( blob ) { | ||
} else { | ||
|
||
toBlobPromise = canvas.convertToBlob( { type: mimeType } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a fun switch... 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you'd think they would keep the same method name for OffscreenCanvas?
Co-authored-by: Don McCurdy <[email protected]>
Thanks! |
Minor clean up: 340d588 |
Hi, was the merging of roughness and metalness map tested after this change? It looks like the cached canvas is also being used in the |
Just tested on https://threejs.org/editor/ : adding a roughness map to an object and exporting gltf, saves a blank roughness/metalness texture. |
Oh no... |
@robertlong Any chance you can take a look? |
@robertlong Never mind. |
* Make GLTFExporter work in a WebWorker * Fix formatting * Fix canvas.toBlob * Fix OffscreenCanvas check * Fix promise * Update examples/jsm/exporters/GLTFExporter.js Co-authored-by: Don McCurdy <[email protected]> Co-authored-by: Don McCurdy <[email protected]>
Thanks for this @robertlong |
Description
This PR makes the GLTFExporter work in a WebWorker with OffscreenCanvas support. All references to classes/methods not available on the WorkerGlobalScope have been removed or replaced.
This contribution is funded by Matrix.org.