From 62be8d04cfa535bd7659a99cc43dc8190add178f Mon Sep 17 00:00:00 2001 From: rainliang000 Date: Mon, 29 Apr 2019 09:54:27 +0800 Subject: [PATCH] if image.uri empty, should use bufferview if uri empty, shoud use mimeType and bufferview --- tiny_gltf.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index b499184..6871963 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -4892,7 +4892,14 @@ static void SerializeGltfBufferView(BufferView &bufferView, json &o) { } static void SerializeGltfImage(Image &image, json &o) { - SerializeStringProperty("uri", image.uri, o); + // if uri empty, the mimeType and bufferview should be set + if (image.uri.empty()) { + SerializeStringProperty("mimeType", image.mimeType, o); + SerializeNumberProperty("bufferView", image.bufferView, o); + } + else { + SerializeStringProperty("uri", image.uri, o); + } if (image.name.size()) { SerializeStringProperty("name", image.name, o);