Skip to content

Commit

Permalink
FIX: Exporting a GLB without data chunk now produces a valid file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ziriax committed Mar 16, 2021
1 parent 5b1309a commit efac516
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ExportableAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ void ExportableAsset::save() {
const int headerLength = 12;
const int chunkHeaderLength = 8;

writeHeader[1] = headerLength + (chunkHeaderLength + jsonLength + jsonPadding) +
(chunkHeaderLength + bufferLength + binPadding); // length
const int dataChunkSize = bufferLength ? (chunkHeaderLength + bufferLength + binPadding) : 0;

writeHeader[1] = headerLength + (chunkHeaderLength + jsonLength + jsonPadding) + dataChunkSize; // length

file.write(reinterpret_cast<char *>(writeHeader),
sizeof(uint32_t) * 2); // GLB header
Expand Down

0 comments on commit efac516

Please sign in to comment.