diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index d181348276..6b28d9c713 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -14,7 +14,7 @@ #include #include "EntityTreeRenderer.h" -#include "ModelEntityItem.h" +#include "RenderableModelEntityItem.h" #include "InterfaceLogging.h" #include "Application.h" @@ -123,19 +123,18 @@ bool SafeLanding::isLoadSequenceComplete() { float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); - static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; - float percentage = 0.0f; + float entityReadyPercentage = 0.0f; if (_maxTrackedEntityCount > 0) { - percentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); + entityReadyPercentage = ((_maxTrackedEntityCount - _trackedEntities.size()) / (float)_maxTrackedEntityCount); } if (_trackedEntityStabilityCount < MINIMUM_TRACKED_ENTITY_STABILITY_COUNT) { - percentage *= 0.20f; + entityReadyPercentage *= 0.20f; } - return percentage; + return entityReadyPercentage; } bool SafeLanding::isSequenceNumbersComplete() { @@ -148,7 +147,7 @@ bool SafeLanding::isSequenceNumbersComplete() { if (sequenceSize == 0 || (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() - && distance(startIter, endIter) == sequenceSize - 1) ) { + && distance(startIter, endIter) == sequenceSize - 1)) { _trackingEntities = false; // Don't track anything else that comes in. return true; } @@ -160,13 +159,13 @@ bool isEntityPhysicsReady(const EntityItemPointer& entity) { if (entity && !entity->getCollisionless()) { const auto& entityType = entity->getType(); if (entityType == EntityTypes::Model) { - ModelEntityItem * modelEntity = std::dynamic_pointer_cast(entity).get(); + RenderableModelEntityItem * modelEntity = std::dynamic_pointer_cast(entity).get(); static const std::set downloadedCollisionTypes { SHAPE_TYPE_COMPOUND, SHAPE_TYPE_SIMPLE_COMPOUND, SHAPE_TYPE_STATIC_MESH, SHAPE_TYPE_SIMPLE_HULL }; bool hasAABox; entity->getAABox(hasAABox); if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) { - return (!entity->shouldBePhysical() || entity->isReadyToComputeShape()); + return (!entity->shouldBePhysical() || entity->isReadyToComputeShape() || modelEntity->computeShapeFailedToLoad()); } } } @@ -192,8 +191,6 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); - - qDebug() << "EntityTpye" << EntityTypes::getEntityTypeName(entity->getType()) << entity->getEntityItemID() << isVisuallyReady; } if (isEntityPhysicsReady(entity) && isVisuallyReady) { @@ -209,7 +206,6 @@ bool SafeLanding::isEntityLoadingComplete() { if (enableInterstitial) { _trackedEntityStabilityCount++; - qDebug() << "EntityList size" << _trackedEntities.size() << "\n"; } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 3a01650a04..7df9762158 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -314,6 +314,14 @@ void RenderableModelEntityItem::getCollisionGeometryResource() { _compoundShapeResource = DependencyManager::get()->getCollisionGeometryResource(hullURL); } +bool RenderableModelEntityItem::computeShapeFailedToLoad() { + if (!_compoundShapeResource) { + getCollisionGeometryResource(); + } + + return (_compoundShapeResource && _compoundShapeResource->isFailed()); +} + void RenderableModelEntityItem::setShapeType(ShapeType type) { ModelEntityItem::setShapeType(type); if (getShapeType() == SHAPE_TYPE_COMPOUND) { @@ -342,7 +350,6 @@ void RenderableModelEntityItem::setCompoundShapeURL(const QString& url) { bool RenderableModelEntityItem::isReadyToComputeShape() const { ShapeType type = getShapeType(); - auto model = getModel(); if (type == SHAPE_TYPE_COMPOUND) { if (!model || getCompoundShapeURL().isEmpty()) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 75f35fae9c..6fcfa04a1d 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -81,6 +81,7 @@ public: virtual bool isReadyToComputeShape() const override; virtual void computeShapeInfo(ShapeInfo& shapeInfo) override; + bool computeShapeFailedToLoad(); virtual bool contains(const glm::vec3& point) const override; void stopModelOverrideIfNoParent(); diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index f669e8aaef..4d6297303b 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -551,6 +551,11 @@ QUrl NetworkMaterial::getTextureUrl(const QUrl& baseUrl, const FBXTexture& textu graphics::TextureMapPointer NetworkMaterial::fetchTextureMap(const QUrl& baseUrl, const FBXTexture& fbxTexture, image::TextureUsage::Type type, MapChannel channel) { + + if (baseUrl.isEmpty()) { + return nullptr; + } + const auto url = getTextureUrl(baseUrl, fbxTexture); const auto texture = DependencyManager::get()->getTexture(url, type, fbxTexture.content, fbxTexture.maxNumPixels); _textures[channel] = Texture { fbxTexture.name, texture }; diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 00d62d7fc6..f066529375 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -264,6 +264,7 @@ function domainChanged(domain) { if (domain !== currentDomain) { MyAvatar.restoreAnimation(); + resetValues(); var name = location.placename; domainName = name.charAt(0).toUpperCase() + name.slice(1); var doRequest = true;