Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all
Unified · Split
| @@ -66,6 +66,7 @@ · 65 unmodified lines | |||
| 66 | #include <input-plugins/InputPlugin.h> | 66 | #include <input-plugins/InputPlugin.h> |
| 67 | #include <input-plugins/Joystick.h> // this should probably be removed | 67 | #include <input-plugins/Joystick.h> // this should probably be removed |
| 68 | #include <controllers/UserInputMapper.h> | 68 | #include <controllers/UserInputMapper.h> |
| 69 | #include <controllers/StateController.h> | ||
| 69 | #include <LogHandler.h> | 70 | #include <LogHandler.h> |
| 70 | #include <MainWindow.h> | 71 | #include <MainWindow.h> |
| 71 | #include <MessageDialog.h> | 72 | #include <MessageDialog.h> |
| @@ -143,7 +144,6 @@ · 71 unmodified lines | |||
| 143 | #include "ui/UpdateDialog.h" | 144 | #include "ui/UpdateDialog.h" |
| 144 | #include "Util.h" | 145 | #include "Util.h" |
| 145 | 146 | ||
| 146 | #include "controllers/StateController.h" | ||
| 147 | 147 | ||
| 148 | // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU | 148 | // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU |
| 149 | // FIXME seems to be broken. | 149 | // FIXME seems to be broken. |
| @@ -348,36 +348,36 @@ int _keyboardFocusHighlightID{ -1 }; · 198 unmodified lines | |||
| 348 | PluginContainer* _pluginContainer; | 348 | PluginContainer* _pluginContainer; |
| 349 | 349 | ||
| 350 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : | 350 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : |
| 351 | QApplication(argc, argv), | 351 | QApplication(argc, argv), |
| 352 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), | 352 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), |
| 353 | _window(new MainWindow(desktop())), | 353 | _window(new MainWindow(desktop())), |
| 354 | _toolWindow(NULL), | 354 | _toolWindow(NULL), |
| 355 | _undoStackScriptingInterface(&_undoStack), | 355 | _undoStackScriptingInterface(&_undoStack), |
| 356 | _frameCount(0), | 356 | _frameCount(0), |
| 357 | _fps(60.0f), | 357 | _fps(60.0f), |
| 358 | _physicsEngine(new PhysicsEngine(Vectors::ZERO)), | 358 | _physicsEngine(new PhysicsEngine(Vectors::ZERO)), |
| 359 | _entities(true, this, this), | 359 | _entities(true, this, this), |
| 360 | _entityClipboardRenderer(false, this, this), | 360 | _entityClipboardRenderer(false, this, this), |
| 361 | _entityClipboard(new EntityTree()), | 361 | _entityClipboard(new EntityTree()), |
| 362 | _lastQueriedTime(usecTimestampNow()), | 362 | _lastQueriedTime(usecTimestampNow()), |
| 363 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), | 363 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), |
| 364 | _firstRun("firstRun", true), | 364 | _firstRun("firstRun", true), |
| 365 | _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION), | 365 | _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION), |
| 366 | _scriptsLocationHandle("scriptsLocation", DESKTOP_LOCATION), | 366 | _scriptsLocationHandle("scriptsLocation", DESKTOP_LOCATION), |
| 367 | _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES), | 367 | _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES), |
| 368 | _scaleMirror(1.0f), | 368 | _scaleMirror(1.0f), |
| 369 | _rotateMirror(0.0f), | 369 | _rotateMirror(0.0f), |
| 370 | _raiseMirror(0.0f), | 370 | _raiseMirror(0.0f), |
| 371 | _lastMouseMoveWasSimulated(false), | 371 | _lastMouseMoveWasSimulated(false), |
| 372 | _enableProcessOctreeThread(true), | 372 | _enableProcessOctreeThread(true), |
| 373 | _runningScriptsWidget(NULL), | 373 | _runningScriptsWidget(NULL), |
| 374 | _runningScriptsWidgetWasVisible(false), | 374 | _runningScriptsWidgetWasVisible(false), |
| 375 | _lastNackTime(usecTimestampNow()), | 375 | _lastNackTime(usecTimestampNow()), |
| 376 | _lastSendDownstreamAudioStats(usecTimestampNow()), | 376 | _lastSendDownstreamAudioStats(usecTimestampNow()), |
| 377 | _aboutToQuit(false), | 377 | _aboutToQuit(false), |
| 378 | _notifiedPacketVersionMismatchThisDomain(false), | 378 | _notifiedPacketVersionMismatchThisDomain(false), |
| 379 | _maxOctreePPS(maxOctreePacketsPerSecond.get()), | 379 | _maxOctreePPS(maxOctreePacketsPerSecond.get()), |
| 380 | _lastFaceTrackerUpdate(0) | 380 | _lastFaceTrackerUpdate(0) |
| 381 | { | 381 | { |
| 382 | thread()->setObjectName("Main Thread"); | 382 | thread()->setObjectName("Main Thread"); |
| 383 | 383 | ||
| @@ -635,13 +635,14 @@ _lastFaceTrackerUpdate(0) · 251 unmodified lines | |||
| 635 | } | 635 | } |
| 636 | }); | 636 | }); |
| 637 | 637 | ||
| 638 | static controller::StateController _stateController; | 638 | // A new controllerInput device used to reflect current values from the application state |
| 639 | _applicationStateDevice = new controller::StateController("Application"); | ||
| 639 | auto InHMDLambda = controller::StateController::ReadLambda([]() -> float { | 640 | auto InHMDLambda = controller::StateController::ReadLambda([]() -> float { |
| 640 | return (float) qApp->getAvatarUpdater()->isHMDMode(); | 641 | return (float) qApp->getAvatarUpdater()->isHMDMode(); |
| 641 | }); | 642 | }); |
| 642 | _stateController.addInputVariant("InHMD", InHMDLambda); | 643 | _applicationStateDevice->addInputVariant("InHMD", InHMDLambda); |
| 643 | 644 | ||
| 644 | userInputMapper->registerDevice(&_stateController); | 645 | userInputMapper->registerDevice(_applicationStateDevice); |
| 645 | 646 | ||
| 646 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings | 647 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings |
| 647 | userInputMapper->registerDevice(_keyboardMouseDevice); | 648 | userInputMapper->registerDevice(_keyboardMouseDevice); |
| @@ -807,6 +808,10 @@ void Application::cleanupBeforeQuit() { · 159 unmodified lines | |||
| 807 | 808 | ||
| 808 | AnimDebugDraw::getInstance().shutdown(); | 809 | AnimDebugDraw::getInstance().shutdown(); |
| 809 | 810 | ||
| 811 | // FIXME: once we move to shared pointer for the INputDevice we shoud remove this naked delete: | ||
| 812 | delete _applicationStateDevice; | ||
| 813 | _applicationStateDevice = nullptr; | ||
| 814 | |||
| 810 | if (_keyboardFocusHighlightID > 0) { | 815 | if (_keyboardFocusHighlightID > 0) { |
| 811 | getOverlays().deleteOverlay(_keyboardFocusHighlightID); | 816 | getOverlays().deleteOverlay(_keyboardFocusHighlightID); |
| 812 | _keyboardFocusHighlightID = -1; | 817 | _keyboardFocusHighlightID = -1; |
| @@ -2716,7 +2721,7 @@ void Application::update(float deltaTime) { · 1903 unmodified lines | |||
| 2716 | auto myAvatar = getMyAvatar(); | 2721 | auto myAvatar = getMyAvatar(); |
| 2717 | auto userInputMapper = DependencyManager::get<UserInputMapper>(); | 2722 | auto userInputMapper = DependencyManager::get<UserInputMapper>(); |
| 2718 | userInputMapper->setSensorToWorldMat(myAvatar->getSensorToWorldMatrix()); | 2723 | userInputMapper->setSensorToWorldMat(myAvatar->getSensorToWorldMatrix()); |
| 2719 | // userInputMapper->update(deltaTime); | 2724 | userInputMapper->update(deltaTime); |
| 2720 | 2725 | ||
| 2721 | bool jointsCaptured = false; | 2726 | bool jointsCaptured = false; |
| 2722 | for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) { | 2727 | for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) { |
| @@ -2727,7 +2732,6 @@ void Application::update(float deltaTime) { · 4 unmodified lines | |||
| 2727 | } | 2732 | } |
| 2728 | } | 2733 | } |
| 2729 | } | 2734 | } |
| 2730 | userInputMapper->update(deltaTime); | ||
| 2731 | 2735 | ||
| 2732 | // Transfer the user inputs to the driveKeys | 2736 | // Transfer the user inputs to the driveKeys |
| 2733 | // FIXME can we drop drive keys and just have the avatar read the action states directly? | 2737 | // FIXME can we drop drive keys and just have the avatar read the action states directly? |