Repair iOS error due to STBI_NO_STDIO.

Fixes #2072.
This commit is contained in:
Philip Rideout
2020-01-28 10:19:11 -08:00
parent 06726fe361
commit e1b498f82c
2 changed files with 8 additions and 4 deletions

View File

@@ -22,6 +22,11 @@
#define STBI_NO_HDR
#define STBI_NO_PIC
#define STBI_NO_PNM
// For emscripten and Android builds, we never load from the file
// system, so we-opt out of the stdio functionality in stb.
#if defined(__EMSCRIPTEN__) || defined(ANDROID)
#define STBI_NO_STDIO
#endif
#include <stb_image.h>

View File

@@ -15,6 +15,7 @@
*/
#include <gltfio/ResourceLoader.h>
#include <gltfio/Image.h>
#include "FFilamentAsset.h"
#include "upcast.h"
@@ -36,8 +37,6 @@
#include <cgltf.h>
#include <stb_image.h>
#include <tsl/robin_map.h>
#include <string>
@@ -147,7 +146,7 @@ bool ResourceLoader::loadResources(FilamentAsset* asset) {
// looks inside a cache of externally-supplied data blobs, rather than loading from the
// filesystem.
#if defined(__EMSCRIPTEN__) || defined(ANDROID)
#if defined(STBI_NO_STDIO)
if (gltf->buffers_count && !gltf->buffers[0].data && !gltf->buffers[0].uri && gltf->bin) {
if (gltf->bin_size < gltf->buffers[0].size) {
@@ -378,7 +377,7 @@ bool ResourceLoader::createTextures(details::FFilamentAsset* asset) const {
js->run(decode);
}
} else {
#if defined(__EMSCRIPTEN__) || defined(ANDROID)
#if defined(STBI_NO_STDIO)
slog.e << "Unable to load texture: " << tb.uri << io::endl;
return false;
#else