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 the hasInstances case - happy to apply the necessary changes once it's clear what the preferred solution is :)
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: 1) Load compressed DamagedHelmet 2) Drop into https://gltf.pmnd.rs/ 3) Observe error
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 :)