However the internal enumeration uses a different coding than the GLTF standard, which causes the type written to be one larger than the correct value.
So if a file is read, written, read back and written again, the primitive type increases by one each time.
A quick fix is to subtract 1 from the internal code, but better would be to have a function to map the enumeration back to a GLTF code.
In cgltf_write the GLTF primitive type is written by converting the internal enumeration with a cast to int:
However the internal enumeration uses a different coding than the GLTF standard, which causes the type written to be one larger than the correct value. So if a file is read, written, read back and written again, the primitive type increases by one each time. A quick fix is to subtract 1 from the internal code, but better would be to have a function to map the enumeration back to a GLTF code.
Thanks for the library.
Mark Huckvale