When I started the gdx-gltf-KHR fork the aim was narrow: add the missing compression extensions EXT_meshopt_compression and KHR_mesh_quantization so large asset counts stay viable on mobile. Static scenery worked. But games move, so the next step was supporting rigged, skinned animation.
The blockers: interleaved strides and byte order
Loading animated assets from gltfpack made the mesh vanish. The raw bytes showed two problems:
-
Endianness. Bulk copies set byte order for you, but the manual fallback loops defaulted to
BIG_ENDIAN. Since glTF is little-endian, bone weights read reversed and turned into near-zero noise, making the mesh invisible. -
Drifting strides. Aggressive compression packs geometry and skin data tightly together. Relative pointers slipped out of alignment, so bone indices ended up reading weight or texture bytes.
What I changed
A focused rewrite to the repository, handling rigged attributes without breaking existing static meshes:
-
Force byte order. Read paths like
readBufferFloatnow setLITTLE_ENDIANexplicitly. -
Use absolute offsets. Replaced relative pointer math with fixed absolute offsets (
bytes.get(index)) in the data resolver, so however tightly attributes are packed, it reads the exact slot. -
Scale weights separately. Updated
MeshLoader.javato detect bone use and dequantize 16-bit weights into clean0.0–1.0floats, leaving static attributes alone.
The result
With this merged, the fork handles static scenery and animated characters under compression at the same time. Texture memory stays low through GPU compression, and rigged models now animate correctly on mobile.