Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgltf_node transform attributes are now store in double #239

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bcomb
Copy link
Contributor

@bcomb bcomb commented Nov 27, 2023

Some GLTF contain huge value in translation and reading these as float cause lost in precision. Google store big translation in their 'Photorealistic 3D Tiles' data

Some GLTF contain huge value in translation and reading these as float cause lost in precision. Google store big translation in their 'Photorealistic 3D Tiles' data
@jkuhlmann
Copy link
Owner

Hey! The tests failed unfortunately.
Also, do you think it would make sense to combine this with the changes in #229?

@zeux
Copy link
Contributor

zeux commented Nov 27, 2023

Related: #228 outlines the caveats around compatibility with an unconditional change like this. That said, #229 has a much wider scope that technically isn't required there. Maybe a good middleground would be something like cgltf_xfloat that's only used for transform components, still defaults to float (unlike this change), can be configured via a macro? That would keep backwards compatibility but also have a narrow scope unlike #229.

@bcomb
Copy link
Contributor Author

bcomb commented Nov 27, 2023

Hi, I've fix the test.

Technically, all attributes of the JSON text block should be read in double precision; the GLTF specification does not specify a storage of floating-point numbers in 32-bit. In practice, I do not see the necessity of transforming everything into double precision except for the transform related components.

I understand the compatibility caveat of this kind of modification, but the required modification is still very straightforward. However, if it seems essential for CGLTF, the solution proposed by @zeux looks good to me (cgltf_xfloat used only for the transform related attributes and a CGLTF_USE_DOUBLE_PRECISION_TRANSFORM macro to control activation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants