Error message and hint to asset pack if asset loading (model, texture) fails
This commit is contained in:
parent
02bb523e5b
commit
a3e3dd999f
2 changed files with 16 additions and 6 deletions
|
|
@ -184,6 +184,10 @@ namespace vks
|
||||||
free(meshData);
|
free(meshData);
|
||||||
#else
|
#else
|
||||||
pScene = Importer.ReadFile(filename.c_str(), flags);
|
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
|
#endif
|
||||||
|
|
||||||
if (pScene)
|
if (pScene)
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,9 @@ namespace vks
|
||||||
// Textures are stored inside the apk on Android (compressed)
|
// Textures are stored inside the apk on Android (compressed)
|
||||||
// So they need to be loaded via the asset manager
|
// So they need to be loaded via the asset manager
|
||||||
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING);
|
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);
|
size_t size = AAsset_getLength(asset);
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
|
|
@ -105,7 +107,7 @@ namespace vks
|
||||||
free(textureData);
|
free(textureData);
|
||||||
#else
|
#else
|
||||||
if (!vks::tools::fileExists(filename)) {
|
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()));
|
gli::texture2d tex2D(gli::load(filename.c_str()));
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -570,7 +572,9 @@ namespace vks
|
||||||
// Textures are stored inside the apk on Android (compressed)
|
// Textures are stored inside the apk on Android (compressed)
|
||||||
// So they need to be loaded via the asset manager
|
// So they need to be loaded via the asset manager
|
||||||
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING);
|
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);
|
size_t size = AAsset_getLength(asset);
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
|
|
@ -583,7 +587,7 @@ namespace vks
|
||||||
free(textureData);
|
free(textureData);
|
||||||
#else
|
#else
|
||||||
if (!vks::tools::fileExists(filename)) {
|
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));
|
gli::texture2d_array tex2DArray(gli::load(filename));
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -779,7 +783,9 @@ namespace vks
|
||||||
// Textures are stored inside the apk on Android (compressed)
|
// Textures are stored inside the apk on Android (compressed)
|
||||||
// So they need to be loaded via the asset manager
|
// So they need to be loaded via the asset manager
|
||||||
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, filename.c_str(), AASSET_MODE_STREAMING);
|
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);
|
size_t size = AAsset_getLength(asset);
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
|
|
@ -792,7 +798,7 @@ namespace vks
|
||||||
free(textureData);
|
free(textureData);
|
||||||
#else
|
#else
|
||||||
if (!vks::tools::fileExists(filename)) {
|
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));
|
gli::texture_cube texCube(gli::load(filename));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue