History

Merge branch 'master' into M17428-f

David Rowe committed 8 years ago

Commit 7dba2e62 parents 8eeed77 bafdd06179 files · +4472 −1781Browse files

Showing the changes to interface/src/Application.cpp (1 of 179 files). Show all

Unified · Split

interface/src/Application.cpp+44−17
@@ -195,6 +195,7 @@ · 194 unmodified lines
195195 #include "ui/SnapshotAnimated.h"
196196 #include "ui/StandAloneJSConsole.h"
197197 #include "ui/Stats.h"
198+#include "ui/AnimStats.h"
198199 #include "ui/UpdateDialog.h"
199200 #include "ui/overlays/Overlays.h"
200201 #include "ui/DomainConnectionModel.h"
@@ -726,6 +727,9 @@ static const QString STATE_SNAP_TURN = "SnapTurn"; · 525 unmodified lines
726727 static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement";
727728 static const QString STATE_GROUNDED = "Grounded";
728729 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";
729733
730734 // Statically provided display and input plugins
731735 extern DisplayPluginList getDisplayPlugins();
@@ -909,7 +913,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 177 unmodified lines
909913 DependencyManager::set<MessagesClient>();
910914 controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR,
911915 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 } });
913918 DependencyManager::set<UserInputMapper>();
914919 DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>();
915920 DependencyManager::set<InterfaceParentFinder>();
@@ -1683,6 +1688,27 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 767 unmodified lines
16831688 _applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float {
16841689 return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
16851690 });
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+ });
16861712
16871713 // Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings
16881714 userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice());
@@ -1735,11 +1761,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 46 unmodified lines
17351761 QTimer* settingsTimer = new QTimer();
17361762 moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{
17371763 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− }
17431764 // Disconnect the signal from the save settings
17441765 QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
17451766 // Stop the settings timer
@@ -2491,6 +2512,11 @@ void Application::cleanupBeforeQuit() { · 745 unmodified lines
24912512 }
24922513 DependencyManager::destroy<ScriptEngines>();
24932514
2515+ bool autoLogout = Setting::Handle<bool>(AUTO_LOGOUT_SETTING_NAME, false).get();
2516+ if (autoLogout) {
2517+ DependencyManager::get<AccountManager>()->removeAccountFromFile();
2518+ }
2519+
24942520 _displayPlugin.reset();
24952521 PluginManager::getInstance()->shutdown();
24962522
@@ -3056,8 +3082,10 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 559 unmodified lines
30563082
30573083 void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {
30583084 Stats::show();
3085+ AnimStats::show();
30593086 auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext();
30603087 surfaceContext->setContextProperty("Stats", Stats::getInstance());
3088+ surfaceContext->setContextProperty("AnimStats", AnimStats::getInstance());
30613089
30623090 #if !defined(Q_OS_ANDROID)
30633091 auto offscreenUi = DependencyManager::get<OffscreenUi>();
@@ -4593,6 +4621,7 @@ void Application::idle() { · 1529 unmodified lines
45934621 checkChangeCursor();
45944622
45954623 Stats::getInstance()->updateStats();
4624+ AnimStats::getInstance()->updateStats();
45964625
45974626 // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing
45984627 // 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
50365065 float presentTime = getActiveDisplayPlugin()->getAveragePresentTime();
50375066 float engineRunTime = (float)(_renderEngine->getConfiguration().get()->getCPURunTime());
50385067 float gpuTime = getGPUContext()->getFrameTimerGPUAverage();
5068+ float batchTime = getGPUContext()->getFrameTimerBatchAverage();
50395069 auto lodManager = DependencyManager::get<LODManager>();
5040− lodManager->setRenderTimes(presentTime, engineRunTime, gpuTime);
5070+ lodManager->setRenderTimes(presentTime, engineRunTime, batchTime, gpuTime);
50415071 lodManager->autoAdjustLOD(deltaTime);
50425072 } else {
50435073 DependencyManager::get<LODManager>()->resetLODAdjust();
@@ -5795,15 +5825,13 @@ void Application::update(float deltaTime) { · 751 unmodified lines
57955825 auto t5 = std::chrono::high_resolution_clock::now();
57965826
57975827 workload::Timings timings(6);
5798− timings[0] = (t4 - t0);
5799− timings[1] = (t5 - t4);
5800− timings[2] = (t4 - t3);
5801− timings[3] = (t3 - t2);
5802− timings[4] = (t2 - t1);
5803− timings[5] = (t1 - t0);
5804−
5828+ timings[0] = t1 - t0; // prePhysics entities
5829+ timings[1] = t2 - t1; // prePhysics avatars
5830+ timings[2] = t3 - t2; // stepPhysics
5831+ timings[3] = t4 - t3; // postPhysics
5832+ timings[4] = t5 - t4; // non-physical kinematics
5833+ timings[5] = workload::Timing_ns((int32_t)(NSECS_PER_SECOND * deltaTime)); // game loop duration
58055834 _gameWorkload.updateSimulationTimings(timings);
5806−
58075835 }
58085836 }
58095837 } else {
@@ -5995,7 +6023,7 @@ void Application::updateRenderArgs(float deltaTime) { · 185 unmodified lines
59956023 _viewFrustum.calculate();
59966024 }
59976025 appRenderArgs._renderArgs = RenderArgs(_gpuContext, lodManager->getOctreeSizeScale(),
5998− lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
6026+ lodManager->getBoundaryLevelAdjust(), lodManager->getLODAngleHalfTan(), RenderArgs::DEFAULT_RENDER_MODE,
59996027 RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
60006028 appRenderArgs._renderArgs._scene = getMain3DScene();
60016029
@@ -6341,7 +6369,6 @@ void Application::clearDomainOctreeDetails() { · 339 unmodified lines
63416369 }
63426370
63436371 void Application::clearDomainAvatars() {
6344− getMyAvatar()->setAvatarEntityDataChanged(true); // to recreate worn entities
63456372 DependencyManager::get<AvatarManager>()->clearOtherAvatars();
63466373 }
63476374