Added 'warning' message parameter to glTF loader API.

Asset loading failure messages(e.g. image file is missing) are now stored in `warning` message, not `error` message.
This commit is contained in:
Syoyo Fujita
2018-07-27 16:49:10 +09:00
parent a71be9cc98
commit 7c8d4ed748
7 changed files with 162 additions and 154 deletions
+7 -2
View File
@@ -26,15 +26,20 @@ bool LoadGLTF(const std::string &filename, float scale,
tinygltf::Model model;
tinygltf::TinyGLTF loader;
std::string err;
std::string warn;
const std::string ext = GetFilePathExtension(filename);
bool ret = false;
if (ext.compare("glb") == 0) {
// assume binary glTF.
ret = loader.LoadBinaryFromFile(&model, &err, filename.c_str());
ret = loader.LoadBinaryFromFile(&model, &err, &warn, filename.c_str());
} else {
// assume ascii glTF.
ret = loader.LoadASCIIFromFile(&model, &err, filename.c_str());
ret = loader.LoadASCIIFromFile(&model, &err, &warn, filename.c_str());
}
if (!warn.empty()) {
std::cout << "glTF parse warning: " << warn << std::endl;
}
if (!err.empty()) {