work in progress: avoid shipping a modify copy of three's GLTFLoader and DRACOLoader #232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
The primary goal of this pull request is to enhance the CLI functionality within a Node environment. This initiative was prompted by challenges encountered due to the current inclusion of modified versions of
GLTFLoader
andDRACOLoader
insrc/bin
. These versions, being outdated, have led to issues, particularly in generating correctly structured JSX.Proposed Changes:
Refactoring GLTFLoader:
To make it work I just had to remove one line in https://github.com/pmndrs/three-stdlib/loaders/GLTFLoader.js:
const URL = self.URL || self.webkitURL
I assume that
URL
already exists in node. This probably needs a condition to not break browser use...Unfortunately I'm not speaking typescript and don't understand enough of the project to create a pull-request directly in three-stdlib.
Adapting DRACOLoader:
Addressing the
DRACOLoader
was more complex due to extensive browser dependencies. As a workaround, I incorporated theDRACOLoader
from Brakebein/node-three-gltf. This is a temporary measure untilDRACOLoader
inthree-stdlib
is optimized for Node/CLI usage.Package Updates:
I have also updated various packages to their latest versions. Note: The update excludes
prettier
. If these updates cause any conflicts, they can be excluded from this pull request.Caveats and Future Work:
three-stdlib
.DRACOLoader
directly fromthree-stdlib
, post its adaptation for Node/CLI environments.Conclusion:
This pull request is functional and addresses the immediate issues with CLI functionality in a Node environment. However, it needs further refinements and potential contributions to
three-stdlib
for a more integrated approach.