From 040310e0d39ded3bc5d3aa6597568bf0d2867a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Kov=C3=A1=C5=99?= Date: Wed, 17 Oct 2018 15:24:59 +0200 Subject: [PATCH 1/4] Added include direectory ../common/ for trackball.h --- examples/glview/premake5.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/glview/premake5.lua b/examples/glview/premake5.lua index 1f41493..938d008 100644 --- a/examples/glview/premake5.lua +++ b/examples/glview/premake5.lua @@ -11,6 +11,7 @@ solution "glview" files { "glview.cc", "../common/trackball.cc" } includedirs { "./" } includedirs { "../../" } + includedirs { "../common/" } configuration { "linux" } linkoptions { "`pkg-config --libs glfw3`" } From a645cfc840d39b2f828436ce4c6b548909013b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Kov=C3=A1=C5=99?= Date: Wed, 17 Oct 2018 15:24:59 +0200 Subject: [PATCH 2/4] Added include directory ../common/ for trackball.h --- examples/glview/premake5.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/glview/premake5.lua b/examples/glview/premake5.lua index 1f41493..938d008 100644 --- a/examples/glview/premake5.lua +++ b/examples/glview/premake5.lua @@ -11,6 +11,7 @@ solution "glview" files { "glview.cc", "../common/trackball.cc" } includedirs { "./" } includedirs { "../../" } + includedirs { "../common/" } configuration { "linux" } linkoptions { "`pkg-config --libs glfw3`" } From 33514af61a3a243c6b593755097140ba74be5bb9 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Mon, 5 Nov 2018 13:32:43 +0900 Subject: [PATCH 3/4] Fix logic error. Fixes #104 --- tiny_gltf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index b42020e..f33f8e9 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -1703,7 +1703,7 @@ bool WriteImageData(const std::string *basepath, const std::string *filename, } else { // Write image to disc FsCallbacks *fs = reinterpret_cast(fsPtr); - if (fs != nullptr && fs->WriteWholeFile == nullptr) { + if ((fs != nullptr) && (fs->WriteWholeFile != nullptr)) { const std::string imagefilepath = JoinPath(*basepath, *filename); std::string writeError; if (!fs->WriteWholeFile(&writeError, imagefilepath, data, From 77decfaff87bdc576cdc9481bc28be0d4f8faf70 Mon Sep 17 00:00:00 2001 From: Johan Bowald Date: Tue, 6 Nov 2018 14:28:20 +0100 Subject: [PATCH 4/4] 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); }