jMonkeyEngine / jMonkeyEngine/jmonkeyengine
implement the KHR_mesh_quantization extension
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
Khronos has specified an extension to glTF for loading meshes with byte and/or short coordinates.
Currently, attempting to load such a model results in an exception:
com.jme3.asset.AssetLoadException: An error occurred loading AnimatedMorphCube/glTF-Quantized/AnimatedMorphCube.gltf
at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:181)
at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:107)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:274)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:390)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:441)
at com.github.stephengold.wrench.test.CompareLoaders.loadModel(CompareLoaders.java:886)
at com.github.stephengold.wrench.test.CompareLoaders.loadModel(CompareLoaders.java:841)
at com.github.stephengold.wrench.test.CompareLoaders.onAction(CompareLoaders.java:496)
at jme3utilities.ui.DefaultInputMode.onAction(DefaultInputMode.java:186)
at com.jme3.input.InputManager.invokeActions(InputManager.java:174)
at com.jme3.input.InputManager.onKeyEventQueued(InputManager.java:474)
at com.jme3.input.InputManager.processQueue(InputManager.java:871)
at com.jme3.input.InputManager.update(InputManager.java:923)
at com.jme3.app.LegacyApplication.update(LegacyApplication.java:805)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:249)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:631)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:721)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassCastException: class java.nio.DirectShortBufferU cannot be cast to class java.nio.FloatBuffer (java.nio.DirectShortBufferU and java.nio.FloatBuffer are in module java.base of loader 'bootstrap')
at com.jme3.scene.plugins.gltf.GltfLoader.readMeshPrimitives(GltfLoader.java:457)
at com.jme3.scene.plugins.gltf.GltfLoader.readNode(GltfLoader.java:252)
at com.jme3.scene.plugins.gltf.GltfLoader.readChild(GltfLoader.java:301)
at com.jme3.scene.plugins.gltf.GltfLoader.readChild(GltfLoader.java:309)
at com.jme3.scene.plugins.gltf.GltfLoader.readScenes(GltfLoader.java:218)
at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:155)
... 17 more
Since the extension may be widely used in the future, it would be nice if jme3-plugins could handle it. I haven't scoped out the changes and don't know whether the core engine supports such meshes.
For examples, see the glTF-Sample-Assets repo at GitHub.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in com.jme3.scene.plugins.gltf.GltfLoader, especially readMeshPrimitives() near line 457, and reproduce the failure with AnimatedMorphCube/glTF-Quantized/AnimatedMorphCube.gltf. Review the KHR_mesh_quantization specification and the glTF-Sample-Assets examples, then determine whether the core engine supports the resulting mesh data. Done means the quantized sample loads without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100