1) The trailing padding for the BIN chunk was applied between chunkType and chunkData instead of after chunkData (terms from the glTF Specs)
2) The padding code was not adding the right amount of bytes (e.g. for a chunk size of 11, it was adding 3 bytes instead of 1).
I also refactored a few lines to have the same code structure of "write and pad" for the JSON and BIN chunks
This PR fixes two bugs:
1) The trailing padding for the BIN chunk was applied between
chunkType
andchunkData
instead of afterchunkData
(terms from the glTF Specs) 2) The padding code was not adding the right amount of bytes (e.g. for a chunk size of 11, it was adding 3 bytes instead of 1).I also refactored a few lines to have the same code structure of "write and pad" for the JSON and BIN chunks