Add checking for failed downloads in the textures

This commit is contained in:
Brad Davis 2016-08-24 18:03:56 -07:00
parent c5628b615c
commit 5cdb30357f
2 changed files with 18 additions and 2 deletions

View file

@ -330,9 +330,22 @@ bool Geometry::areTexturesLoaded() const {
if (!_areTexturesLoaded) {
for (auto& material : _materials) {
// Check if material textures are loaded
if (std::any_of(material->_textures.cbegin(), material->_textures.cend(),
[](const NetworkMaterial::Textures::value_type& it) { return it.texture && !it.texture->isLoaded(); })) {
bool materialMissingTexture = std::any_of(material->_textures.cbegin(), material->_textures.cend(),
[](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;
}

View file

@ -282,6 +282,9 @@ public:
/// Checks whether the resource has 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.
qint64 getBytesReceived() const { return _bytesReceived; }