Open ru-imajion opened 10 months ago
One subtlety that this is missing from #228 is cgltf_accessor_read_float / cgltf_accessor_unpack_floats. These should continue to use 32-bit float types, one because glTF data contained in accessors can't be double precision, two because these functions have fast paths that directly copy 32-bit floats.
We should also audit uses of cgltf_component_type_r_32f to double check that these don't use cgltf_float.
All of this could probably use cgltf_float32 to be explicit; standard float types are probably not a good idea once we have this configuration define.
Also cgltf_write's CGLTF_DECIMAL_DIG constant probably needs to be updated here.
cgltf_accessor_read_float looks ok to me. I think you may be right about cgltf_accessor_unpack_floats, all tests are passing now, so I'll create a test that fails it and come up with a patch.
cgltf_float32 is a fine idea, there seemed to already be an assumption that float was 32 bits so I went with it, but this is an easy change.
I need more time to understand CGLTF_DECIMAL_DIG a bit more, but you have a point here.
This allows cgltf_float to be set to double. Resolves #228.