Showing the changes to interface/src/Application.cpp (1 of 21 files). Show all
Unified · Split
| @@ -2277,12 +2277,12 @@ void Application::initialize(const QCommandLineParser &parser) { · 2276 unmodified lines | ||
| 2277 | 2277 | auto loadingRequests = ResourceCache::getLoadingRequests(); |
| 2278 | 2278 | |
| 2279 | 2279 | QJsonArray loadingRequestsStats; |
| 2280 | − for (const auto& request : loadingRequests) { | |
| 2280 | + for (const auto& requestPair : loadingRequests) { | |
| 2281 | 2281 | QJsonObject requestStats; |
| 2282 | − requestStats["filename"] = request->getURL().fileName(); | |
| 2283 | − requestStats["received"] = request->getBytesReceived(); | |
| 2284 | − requestStats["total"] = request->getBytesTotal(); | |
| 2285 | − requestStats["attempts"] = (int)request->getDownloadAttempts(); | |
| 2282 | + requestStats["filename"] = requestPair.first->getURL().fileName(); | |
| 2283 | + requestStats["received"] = requestPair.first->getBytesReceived(); | |
| 2284 | + requestStats["total"] = requestPair.first->getBytesTotal(); | |
| 2285 | + requestStats["attempts"] = (int)requestPair.first->getDownloadAttempts(); | |
| 2286 | 2286 | loadingRequestsStats.append(requestStats); |
| 2287 | 2287 | } |
| 2288 | 2288 | |
| @@ -5731,15 +5731,30 @@ void Application::init() { · 3442 unmodified lines | ||
| 5731 | 5731 | |
| 5732 | 5732 | getEntities()->init(); |
| 5733 | 5733 | getEntities()->setEntityLoadingPriorityFunction([this](const EntityItem& item) { |
| 5734 | − auto dims = item.getScaledDimensions(); | |
| 5735 | − auto maxSize = glm::compMax(dims); | |
| 5734 | + if (item.getEntityHostType() == entity::HostType::AVATAR) { | |
| 5735 | + return item.isMyAvatarEntity() ? Avatar::MYAVATAR_ENTITY_LOADING_PRIORITY : Avatar::OTHERAVATAR_ENTITY_LOADING_PRIORITY; | |
| 5736 | + } | |
| 5736 | 5737 | |
| 5738 | + const float maxSize = glm::compMax(item.getScaledDimensions()); | |
| 5737 | 5739 | if (maxSize <= 0.0f) { |
| 5738 | 5740 | return 0.0f; |
| 5739 | 5741 | } |
| 5740 | 5742 | |
| 5741 | − auto distance = glm::distance(getMyAvatar()->getWorldPosition(), item.getWorldPosition()); | |
| 5742 | − return atan2(maxSize, distance); | |
| 5743 | + const glm::vec3 itemPosition = item.getWorldPosition(); | |
| 5744 | + const float distance = glm::distance(getMyAvatar()->getWorldPosition(), itemPosition); | |
| 5745 | + float result = atan2(maxSize, distance); | |
| 5746 | + | |
| 5747 | + bool isInView = true; | |
| 5748 | + { | |
| 5749 | + QMutexLocker viewLocker(&_viewMutex); | |
| 5750 | + isInView = _viewFrustum.sphereIntersectsKeyhole(itemPosition, maxSize); | |
| 5751 | + } | |
| 5752 | + if (!isInView) { | |
| 5753 | + const float OUT_OF_VIEW_PENALTY = -M_PI_2; | |
| 5754 | + result += OUT_OF_VIEW_PENALTY; | |
| 5755 | + } | |
| 5756 | + | |
| 5757 | + return result; | |
| 5743 | 5758 | }); |
| 5744 | 5759 | |
| 5745 | 5760 | ObjectMotionState::setShapeManager(&_shapeManager); |