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.
This PR adds support for KTX2 loader codegen since currently files with basisu compressed textures can not be loaded with gltfjsx codegen.
It also enables the draco option or meshopt option automatically if the mesh uses draco/meshopt compression.
Output Example:
https://codesandbox.io/p/sandbox/example-gltfjsx-ktx-draco-zq868k?workspaceId=6fd5c640-33c5-4061-bc17-d4030f1a6650
Steps to reproduce:
This PR might be actually better suited as an option for drei useGLTF to avoid creating KTX2 loaders for every model (as we do with this PR). It would also simplify codegen again.
Let me know if you'd prefer this as a third bool argument (similar to draco and meshopt) and if so in what fashion (before the loader callback parameter or after) or if you prefer a different solution.
Currently the PR removes
useGLTF.preload
for files with KTX2 textures and doesnt handle thehasInstances
case - happy to apply the necessary changes once it's clear what the preferred solution is :)