mirror of
https://github.com/lubosz/overte.git
synced 2025-08-11 11:17:10 +02:00
Add checking for failed downloads in the textures
This commit is contained in:
parent
c5628b615c
commit
5cdb30357f
2 changed files with 18 additions and 2 deletions
|
@ -330,9 +330,22 @@ bool Geometry::areTexturesLoaded() const {
|
||||||
if (!_areTexturesLoaded) {
|
if (!_areTexturesLoaded) {
|
||||||
for (auto& material : _materials) {
|
for (auto& material : _materials) {
|
||||||
// Check if material textures are loaded
|
// Check if material textures are loaded
|
||||||
if (std::any_of(material->_textures.cbegin(), material->_textures.cend(),
|
bool materialMissingTexture = std::any_of(material->_textures.cbegin(), material->_textures.cend(),
|
||||||
[](const NetworkMaterial::Textures::value_type& it) { return it.texture && !it.texture->isLoaded(); })) {
|
[](const NetworkMaterial::Textures::value_type& it) {
|
||||||
|
auto texture = it.texture;
|
||||||
|
if (!texture) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Failed texture downloads need to be considered as 'loaded'
|
||||||
|
// or the object will never fade in
|
||||||
|
bool finished = texture->isLoaded() || texture->isFailed();
|
||||||
|
if (!finished) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (materialMissingTexture) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -282,6 +282,9 @@ public:
|
||||||
/// Checks whether the resource has loaded.
|
/// Checks whether the resource has loaded.
|
||||||
virtual bool isLoaded() const { return _loaded; }
|
virtual bool isLoaded() const { return _loaded; }
|
||||||
|
|
||||||
|
/// Checks whether the resource has failed to download.
|
||||||
|
virtual bool isFailed() const { return _failedToLoad; }
|
||||||
|
|
||||||
/// For loading resources, returns the number of bytes received.
|
/// For loading resources, returns the number of bytes received.
|
||||||
qint64 getBytesReceived() const { return _bytesReceived; }
|
qint64 getBytesReceived() const { return _bytesReceived; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue