Showing the changes to interface/src/Application.cpp (1 of 179 files). Show all
Unified · Split
| @@ -195,6 +195,7 @@ · 194 unmodified lines | |||
| 195 | #include "ui/SnapshotAnimated.h" | 195 | #include "ui/SnapshotAnimated.h" |
| 196 | #include "ui/StandAloneJSConsole.h" | 196 | #include "ui/StandAloneJSConsole.h" |
| 197 | #include "ui/Stats.h" | 197 | #include "ui/Stats.h" |
| 198 | #include "ui/AnimStats.h" | ||
| 198 | #include "ui/UpdateDialog.h" | 199 | #include "ui/UpdateDialog.h" |
| 199 | #include "ui/overlays/Overlays.h" | 200 | #include "ui/overlays/Overlays.h" |
| 200 | #include "ui/DomainConnectionModel.h" | 201 | #include "ui/DomainConnectionModel.h" |
| @@ -726,6 +727,9 @@ static const QString STATE_SNAP_TURN = "SnapTurn"; · 525 unmodified lines | |||
| 726 | static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement"; | 727 | static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement"; |
| 727 | static const QString STATE_GROUNDED = "Grounded"; | 728 | static const QString STATE_GROUNDED = "Grounded"; |
| 728 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; | 729 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; |
| 730 | static const QString STATE_PLATFORM_WINDOWS = "PlatformWindows"; | ||
| 731 | static const QString STATE_PLATFORM_MAC = "PlatformMac"; | ||
| 732 | static const QString STATE_PLATFORM_ANDROID = "PlatformAndroid"; | ||
| 729 | 733 | ||
| 730 | // Statically provided display and input plugins | 734 | // Statically provided display and input plugins |
| 731 | extern DisplayPluginList getDisplayPlugins(); | 735 | extern DisplayPluginList getDisplayPlugins(); |
| @@ -909,7 +913,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 177 unmodified lines | |||
| 909 | DependencyManager::set<MessagesClient>(); | 913 | DependencyManager::set<MessagesClient>(); |
| 910 | controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR, | 914 | controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR, |
| 911 | STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, | 915 | STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, |
| 912 | STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED } }); | 916 | STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED, |
| 917 | STATE_PLATFORM_WINDOWS, STATE_PLATFORM_MAC, STATE_PLATFORM_ANDROID } }); | ||
| 913 | DependencyManager::set<UserInputMapper>(); | 918 | DependencyManager::set<UserInputMapper>(); |
| 914 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); | 919 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); |
| 915 | DependencyManager::set<InterfaceParentFinder>(); | 920 | DependencyManager::set<InterfaceParentFinder>(); |
| @@ -1683,6 +1688,27 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 767 unmodified lines | |||
| 1683 | _applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float { | 1688 | _applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float { |
| 1684 | return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0; | 1689 | return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0; |
| 1685 | }); | 1690 | }); |
| 1691 | _applicationStateDevice->setInputVariant(STATE_PLATFORM_WINDOWS, []() -> float { | ||
| 1692 | #if defined(Q_OS_WIN) | ||
| 1693 | return 1; | ||
| 1694 | #else | ||
| 1695 | return 0; | ||
| 1696 | #endif | ||
| 1697 | }); | ||
| 1698 | _applicationStateDevice->setInputVariant(STATE_PLATFORM_MAC, []() -> float { | ||
| 1699 | #if defined(Q_OS_MAC) | ||
| 1700 | return 1; | ||
| 1701 | #else | ||
| 1702 | return 0; | ||
| 1703 | #endif | ||
| 1704 | }); | ||
| 1705 | _applicationStateDevice->setInputVariant(STATE_PLATFORM_ANDROID, []() -> float { | ||
| 1706 | #if defined(Q_OS_ANDROID) | ||
| 1707 | return 1; | ||
| 1708 | #else | ||
| 1709 | return 0; | ||
| 1710 | #endif | ||
| 1711 | }); | ||
| 1686 | 1712 | ||
| 1687 | // Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings | 1713 | // Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings |
| 1688 | userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice()); | 1714 | userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice()); |
| @@ -1735,11 +1761,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 46 unmodified lines | |||
| 1735 | QTimer* settingsTimer = new QTimer(); | 1761 | QTimer* settingsTimer = new QTimer(); |
| 1736 | moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{ | 1762 | moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{ |
| 1737 | connect(qApp, &Application::beforeAboutToQuit, [this, settingsTimer]{ | 1763 | connect(qApp, &Application::beforeAboutToQuit, [this, settingsTimer]{ |
| 1738 | bool autoLogout = Setting::Handle<bool>(AUTO_LOGOUT_SETTING_NAME, false).get(); | ||
| 1739 | if (autoLogout) { | ||
| 1740 | auto accountManager = DependencyManager::get<AccountManager>(); | ||
| 1741 | accountManager->logout(); | ||
| 1742 | } | ||
| 1743 | // Disconnect the signal from the save settings | 1764 | // Disconnect the signal from the save settings |
| 1744 | QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings); | 1765 | QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings); |
| 1745 | // Stop the settings timer | 1766 | // Stop the settings timer |
| @@ -2491,6 +2512,11 @@ void Application::cleanupBeforeQuit() { · 745 unmodified lines | |||
| 2491 | } | 2512 | } |
| 2492 | DependencyManager::destroy<ScriptEngines>(); | 2513 | DependencyManager::destroy<ScriptEngines>(); |
| 2493 | 2514 | ||
| 2515 | bool autoLogout = Setting::Handle<bool>(AUTO_LOGOUT_SETTING_NAME, false).get(); | ||
| 2516 | if (autoLogout) { | ||
| 2517 | DependencyManager::get<AccountManager>()->removeAccountFromFile(); | ||
| 2518 | } | ||
| 2519 | |||
| 2494 | _displayPlugin.reset(); | 2520 | _displayPlugin.reset(); |
| 2495 | PluginManager::getInstance()->shutdown(); | 2521 | PluginManager::getInstance()->shutdown(); |
| 2496 | 2522 | ||
| @@ -3056,8 +3082,10 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 559 unmodified lines | |||
| 3056 | 3082 | ||
| 3057 | void Application::onDesktopRootItemCreated(QQuickItem* rootItem) { | 3083 | void Application::onDesktopRootItemCreated(QQuickItem* rootItem) { |
| 3058 | Stats::show(); | 3084 | Stats::show(); |
| 3085 | AnimStats::show(); | ||
| 3059 | auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext(); | 3086 | auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext(); |
| 3060 | surfaceContext->setContextProperty("Stats", Stats::getInstance()); | 3087 | surfaceContext->setContextProperty("Stats", Stats::getInstance()); |
| 3088 | surfaceContext->setContextProperty("AnimStats", AnimStats::getInstance()); | ||
| 3061 | 3089 | ||
| 3062 | #if !defined(Q_OS_ANDROID) | 3090 | #if !defined(Q_OS_ANDROID) |
| 3063 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 3091 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| @@ -4593,6 +4621,7 @@ void Application::idle() { · 1529 unmodified lines | |||
| 4593 | checkChangeCursor(); | 4621 | checkChangeCursor(); |
| 4594 | 4622 | ||
| 4595 | Stats::getInstance()->updateStats(); | 4623 | Stats::getInstance()->updateStats(); |
| 4624 | AnimStats::getInstance()->updateStats(); | ||
| 4596 | 4625 | ||
| 4597 | // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing | 4626 | // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing |
| 4598 | // details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing | 4627 | // details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing |
| @@ -5036,8 +5065,9 @@ void Application::updateLOD(float deltaTime) const { · 437 unmodified lines | |||
| 5036 | float presentTime = getActiveDisplayPlugin()->getAveragePresentTime(); | 5065 | float presentTime = getActiveDisplayPlugin()->getAveragePresentTime(); |
| 5037 | float engineRunTime = (float)(_renderEngine->getConfiguration().get()->getCPURunTime()); | 5066 | float engineRunTime = (float)(_renderEngine->getConfiguration().get()->getCPURunTime()); |
| 5038 | float gpuTime = getGPUContext()->getFrameTimerGPUAverage(); | 5067 | float gpuTime = getGPUContext()->getFrameTimerGPUAverage(); |
| 5068 | float batchTime = getGPUContext()->getFrameTimerBatchAverage(); | ||
| 5039 | auto lodManager = DependencyManager::get<LODManager>(); | 5069 | auto lodManager = DependencyManager::get<LODManager>(); |
| 5040 | lodManager->setRenderTimes(presentTime, engineRunTime, gpuTime); | 5070 | lodManager->setRenderTimes(presentTime, engineRunTime, batchTime, gpuTime); |
| 5041 | lodManager->autoAdjustLOD(deltaTime); | 5071 | lodManager->autoAdjustLOD(deltaTime); |
| 5042 | } else { | 5072 | } else { |
| 5043 | DependencyManager::get<LODManager>()->resetLODAdjust(); | 5073 | DependencyManager::get<LODManager>()->resetLODAdjust(); |
| @@ -5795,15 +5825,13 @@ void Application::update(float deltaTime) { · 751 unmodified lines | |||
| 5795 | auto t5 = std::chrono::high_resolution_clock::now(); | 5825 | auto t5 = std::chrono::high_resolution_clock::now(); |
| 5796 | 5826 | ||
| 5797 | workload::Timings timings(6); | 5827 | workload::Timings timings(6); |
| 5798 | timings[0] = (t4 - t0); | 5828 | timings[0] = t1 - t0; // prePhysics entities |
| 5799 | timings[1] = (t5 - t4); | 5829 | timings[1] = t2 - t1; // prePhysics avatars |
| 5800 | timings[2] = (t4 - t3); | 5830 | timings[2] = t3 - t2; // stepPhysics |
| 5801 | timings[3] = (t3 - t2); | 5831 | timings[3] = t4 - t3; // postPhysics |
| 5802 | timings[4] = (t2 - t1); | 5832 | timings[4] = t5 - t4; // non-physical kinematics |
| 5803 | timings[5] = (t1 - t0); | 5833 | timings[5] = workload::Timing_ns((int32_t)(NSECS_PER_SECOND * deltaTime)); // game loop duration |
| 5804 | |||
| 5805 | _gameWorkload.updateSimulationTimings(timings); | 5834 | _gameWorkload.updateSimulationTimings(timings); |
| 5806 | |||
| 5807 | } | 5835 | } |
| 5808 | } | 5836 | } |
| 5809 | } else { | 5837 | } else { |
| @@ -5995,7 +6023,7 @@ void Application::updateRenderArgs(float deltaTime) { · 185 unmodified lines | |||
| 5995 | _viewFrustum.calculate(); | 6023 | _viewFrustum.calculate(); |
| 5996 | } | 6024 | } |
| 5997 | appRenderArgs._renderArgs = RenderArgs(_gpuContext, lodManager->getOctreeSizeScale(), | 6025 | appRenderArgs._renderArgs = RenderArgs(_gpuContext, lodManager->getOctreeSizeScale(), |
| 5998 | lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE, | 6026 | lodManager->getBoundaryLevelAdjust(), lodManager->getLODAngleHalfTan(), RenderArgs::DEFAULT_RENDER_MODE, |
| 5999 | RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE); | 6027 | RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE); |
| 6000 | appRenderArgs._renderArgs._scene = getMain3DScene(); | 6028 | appRenderArgs._renderArgs._scene = getMain3DScene(); |
| 6001 | 6029 | ||
| @@ -6341,7 +6369,6 @@ void Application::clearDomainOctreeDetails() { · 339 unmodified lines | |||
| 6341 | } | 6369 | } |
| 6342 | 6370 | ||
| 6343 | void Application::clearDomainAvatars() { | 6371 | void Application::clearDomainAvatars() { |
| 6344 | getMyAvatar()->setAvatarEntityDataChanged(true); // to recreate worn entities | ||
| 6345 | DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | 6372 | DependencyManager::get<AvatarManager>()->clearOtherAvatars(); |
| 6346 | } | 6373 | } |
| 6347 | 6374 | ||