Showing the changes to interface/src/Application.cpp (1 of 126 files). Show all
Unified · Split
| @@ -297,7 +297,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 296 unmodified lines | |||
| 297 | _lastSendDownstreamAudioStats(usecTimestampNow()), | 297 | _lastSendDownstreamAudioStats(usecTimestampNow()), |
| 298 | _isVSyncOn(true), | 298 | _isVSyncOn(true), |
| 299 | _aboutToQuit(false), | 299 | _aboutToQuit(false), |
| 300 | _notifiedPacketVersionMismatchThisDomain(false) | 300 | _notifiedPacketVersionMismatchThisDomain(false), |
| 301 | _domainConnectionRefusals(QList<QString>()) | ||
| 301 | { | 302 | { |
| 302 | #ifdef Q_OS_WIN | 303 | #ifdef Q_OS_WIN |
| 303 | installNativeEventFilter(&MyNativeEventFilter::getInstance()); | 304 | installNativeEventFilter(&MyNativeEventFilter::getInstance()); |
| @@ -344,6 +345,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 40 unmodified lines | |||
| 344 | // put the NodeList and datagram processing on the node thread | 345 | // put the NodeList and datagram processing on the node thread |
| 345 | nodeList->moveToThread(nodeThread); | 346 | nodeList->moveToThread(nodeThread); |
| 346 | 347 | ||
| 348 | // geometry background downloads need to happen on the Datagram Processor Thread. The idle loop will | ||
| 349 | // emit checkBackgroundDownloads to cause the GeometryCache to check it's queue for requested background | ||
| 350 | // downloads. | ||
| 351 | QSharedPointer<GeometryCache> geometryCacheP = DependencyManager::get<GeometryCache>(); | ||
| 352 | ResourceCache *geometryCache = geometryCacheP.data(); | ||
| 353 | connect(this, &Application::checkBackgroundDownloads, geometryCache, &ResourceCache::checkAsynchronousGets); | ||
| 354 | |||
| 347 | // connect the DataProcessor processDatagrams slot to the QUDPSocket readyRead() signal | 355 | // connect the DataProcessor processDatagrams slot to the QUDPSocket readyRead() signal |
| 348 | connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, _datagramProcessor, &DatagramProcessor::processDatagrams); | 356 | connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, _datagramProcessor, &DatagramProcessor::processDatagrams); |
| 349 | 357 | ||
| @@ -382,6 +390,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 32 unmodified lines | |||
| 382 | auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>(); | 390 | auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>(); |
| 383 | connect(locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation); | 391 | connect(locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation); |
| 384 | locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); | 392 | locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); |
| 393 | |||
| 394 | // if we get a domain change, immediately attempt update location in metaverse server | ||
| 395 | connect(&nodeList->getDomainHandler(), &DomainHandler::connectedToDomain, | ||
| 396 | discoverabilityManager.data(), &DiscoverabilityManager::updateLocation); | ||
| 385 | 397 | ||
| 386 | connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded); | 398 | connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded); |
| 387 | connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled); | 399 | connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled); |
| @@ -781,7 +793,7 @@ void Application::paintGL() { · 393 unmodified lines | |||
| 781 | 793 | ||
| 782 | DependencyManager::get<GlowEffect>()->render(); | 794 | DependencyManager::get<GlowEffect>()->render(); |
| 783 | 795 | ||
| 784 | if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | 796 | { |
| 785 | PerformanceTimer perfTimer("renderOverlay"); | 797 | PerformanceTimer perfTimer("renderOverlay"); |
| 786 | _applicationOverlay.renderOverlay(true); | 798 | _applicationOverlay.renderOverlay(true); |
| 787 | _applicationOverlay.displayOverlayTexture(); | 799 | _applicationOverlay.displayOverlayTexture(); |
| @@ -979,12 +991,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 191 unmodified lines | |||
| 979 | resetSensors(); | 991 | resetSensors(); |
| 980 | break; | 992 | break; |
| 981 | 993 | ||
| 982 | case Qt::Key_G: | ||
| 983 | if (isShifted) { | ||
| 984 | Menu::getInstance()->triggerOption(MenuOption::ObeyEnvironmentalGravity); | ||
| 985 | } | ||
| 986 | break; | ||
| 987 | |||
| 988 | case Qt::Key_A: | 994 | case Qt::Key_A: |
| 989 | if (isShifted) { | 995 | if (isShifted) { |
| 990 | Menu::getInstance()->triggerOption(MenuOption::Atmosphere); | 996 | Menu::getInstance()->triggerOption(MenuOption::Atmosphere); |
| @@ -1119,13 +1125,10 @@ void Application::keyPressEvent(QKeyEvent* event) { · 128 unmodified lines | |||
| 1119 | Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); | 1125 | Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); |
| 1120 | } | 1126 | } |
| 1121 | break; | 1127 | break; |
| 1122 | case Qt::Key_Slash: | ||
| 1123 | Menu::getInstance()->triggerOption(MenuOption::UserInterface); | ||
| 1124 | break; | ||
| 1125 | case Qt::Key_P: | 1128 | case Qt::Key_P: |
| 1126 | Menu::getInstance()->triggerOption(MenuOption::FirstPerson); | 1129 | Menu::getInstance()->triggerOption(MenuOption::FirstPerson); |
| 1127 | break; | 1130 | break; |
| 1128 | case Qt::Key_Percent: | 1131 | case Qt::Key_Slash: |
| 1129 | Menu::getInstance()->triggerOption(MenuOption::Stats); | 1132 | Menu::getInstance()->triggerOption(MenuOption::Stats); |
| 1130 | break; | 1133 | break; |
| 1131 | case Qt::Key_Plus: | 1134 | case Qt::Key_Plus: |
| @@ -1160,10 +1163,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 28 unmodified lines | |||
| 1160 | break; | 1163 | break; |
| 1161 | } | 1164 | } |
| 1162 | 1165 | ||
| 1163 | case Qt::Key_Comma: { | ||
| 1164 | _myAvatar->togglePhysicsEnabled(); | ||
| 1165 | } | ||
| 1166 | |||
| 1167 | default: | 1166 | default: |
| 1168 | event->ignore(); | 1167 | event->ignore(); |
| 1169 | break; | 1168 | break; |
| @@ -1561,6 +1560,9 @@ void Application::idle() { · 391 unmodified lines | |||
| 1561 | idleTimer->start(2); | 1560 | idleTimer->start(2); |
| 1562 | } | 1561 | } |
| 1563 | } | 1562 | } |
| 1563 | |||
| 1564 | // check for any requested background downloads. | ||
| 1565 | emit checkBackgroundDownloads(); | ||
| 1564 | } | 1566 | } |
| 1565 | 1567 | ||
| 1566 | void Application::setFullscreen(bool fullscreen) { | 1568 | void Application::setFullscreen(bool fullscreen) { |
| @@ -1747,7 +1749,7 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt · 180 unmodified lines | |||
| 1747 | exportTree.addEntity(entityItem->getEntityItemID(), properties); | 1749 | exportTree.addEntity(entityItem->getEntityItemID(), properties); |
| 1748 | } | 1750 | } |
| 1749 | 1751 | ||
| 1750 | exportTree.writeToSVOFile(filename.toLocal8Bit().constData()); | 1752 | exportTree.writeToJSONFile(filename.toLocal8Bit().constData()); |
| 1751 | 1753 | ||
| 1752 | // restore the main window's active state | 1754 | // restore the main window's active state |
| 1753 | _window->activateWindow(); | 1755 | _window->activateWindow(); |
| @@ -1782,6 +1784,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa · 28 unmodified lines | |||
| 1782 | void Application::loadSettings() { | 1784 | void Application::loadSettings() { |
| 1783 | 1785 | ||
| 1784 | DependencyManager::get<AudioClient>()->loadSettings(); | 1786 | DependencyManager::get<AudioClient>()->loadSettings(); |
| 1787 | DependencyManager::get<LODManager>()->loadSettings(); | ||
| 1785 | 1788 | ||
| 1786 | Menu::getInstance()->loadSettings(); | 1789 | Menu::getInstance()->loadSettings(); |
| 1787 | _myAvatar->loadData(); | 1790 | _myAvatar->loadData(); |
| @@ -1789,6 +1792,7 @@ void Application::loadSettings() { · 1 unmodified line | |||
| 1789 | 1792 | ||
| 1790 | void Application::saveSettings() { | 1793 | void Application::saveSettings() { |
| 1791 | DependencyManager::get<AudioClient>()->saveSettings(); | 1794 | DependencyManager::get<AudioClient>()->saveSettings(); |
| 1795 | DependencyManager::get<LODManager>()->saveSettings(); | ||
| 1792 | 1796 | ||
| 1793 | Menu::getInstance()->saveSettings(); | 1797 | Menu::getInstance()->saveSettings(); |
| 1794 | _myAvatar->saveData(); | 1798 | _myAvatar->saveData(); |
| @@ -1899,8 +1903,6 @@ void Application::init() { · 104 unmodified lines | |||
| 1899 | _physicsEngine.init(&_entityEditSender); | 1903 | _physicsEngine.init(&_entityEditSender); |
| 1900 | 1904 | ||
| 1901 | 1905 | ||
| 1902 | _physicsEngine.setAvatarData(_myAvatar); | ||
| 1903 | |||
| 1904 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | 1906 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| 1905 | 1907 | ||
| 1906 | connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity, | 1908 | connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity, |
| @@ -1965,7 +1967,7 @@ bool Application::isLookingAtMyAvatar(Avatar* avatar) { · 58 unmodified lines | |||
| 1965 | void Application::updateLOD() { | 1967 | void Application::updateLOD() { |
| 1966 | PerformanceTimer perfTimer("LOD"); | 1968 | PerformanceTimer perfTimer("LOD"); |
| 1967 | // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode | 1969 | // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode |
| 1968 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) { | 1970 | if (!isThrottleRendering()) { |
| 1969 | DependencyManager::get<LODManager>()->autoAdjustLOD(_fps); | 1971 | DependencyManager::get<LODManager>()->autoAdjustLOD(_fps); |
| 1970 | } else { | 1972 | } else { |
| 1971 | DependencyManager::get<LODManager>()->resetLODAdjust(); | 1973 | DependencyManager::get<LODManager>()->resetLODAdjust(); |
| @@ -3010,8 +3012,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 1038 unmodified lines | |||
| 3010 | _nodeBoundsDisplay.draw(); | 3012 | _nodeBoundsDisplay.draw(); |
| 3011 | 3013 | ||
| 3012 | // Render the world box | 3014 | // Render the world box |
| 3013 | if (theCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && | 3015 | if (theCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { |
| 3014 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | ||
| 3015 | PerformanceTimer perfTimer("worldBox"); | 3016 | PerformanceTimer perfTimer("worldBox"); |
| 3016 | renderWorldBox(); | 3017 | renderWorldBox(); |
| 3017 | } | 3018 | } |
| @@ -3131,7 +3132,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 113 unmodified lines | |||
| 3131 | int viewport[4]; | 3132 | int viewport[4]; |
| 3132 | glGetIntegerv(GL_VIEWPORT, viewport); | 3133 | glGetIntegerv(GL_VIEWPORT, viewport); |
| 3133 | 3134 | ||
| 3134 | bool eyeRelativeCamera = false; | 3135 | // bool eyeRelativeCamera = false; |
| 3135 | if (billboard) { | 3136 | if (billboard) { |
| 3136 | _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees | 3137 | _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees |
| 3137 | _mirrorCamera.setPosition(_myAvatar->getPosition() + | 3138 | _mirrorCamera.setPosition(_myAvatar->getPosition() + |
| @@ -3284,6 +3285,14 @@ void Application::clearDomainOctreeDetails() { · 146 unmodified lines | |||
| 3284 | void Application::domainChanged(const QString& domainHostname) { | 3285 | void Application::domainChanged(const QString& domainHostname) { |
| 3285 | updateWindowTitle(); | 3286 | updateWindowTitle(); |
| 3286 | clearDomainOctreeDetails(); | 3287 | clearDomainOctreeDetails(); |
| 3288 | _domainConnectionRefusals.clear(); | ||
| 3289 | } | ||
| 3290 | |||
| 3291 | void Application::domainConnectionDenied(const QString& reason) { | ||
| 3292 | if (!_domainConnectionRefusals.contains(reason)) { | ||
| 3293 | _domainConnectionRefusals.append(reason); | ||
| 3294 | emit domainConnectionRefused(reason); | ||
| 3295 | } | ||
| 3287 | } | 3296 | } |
| 3288 | 3297 | ||
| 3289 | void Application::connectedToDomain(const QString& hostname) { | 3298 | void Application::connectedToDomain(const QString& hostname) { |
| @@ -3291,11 +3300,6 @@ void Application::connectedToDomain(const QString& hostname) { · 1 unmodified line | |||
| 3291 | const QUuid& domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID(); | 3300 | const QUuid& domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID(); |
| 3292 | 3301 | ||
| 3293 | if (accountManager.isLoggedIn() && !domainID.isNull()) { | 3302 | if (accountManager.isLoggedIn() && !domainID.isNull()) { |
| 3294 | // update our data-server with the domain-server we're logged in with | ||
| 3295 | QString domainPutJsonString = "{\"location\":{\"domain_id\":\"" + uuidStringWithoutCurlyBraces(domainID) + "\"}}"; | ||
| 3296 | accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation, | ||
| 3297 | JSONCallbackParameters(), domainPutJsonString.toUtf8()); | ||
| 3298 | |||
| 3299 | _notifiedPacketVersionMismatchThisDomain = false; | 3303 | _notifiedPacketVersionMismatchThisDomain = false; |
| 3300 | } | 3304 | } |
| 3301 | } | 3305 | } |
| @@ -3595,6 +3599,7 @@ void Application::initializeAcceptedFiles() { · 293 unmodified lines | |||
| 3595 | if (_acceptedExtensions.size() == 0) { | 3599 | if (_acceptedExtensions.size() == 0) { |
| 3596 | _acceptedExtensions[SNAPSHOT_EXTENSION] = &Application::acceptSnapshot; | 3600 | _acceptedExtensions[SNAPSHOT_EXTENSION] = &Application::acceptSnapshot; |
| 3597 | _acceptedExtensions[SVO_EXTENSION] = &Application::importSVOFromURL; | 3601 | _acceptedExtensions[SVO_EXTENSION] = &Application::importSVOFromURL; |
| 3602 | _acceptedExtensions[SVO_JSON_EXTENSION] = &Application::importSVOFromURL; | ||
| 3598 | _acceptedExtensions[JS_EXTENSION] = &Application::askToLoadScript; | 3603 | _acceptedExtensions[JS_EXTENSION] = &Application::askToLoadScript; |
| 3599 | _acceptedExtensions[FST_EXTENSION] = &Application::askToSetAvatarUrl; | 3604 | _acceptedExtensions[FST_EXTENSION] = &Application::askToSetAvatarUrl; |
| 3600 | } | 3605 | } |
| @@ -4203,7 +4208,7 @@ void Application::checkSkeleton() { · 602 unmodified lines | |||
| 4203 | _myAvatar->setSkeletonModelURL(DEFAULT_BODY_MODEL_URL); | 4208 | _myAvatar->setSkeletonModelURL(DEFAULT_BODY_MODEL_URL); |
| 4204 | _myAvatar->sendIdentityPacket(); | 4209 | _myAvatar->sendIdentityPacket(); |
| 4205 | } else { | 4210 | } else { |
| 4206 | _myAvatar->updateLocalAABox(); | 4211 | _myAvatar->updateCharacterController(); |
| 4207 | _physicsEngine.setAvatarData(_myAvatar); | 4212 | _physicsEngine.setCharacterController(_myAvatar->getCharacterController()); |
| 4208 | } | 4213 | } |
| 4209 | } | 4214 | } |