From 77decfaff87bdc576cdc9481bc28be0d4f8faf70 Mon Sep 17 00:00:00 2001 From: Johan Bowald Date: Tue, 6 Nov 2018 14:28:20 +0100 Subject: [PATCH 1/2] fixed a reference error which cause an error when writing images to disk --- tiny_gltf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 0f1ed83..a376344 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -4130,7 +4130,7 @@ static void SerializeExtensionMap(ExtensionMap &extensions, json &o) { extMap[extIt->first] = ret; } if(ret.is_null()) { - if (!(extIt->first.empty())) { // name should not be empty, but for sure + if (!(extIt->first.empty())) { // name should not be empty, but for sure // create empty object so that an extension name is still included in json. extMap[extIt->first] = json({}); } @@ -4597,7 +4597,7 @@ bool TinyGLTF::WriteGltfSceneToFile(Model *model, const std::string &filename, } else { std::string binSavePath; std::string binUri; - if (!model->buffers[i].uri.empty() + if (!model->buffers[i].uri.empty() && !IsDataURI(model->buffers[i].uri)) { binUri = model->buffers[i].uri; } @@ -4654,7 +4654,7 @@ bool TinyGLTF::WriteGltfSceneToFile(Model *model, const std::string &filename, json image; UpdateImageObject(model->images[i], baseDir, int(i), embedImages, - &this->WriteImageData, &this->write_image_user_data_); + &this->WriteImageData, this->write_image_user_data_); SerializeGltfImage(model->images[i], image); images.push_back(image); } From a3595488e3ee249bef51bb05d3e405dad88806d0 Mon Sep 17 00:00:00 2001 From: Selmar Kok Date: Fri, 9 Nov 2018 10:34:39 +0100 Subject: [PATCH 2/2] Fix missing serialization: sampler.wrapR --- tiny_gltf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tiny_gltf.h b/tiny_gltf.h index 464fc5a..c7710fc 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -4441,6 +4441,7 @@ static void SerializeGltfNode(Node &node, json &o) { static void SerializeGltfSampler(Sampler &sampler, json &o) { SerializeNumberProperty("magFilter", sampler.magFilter, o); SerializeNumberProperty("minFilter", sampler.minFilter, o); + SerializeNumberProperty("wrapR", sampler.wrapR, o); SerializeNumberProperty("wrapS", sampler.wrapS, o); SerializeNumberProperty("wrapT", sampler.wrapT, o);