Skip to content

Commit

Permalink
Change: Use named GLB constants
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Mar 16, 2023
1 parent a334d38 commit d2bf171
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/fastgltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ namespace fastgltf {
ParserData& operator=(const ParserData& other) = delete;
};

// ASCII for "glTF".
constexpr uint32_t binaryGltfHeaderMagic = 0x46546C67;
constexpr uint32_t binaryGltfHeaderMagic = 0x46546C67; // ASCII for "glTF".
constexpr uint32_t binaryGltfJsonChunkMagic = 0x4E4F534A;
constexpr uint32_t binaryGltfDataChunkMagic = 0x004E4942;

struct BinaryGltfHeader {
uint32_t magic;
Expand Down Expand Up @@ -2220,7 +2221,7 @@ std::unique_ptr<fg::glTF> fg::Parser::loadBinaryGLTF(GltfDataBuffer* buffer, fs:
// 2. BIN chunk (optional)
BinaryGltfChunk jsonChunk = {};
read(&jsonChunk, sizeof jsonChunk);
if (jsonChunk.chunkType != 0x4E4F534A) {
if (jsonChunk.chunkType != binaryGltfJsonChunkMagic) {
errorCode = Error::InvalidGLB;
return nullptr;
}
Expand All @@ -2245,7 +2246,7 @@ std::unique_ptr<fg::glTF> fg::Parser::loadBinaryGLTF(GltfDataBuffer* buffer, fs:
BinaryGltfChunk binaryChunk = {};
read(&binaryChunk, sizeof binaryChunk);

if (binaryChunk.chunkType != 0x004E4942) {
if (binaryChunk.chunkType != binaryGltfDataChunkMagic) {
errorCode = Error::InvalidGLB;
return nullptr;
}
Expand Down

0 comments on commit d2bf171

Please sign in to comment.