mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-17 00:45:52 +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)) {
|
if (IsDataURI(uri)) {
|
||||||
loaded = DecodeDataURI(&img, uri, 0, false);
|
loaded = DecodeDataURI(&img, uri, 0, false);
|
||||||
} else {
|
} 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);
|
loaded = LoadExternalFile(&img, err, uri, basedir, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1717,10 +1722,11 @@ static bool ParseImage(Image *image, std::string *err,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Assume external file
|
// Assume external file
|
||||||
|
|
||||||
// Keep texture path (for textures that cannot be decoded)
|
// Keep texture path (for textures that cannot be decoded)
|
||||||
image->uri = uri;
|
image->uri = uri;
|
||||||
|
#ifdef TINYGLTF_NO_EXTERNAL_IMAGE
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
if (!LoadExternalFile(&img, err, uri, basedir, 0, false)) {
|
if (!LoadExternalFile(&img, err, uri, basedir, 0, false)) {
|
||||||
if (err) {
|
if (err) {
|
||||||
(*err) += "Failed to load external 'uri' for image parameter\n";
|
(*err) += "Failed to load external 'uri' for image parameter\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user