spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability
https://fastgltf.readthedocs.io/v0.8.x/
MIT License
275 stars 42 forks source link

Fix: Accessor's component type is forced #59

Closed Razakhel closed 5 months ago

Razakhel commented 5 months ago

Context

Problem occurred on a GLB file that had an indices accessor of an unsigned short component type, but with their max & min bounds written as double values. This is valid by the glTF spec, as per https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_accessor_max and https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_accessor_min:

Array elements MUST be treated as having the same data type as accessor’s componentType.