diff --git a/base/VulkanModel.hpp b/base/VulkanModel.hpp index daf8dc16..20c8ea10 100644 --- a/base/VulkanModel.hpp +++ b/base/VulkanModel.hpp @@ -184,6 +184,10 @@ namespace vks free(meshData); #else pScene = Importer.ReadFile(filename.c_str(), flags); + if (!pScene) { + std::string error = Importer.GetErrorString(); + vks::tools::exitFatal(error + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); + } #endif if (pScene) diff --git a/base/VulkanTexture.hpp b/base/VulkanTexture.hpp index b9311862..456bf94b 100644 --- a/base/VulkanTexture.hpp +++ b/base/VulkanTexture.hpp @@ -92,7 +92,9 @@ namespace vks // Textures are stored inside the apk on Android (compressed) // So they need to be loaded via the asset manager AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING); - assert(asset); + if (!asset) { + vks::tools::exitFatal("Could not load texture from " + filename + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); + } size_t size = AAsset_getLength(asset); assert(size > 0); @@ -105,7 +107,7 @@ namespace vks free(textureData); #else if (!vks::tools::fileExists(filename)) { - vks::tools::exitFatal("Could not load texture from " + filename, "File not found"); + vks::tools::exitFatal("Could not load texture from " + filename + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); } gli::texture2d tex2D(gli::load(filename.c_str())); #endif @@ -570,7 +572,9 @@ namespace vks // Textures are stored inside the apk on Android (compressed) // So they need to be loaded via the asset manager AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING); - assert(asset); + if (!asset) { + vks::tools::exitFatal("Could not load texture from " + filename + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); + } size_t size = AAsset_getLength(asset); assert(size > 0); @@ -583,7 +587,7 @@ namespace vks free(textureData); #else if (!vks::tools::fileExists(filename)) { - vks::tools::exitFatal("Could not load texture from " + filename, "File not found"); + vks::tools::exitFatal("Could not load texture from " + filename + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); } gli::texture2d_array tex2DArray(gli::load(filename)); #endif @@ -779,7 +783,9 @@ namespace vks // Textures are stored inside the apk on Android (compressed) // So they need to be loaded via the asset manager AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING); - assert(asset); + if (!asset) { + vks::tools::exitFatal("Could not load texture from " + filename + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); + } size_t size = AAsset_getLength(asset); assert(size > 0); @@ -792,7 +798,7 @@ namespace vks free(textureData); #else if (!vks::tools::fileExists(filename)) { - vks::tools::exitFatal("Could not load texture from " + filename, "File not found"); + vks::tools::exitFatal("Could not load texture from " + filename + "\n\nThe file may be part of the additional asset pack.\n\nRun \"download_assets.py\" in the repository root to download the latest version.", "Error"); } gli::texture_cube texCube(gli::load(filename)); #endif