From d29173aaa90a4dcb7735d259644e7b9be605d642 Mon Sep 17 00:00:00 2001 From: Alexis Breust Date: Thu, 14 Dec 2017 17:32:18 +0100 Subject: [PATCH] Following specification for padding --- code/glTF2AssetWriter.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/glTF2AssetWriter.inl b/code/glTF2AssetWriter.inl index 9734dc7c8..6b1a50887 100644 --- a/code/glTF2AssetWriter.inl +++ b/code/glTF2AssetWriter.inl @@ -569,8 +569,8 @@ namespace glTF2 { throw DeadlyExportError("Could not open output file: " + std::string(path)); } - // Padding with zeros make a invalid JSON for the gltf online validator - uint8_t padding[] = { '\n', '\n', '\n' }; + // Padding with spaces as required by the spec + uint32_t padding = 0x20202020; // Adapt JSON so that it is not pointing to an external file, // as this is required by the GLB spec'. @@ -599,7 +599,7 @@ namespace glTF2 { if (outfile->Write(docBuffer.GetString(), 1, docBuffer.GetSize()) != docBuffer.GetSize()) { throw DeadlyExportError("Failed to write scene data!"); } - if (paddingLength && outfile->Write(padding, 1, paddingLength) != paddingLength) { + if (paddingLength && outfile->Write(&padding, 1, paddingLength) != paddingLength) { throw DeadlyExportError("Failed to write scene data padding!"); } @@ -627,7 +627,7 @@ namespace glTF2 { if (outfile->Write(b->GetPointer(), 1, b->byteLength) != b->byteLength) { throw DeadlyExportError("Failed to write body data!"); } - if (paddingLength && outfile->Write(padding, 1, paddingLength) != paddingLength) { + if (paddingLength && outfile->Write(&padding, 1, paddingLength) != paddingLength) { throw DeadlyExportError("Failed to write body data padding!"); } }