mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-16 08:15:55 +08:00
Allow opting out of external image loading
We do not require image loading for external files, we have separate texture directories at the moment. I've also added saving the image->uri when loading a binary gltf.
This commit is contained in:
parent
4f0b893d73
commit
67af3c98aa
12
tiny_gltf.h
12
tiny_gltf.h
@ -1670,7 +1670,12 @@ static bool ParseImage(Image *image, std::string *err,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1717,10 +1722,11 @@ static bool ParseImage(Image *image, std::string *err,
|
||||
}
|
||||
} 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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user