jkuhlmann / cgltf

:diamond_shape_with_a_dot_inside: Single-file glTF 2.0 loader and writer written in C99
MIT License
1.44k stars 136 forks source link

BigEndian support #150

Open UkooLabs opened 3 years ago

UkooLabs commented 3 years ago

would it be possible to add support for BigEndian

jkuhlmann commented 3 years ago

For what would the be applicable? Are you having issues with endianess? Where does it break?

UkooLabs commented 3 years ago

@jkuhlmann in my case Xbox 360. I have made some modifications which has made it work. But maybe a better more complete way to do it that also supports writing as only done some read side.

I'm not sure what other platforms I'll be using that will also need big endian yet.

jkuhlmann commented 3 years ago

Yeah, I think there aren't too many platforms left that default to big endian nowadays. The Xbox 360 seems hardly relevant when the Series X is out. :wink: Anyway, if you could share some sample code of what you fixed and how you did it, that might help me make a better decision on what we can do and if we should do something.

UkooLabs commented 3 years ago

@jkuhlmann

Changes.zip

I have attached a zip showing my changes. You will see int.h which add various int types not available for XBOX Original. Then the endian helper which checks for endianness and can convert values.

Since im not 100% familular with clgtf I may of missed conversion of endianess, if you see any please let me know but loading models on a Xbox 360 seems to work fine and render.

As a note it seems the Xbox Original / 360 / X scene is opening up again and im one of a few teams bringing new dashboards / apps to those consoles as well as other platforms