Merge pull request #52 from Selmar/opt_out_external_image_loading

Allow opting out of external image loading
This commit is contained in:
Syoyo Fujita 2018-03-16 17:26:49 -05:00 committed by GitHub
commit f1cdd1c4cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1685,7 +1685,12 @@ static bool ParseImage(Image *image, std::string *err, const json &o,
if (IsDataURI(uri)) {
loaded = DecodeDataURI(&img, uri, 0, false);
} else {
// Assume external .bin file.
// Assume external file
// Keep texture path (for textures that cannot be decoded)
image->uri = uri;
#ifdef TINYGLTF_NO_EXTERNAL_IMAGE
return true;
#endif
loaded = LoadExternalFile(&img, err, uri, basedir, 0, false);
}
@ -1733,10 +1738,11 @@ static bool ParseImage(Image *image, std::string *err, const json &o,
}
} else {
// Assume external file
// Keep texture path (for textures that cannot be decoded)
image->uri = uri;
#ifdef TINYGLTF_NO_EXTERNAL_IMAGE
return true;
#endif
if (!LoadExternalFile(&img, err, uri, basedir, 0, false)) {
if (err) {
(*err) += "Failed to load external 'uri' for image parameter\n";