Showing the changes to interface/src/Application.cpp (1 of 361 files). Show all
Unified · Split
| @@ -70,6 +70,7 @@ · 69 unmodified lines | |||
| 70 | #include <LogHandler.h> | 70 | #include <LogHandler.h> |
| 71 | #include <MainWindow.h> | 71 | #include <MainWindow.h> |
| 72 | #include <MessageDialog.h> | 72 | #include <MessageDialog.h> |
| 73 | #include <MessagesClient.h> | ||
| 73 | #include <ModelEntityItem.h> | 74 | #include <ModelEntityItem.h> |
| 74 | #include <NetworkAccessManager.h> | 75 | #include <NetworkAccessManager.h> |
| 75 | #include <NetworkingConstants.h> | 76 | #include <NetworkingConstants.h> |
| @@ -86,6 +87,7 @@ · 10 unmodified lines | |||
| 86 | #include <RenderDeferredTask.h> | 87 | #include <RenderDeferredTask.h> |
| 87 | #include <ResourceCache.h> | 88 | #include <ResourceCache.h> |
| 88 | #include <SceneScriptingInterface.h> | 89 | #include <SceneScriptingInterface.h> |
| 90 | #include <RecordingScriptingInterface.h> | ||
| 89 | #include <ScriptCache.h> | 91 | #include <ScriptCache.h> |
| 90 | #include <SoundCache.h> | 92 | #include <SoundCache.h> |
| 91 | #include <TextureCache.h> | 93 | #include <TextureCache.h> |
| @@ -94,13 +96,15 @@ · 2 unmodified lines | |||
| 94 | #include <UserActivityLogger.h> | 96 | #include <UserActivityLogger.h> |
| 95 | #include <UUID.h> | 97 | #include <UUID.h> |
| 96 | #include <VrMenu.h> | 98 | #include <VrMenu.h> |
| 99 | #include <recording/Deck.h> | ||
| 100 | #include <recording/Recorder.h> | ||
| 97 | 101 | ||
| 98 | #include "AnimDebugDraw.h" | 102 | #include "AnimDebugDraw.h" |
| 99 | #include "AudioClient.h" | 103 | #include "AudioClient.h" |
| 100 | #include "audio/AudioScope.h" | 104 | #include "audio/AudioScope.h" |
| 101 | #include "avatar/AvatarManager.h" | 105 | #include "avatar/AvatarManager.h" |
| 102 | #include "CrashHandler.h" | 106 | #include "CrashHandler.h" |
| 103 | #include "devices/3DConnexionClient.h" | 107 | #include "input-plugins/SpacemouseManager.h" |
| 104 | #include "devices/DdeFaceTracker.h" | 108 | #include "devices/DdeFaceTracker.h" |
| 105 | #include "devices/EyeTracker.h" | 109 | #include "devices/EyeTracker.h" |
| 106 | #include "devices/Faceshift.h" | 110 | #include "devices/Faceshift.h" |
| @@ -132,6 +136,7 @@ · 25 unmodified lines | |||
| 132 | #endif | 136 | #endif |
| 133 | #include "Stars.h" | 137 | #include "Stars.h" |
| 134 | #include "ui/AddressBarDialog.h" | 138 | #include "ui/AddressBarDialog.h" |
| 139 | #include "ui/RecorderDialog.h" | ||
| 135 | #include "ui/AvatarInputs.h" | 140 | #include "ui/AvatarInputs.h" |
| 136 | #include "ui/AssetUploadDialogFactory.h" | 141 | #include "ui/AssetUploadDialogFactory.h" |
| 137 | #include "ui/DataWebDialog.h" | 142 | #include "ui/DataWebDialog.h" |
| @@ -298,6 +303,8 @@ bool setupEssentials(int& argc, char** argv) { · 160 unmodified lines | |||
| 298 | Setting::init(); | 303 | Setting::init(); |
| 299 | 304 | ||
| 300 | // Set dependencies | 305 | // Set dependencies |
| 306 | DependencyManager::set<recording::Deck>(); | ||
| 307 | DependencyManager::set<recording::Recorder>(); | ||
| 301 | DependencyManager::set<AddressManager>(); | 308 | DependencyManager::set<AddressManager>(); |
| 302 | DependencyManager::set<NodeList>(NodeType::Agent, listenPort); | 309 | DependencyManager::set<NodeList>(NodeType::Agent, listenPort); |
| 303 | DependencyManager::set<GeometryCache>(); | 310 | DependencyManager::set<GeometryCache>(); |
| @@ -322,6 +329,7 @@ bool setupEssentials(int& argc, char** argv) { · 18 unmodified lines | |||
| 322 | DependencyManager::set<ResourceCacheSharedItems>(); | 329 | DependencyManager::set<ResourceCacheSharedItems>(); |
| 323 | DependencyManager::set<DesktopScriptingInterface>(); | 330 | DependencyManager::set<DesktopScriptingInterface>(); |
| 324 | DependencyManager::set<EntityScriptingInterface>(); | 331 | DependencyManager::set<EntityScriptingInterface>(); |
| 332 | DependencyManager::set<RecordingScriptingInterface>(); | ||
| 325 | DependencyManager::set<WindowScriptingInterface>(); | 333 | DependencyManager::set<WindowScriptingInterface>(); |
| 326 | DependencyManager::set<HMDScriptingInterface>(); | 334 | DependencyManager::set<HMDScriptingInterface>(); |
| 327 | 335 | ||
| @@ -335,6 +343,7 @@ bool setupEssentials(int& argc, char** argv) { · 7 unmodified lines | |||
| 335 | DependencyManager::set<PathUtils>(); | 343 | DependencyManager::set<PathUtils>(); |
| 336 | DependencyManager::set<InterfaceActionFactory>(); | 344 | DependencyManager::set<InterfaceActionFactory>(); |
| 337 | DependencyManager::set<AssetClient>(); | 345 | DependencyManager::set<AssetClient>(); |
| 346 | DependencyManager::set<MessagesClient>(); | ||
| 338 | DependencyManager::set<UserInputMapper>(); | 347 | DependencyManager::set<UserInputMapper>(); |
| 339 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); | 348 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); |
| 340 | DependencyManager::set<InterfaceParentFinder>(); | 349 | DependencyManager::set<InterfaceParentFinder>(); |
| @@ -449,6 +458,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 108 unmodified lines | |||
| 449 | audioIO->setOrientationGetter([this]{ return getMyAvatar()->getOrientationForAudio(); }); | 458 | audioIO->setOrientationGetter([this]{ return getMyAvatar()->getOrientationForAudio(); }); |
| 450 | 459 | ||
| 451 | audioIO->moveToThread(audioThread); | 460 | audioIO->moveToThread(audioThread); |
| 461 | recording::Frame::registerFrameHandler(AudioConstants::AUDIO_FRAME_NAME, [=](recording::Frame::ConstPointer frame) { | ||
| 462 | audioIO->handleRecordedAudioInput(frame->data); | ||
| 463 | }); | ||
| 464 | |||
| 465 | connect(audioIO.data(), &AudioClient::inputReceived, [](const QByteArray& audio){ | ||
| 466 | static auto recorder = DependencyManager::get<recording::Recorder>(); | ||
| 467 | if (recorder->isRecording()) { | ||
| 468 | static const recording::FrameType AUDIO_FRAME_TYPE = recording::Frame::registerFrameType(AudioConstants::AUDIO_FRAME_NAME); | ||
| 469 | recorder->recordFrame(AUDIO_FRAME_TYPE, audio); | ||
| 470 | } | ||
| 471 | }); | ||
| 452 | 472 | ||
| 453 | auto& audioScriptingInterface = AudioScriptingInterface::getInstance(); | 473 | auto& audioScriptingInterface = AudioScriptingInterface::getInstance(); |
| 454 | 474 | ||
| @@ -481,6 +501,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 26 unmodified lines | |||
| 481 | connect(assetThread, &QThread::started, assetClient.data(), &AssetClient::init); | 501 | connect(assetThread, &QThread::started, assetClient.data(), &AssetClient::init); |
| 482 | assetThread->start(); | 502 | assetThread->start(); |
| 483 | 503 | ||
| 504 | // Setup MessagesClient | ||
| 505 | auto messagesClient = DependencyManager::get<MessagesClient>(); | ||
| 506 | QThread* messagesThread = new QThread; | ||
| 507 | messagesThread->setObjectName("Messages Client Thread"); | ||
| 508 | messagesClient->moveToThread(messagesThread); | ||
| 509 | connect(messagesThread, &QThread::started, messagesClient.data(), &MessagesClient::init); | ||
| 510 | messagesThread->start(); | ||
| 511 | |||
| 484 | const DomainHandler& domainHandler = nodeList->getDomainHandler(); | 512 | const DomainHandler& domainHandler = nodeList->getDomainHandler(); |
| 485 | 513 | ||
| 486 | connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); | 514 | connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); |
| @@ -547,7 +575,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 60 unmodified lines | |||
| 547 | 575 | ||
| 548 | // tell the NodeList instance who to tell the domain server we care about | 576 | // tell the NodeList instance who to tell the domain server we care about |
| 549 | nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer | 577 | nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer |
| 550 | << NodeType::EntityServer << NodeType::AssetServer); | 578 | << NodeType::EntityServer << NodeType::AssetServer << NodeType::MessagesMixer); |
| 551 | 579 | ||
| 552 | // connect to the packet sent signal of the _entityEditSender | 580 | // connect to the packet sent signal of the _entityEditSender |
| 553 | connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); | 581 | connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); |
| @@ -650,11 +678,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 96 unmodified lines | |||
| 650 | _applicationStateDevice->addInputVariant(QString("ComfortMode"), controller::StateController::ReadLambda([]() -> float { | 678 | _applicationStateDevice->addInputVariant(QString("ComfortMode"), controller::StateController::ReadLambda([]() -> float { |
| 651 | return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode); | 679 | return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode); |
| 652 | })); | 680 | })); |
| 681 | _applicationStateDevice->addInputVariant(QString("Grounded"), controller::StateController::ReadLambda([]() -> float { | ||
| 682 | return (float)qApp->getMyAvatar()->getCharacterController()->onGround(); | ||
| 683 | })); | ||
| 653 | 684 | ||
| 654 | userInputMapper->registerDevice(_applicationStateDevice); | 685 | userInputMapper->registerDevice(_applicationStateDevice); |
| 655 | 686 | ||
| 656 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings | 687 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings |
| 657 | userInputMapper->registerDevice(_keyboardMouseDevice); | 688 | userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice()); |
| 658 | 689 | ||
| 659 | 690 | ||
| 660 | userInputMapper->loadDefaultMapping(userInputMapper->getStandardDeviceID()); | 691 | userInputMapper->loadDefaultMapping(userInputMapper->getStandardDeviceID()); |
| @@ -730,9 +761,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 69 unmodified lines | |||
| 730 | // Now that menu is initalized we can sync myAvatar with it's state. | 761 | // Now that menu is initalized we can sync myAvatar with it's state. |
| 731 | getMyAvatar()->updateMotionBehaviorFromMenu(); | 762 | getMyAvatar()->updateMotionBehaviorFromMenu(); |
| 732 | 763 | ||
| 764 | // FIXME spacemouse code still needs cleanup | ||
| 733 | #if 0 | 765 | #if 0 |
| 734 | // the 3Dconnexion device wants to be initiliazed after a window is displayed. | 766 | // the 3Dconnexion device wants to be initiliazed after a window is displayed. |
| 735 | ConnexionClient::getInstance().init(); | 767 | SpacemouseManager::getInstance().init(); |
| 736 | #endif | 768 | #endif |
| 737 | 769 | ||
| 738 | auto& packetReceiver = nodeList->getPacketReceiver(); | 770 | auto& packetReceiver = nodeList->getPacketReceiver(); |
| @@ -804,8 +836,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 65 unmodified lines | |||
| 804 | 836 | ||
| 805 | void Application::aboutToQuit() { | 837 | void Application::aboutToQuit() { |
| 806 | emit beforeAboutToQuit(); | 838 | emit beforeAboutToQuit(); |
| 839 | |||
| 807 | getActiveDisplayPlugin()->deactivate(); | 840 | getActiveDisplayPlugin()->deactivate(); |
| 841 | |||
| 808 | _aboutToQuit = true; | 842 | _aboutToQuit = true; |
| 843 | |||
| 809 | cleanupBeforeQuit(); | 844 | cleanupBeforeQuit(); |
| 810 | } | 845 | } |
| 811 | 846 | ||
| @@ -817,7 +852,6 @@ void Application::cleanupBeforeQuit() { · 5 unmodified lines | |||
| 817 | #ifdef HAVE_IVIEWHMD | 852 | #ifdef HAVE_IVIEWHMD |
| 818 | DependencyManager::get<EyeTracker>()->setEnabled(false, true); | 853 | DependencyManager::get<EyeTracker>()->setEnabled(false, true); |
| 819 | #endif | 854 | #endif |
| 820 | |||
| 821 | AnimDebugDraw::getInstance().shutdown(); | 855 | AnimDebugDraw::getInstance().shutdown(); |
| 822 | 856 | ||
| 823 | // FIXME: once we move to shared pointer for the INputDevice we shoud remove this naked delete: | 857 | // FIXME: once we move to shared pointer for the INputDevice we shoud remove this naked delete: |
| @@ -831,8 +865,14 @@ void Application::cleanupBeforeQuit() { · 7 unmodified lines | |||
| 831 | 865 | ||
| 832 | _entities.clear(); // this will allow entity scripts to properly shutdown | 866 | _entities.clear(); // this will allow entity scripts to properly shutdown |
| 833 | 867 | ||
| 868 | auto nodeList = DependencyManager::get<NodeList>(); | ||
| 869 | |||
| 870 | // send the domain a disconnect packet, force stoppage of domain-server check-ins | ||
| 871 | nodeList->getDomainHandler().disconnect(); | ||
| 872 | nodeList->setIsShuttingDown(true); | ||
| 873 | |||
| 834 | // tell the packet receiver we're shutting down, so it can drop packets | 874 | // tell the packet receiver we're shutting down, so it can drop packets |
| 835 | DependencyManager::get<NodeList>()->getPacketReceiver().setShouldDropPackets(true); | 875 | nodeList->getPacketReceiver().setShouldDropPackets(true); |
| 836 | 876 | ||
| 837 | _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts | 877 | _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts |
| 838 | ScriptEngine::stopAllScripts(this); // stop all currently running global scripts | 878 | ScriptEngine::stopAllScripts(this); // stop all currently running global scripts |
| @@ -852,9 +892,6 @@ void Application::cleanupBeforeQuit() { · 13 unmodified lines | |||
| 852 | saveSettings(); | 892 | saveSettings(); |
| 853 | _window->saveGeometry(); | 893 | _window->saveGeometry(); |
| 854 | 894 | ||
| 855 | // let the avatar mixer know we're out | ||
| 856 | MyAvatar::sendKillAvatar(); | ||
| 857 | |||
| 858 | // stop the AudioClient | 895 | // stop the AudioClient |
| 859 | QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), | 896 | QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), |
| 860 | "stop", Qt::BlockingQueuedConnection); | 897 | "stop", Qt::BlockingQueuedConnection); |
| @@ -944,14 +981,12 @@ void Application::initializeGL() { · 83 unmodified lines | |||
| 944 | qCDebug(interfaceapp) << "Created Display Window."; | 981 | qCDebug(interfaceapp) << "Created Display Window."; |
| 945 | 982 | ||
| 946 | // initialize glut for shape drawing; Qt apparently initializes it on OS X | 983 | // initialize glut for shape drawing; Qt apparently initializes it on OS X |
| 947 | #ifndef __APPLE__ | 984 | if (_isGLInitialized) { |
| 948 | static bool isInitialized = false; | ||
| 949 | if (isInitialized) { | ||
| 950 | return; | 985 | return; |
| 951 | } else { | 986 | } else { |
| 952 | isInitialized = true; | 987 | _isGLInitialized = true; |
| 953 | } | 988 | } |
| 954 | #endif | 989 | |
| 955 | // Where the gpuContext is initialized and where the TRUE Backend is created and assigned | 990 | // Where the gpuContext is initialized and where the TRUE Backend is created and assigned |
| 956 | gpu::Context::init<gpu::GLBackend>(); | 991 | gpu::Context::init<gpu::GLBackend>(); |
| 957 | _gpuContext = std::make_shared<gpu::Context>(); | 992 | _gpuContext = std::make_shared<gpu::Context>(); |
| @@ -978,10 +1013,6 @@ void Application::initializeGL() { · 20 unmodified lines | |||
| 978 | connect(&_octreeProcessor, &OctreePacketProcessor::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); | 1013 | connect(&_octreeProcessor, &OctreePacketProcessor::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); |
| 979 | _entityEditSender.initialize(_enableProcessOctreeThread); | 1014 | _entityEditSender.initialize(_enableProcessOctreeThread); |
| 980 | 1015 | ||
| 981 | // call our timer function every second | ||
| 982 | connect(&pingTimer, &QTimer::timeout, this, &Application::ping); | ||
| 983 | pingTimer.start(1000); | ||
| 984 | |||
| 985 | _idleLoopStdev.reset(); | 1016 | _idleLoopStdev.reset(); |
| 986 | 1017 | ||
| 987 | // update before the first render | 1018 | // update before the first render |
| @@ -992,6 +1023,7 @@ void Application::initializeGL() { · 4 unmodified lines | |||
| 992 | 1023 | ||
| 993 | void Application::initializeUi() { | 1024 | void Application::initializeUi() { |
| 994 | AddressBarDialog::registerType(); | 1025 | AddressBarDialog::registerType(); |
| 1026 | RecorderDialog::registerType(); | ||
| 995 | ErrorDialog::registerType(); | 1027 | ErrorDialog::registerType(); |
| 996 | LoginDialog::registerType(); | 1028 | LoginDialog::registerType(); |
| 997 | MessageDialog::registerType(); | 1029 | MessageDialog::registerType(); |
| @@ -1007,6 +1039,7 @@ void Application::initializeUi() { · 9 unmodified lines | |||
| 1007 | offscreenUi->load("RootMenu.qml"); | 1039 | offscreenUi->load("RootMenu.qml"); |
| 1008 | auto scriptingInterface = DependencyManager::get<controller::ScriptingInterface>(); | 1040 | auto scriptingInterface = DependencyManager::get<controller::ScriptingInterface>(); |
| 1009 | offscreenUi->getRootContext()->setContextProperty("Controller", scriptingInterface.data()); | 1041 | offscreenUi->getRootContext()->setContextProperty("Controller", scriptingInterface.data()); |
| 1042 | offscreenUi->getRootContext()->setContextProperty("MyAvatar", getMyAvatar()); | ||
| 1010 | _glWidget->installEventFilter(offscreenUi.data()); | 1043 | _glWidget->installEventFilter(offscreenUi.data()); |
| 1011 | VrMenu::load(); | 1044 | VrMenu::load(); |
| 1012 | VrMenu::executeQueuedLambdas(); | 1045 | VrMenu::executeQueuedLambdas(); |
| @@ -1035,10 +1068,7 @@ void Application::initializeUi() { · 22 unmodified lines | |||
| 1035 | foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) { | 1068 | foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) { |
| 1036 | QString name = inputPlugin->getName(); | 1069 | QString name = inputPlugin->getName(); |
| 1037 | if (name == KeyboardMouseDevice::NAME) { | 1070 | if (name == KeyboardMouseDevice::NAME) { |
| 1038 | auto kbm = static_cast<KeyboardMouseDevice*>(inputPlugin.data()); | 1071 | _keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin); |
| 1039 | // FIXME incredibly evil.... _keyboardMouseDevice is now owned by | ||
| 1040 | // both a QSharedPointer and a std::shared_ptr | ||
| 1041 | _keyboardMouseDevice = std::shared_ptr<KeyboardMouseDevice>(kbm); | ||
| 1042 | } | 1072 | } |
| 1043 | } | 1073 | } |
| 1044 | updateInputModes(); | 1074 | updateInputModes(); |
| @@ -1063,7 +1093,9 @@ void Application::paintGL() { · 18 unmodified lines | |||
| 1063 | _lastFramesPerSecondUpdate = now; | 1093 | _lastFramesPerSecondUpdate = now; |
| 1064 | } | 1094 | } |
| 1065 | 1095 | ||
| 1066 | idle(now); | 1096 | if (_isGLInitialized) { |
| 1097 | idle(now); | ||
| 1098 | } | ||
| 1067 | 1099 | ||
| 1068 | PROFILE_RANGE(__FUNCTION__); | 1100 | PROFILE_RANGE(__FUNCTION__); |
| 1069 | PerformanceTimer perfTimer("paintGL"); | 1101 | PerformanceTimer perfTimer("paintGL"); |
| @@ -1204,6 +1236,19 @@ void Application::paintGL() { · 134 unmodified lines | |||
| 1204 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | 1236 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 1205 | } | 1237 | } |
| 1206 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; | 1238 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; |
| 1239 | } else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) { | ||
| 1240 | EntityItemPointer cameraEntity = _myCamera.getCameraEntityPointer(); | ||
| 1241 | if (cameraEntity != nullptr) { | ||
| 1242 | if (isHMDMode()) { | ||
| 1243 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); | ||
| 1244 | _myCamera.setRotation(cameraEntity->getRotation() * hmdRotation); | ||
| 1245 | glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); | ||
| 1246 | _myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset)); | ||
| 1247 | } else { | ||
| 1248 | _myCamera.setRotation(cameraEntity->getRotation()); | ||
| 1249 | _myCamera.setPosition(cameraEntity->getPosition()); | ||
| 1250 | } | ||
| 1251 | } | ||
| 1207 | } | 1252 | } |
| 1208 | // Update camera position | 1253 | // Update camera position |
| 1209 | if (!isHMDMode()) { | 1254 | if (!isHMDMode()) { |
| @@ -1577,8 +1622,9 @@ void Application::keyPressEvent(QKeyEvent* event) { · 367 unmodified lines | |||
| 1577 | 1622 | ||
| 1578 | case Qt::Key_X: | 1623 | case Qt::Key_X: |
| 1579 | if (isMeta && isShifted) { | 1624 | if (isMeta && isShifted) { |
| 1580 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 1625 | // auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 1581 | offscreenUi->load("TestControllers.qml"); | 1626 | // offscreenUi->load("TestControllers.qml"); |
| 1627 | RecorderDialog::toggle(); | ||
| 1582 | } | 1628 | } |
| 1583 | break; | 1629 | break; |
| 1584 | 1630 | ||
| @@ -1855,8 +1901,12 @@ void Application::focusOutEvent(QFocusEvent* event) { · 270 unmodified lines | |||
| 1855 | inputPlugin->pluginFocusOutEvent(); | 1901 | inputPlugin->pluginFocusOutEvent(); |
| 1856 | } | 1902 | } |
| 1857 | } | 1903 | } |
| 1904 | |||
| 1905 | // FIXME spacemouse code still needs cleanup | ||
| 1858 | #if 0 | 1906 | #if 0 |
| 1859 | ConnexionData::getInstance().focusOutEvent(); | 1907 | //SpacemouseDevice::getInstance().focusOutEvent(); |
| 1908 | //SpacemouseManager::getInstance().getDevice()->focusOutEvent(); | ||
| 1909 | SpacemouseManager::getInstance().ManagerFocusOutEvent(); | ||
| 1860 | #endif | 1910 | #endif |
| 1861 | 1911 | ||
| 1862 | // synthesize events for keys currently pressed, since we may not get their release events | 1912 | // synthesize events for keys currently pressed, since we may not get their release events |
| @@ -2103,13 +2153,6 @@ bool Application::acceptSnapshot(const QString& urlString) { · 240 unmodified lines | |||
| 2103 | return true; | 2153 | return true; |
| 2104 | } | 2154 | } |
| 2105 | 2155 | ||
| 2106 | // Every second, send a ping, if menu item is checked. | ||
| 2107 | void Application::ping() { | ||
| 2108 | if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) { | ||
| 2109 | DependencyManager::get<NodeList>()->sendPingPackets(); | ||
| 2110 | } | ||
| 2111 | } | ||
| 2112 | |||
| 2113 | void Application::idle(uint64_t now) { | 2156 | void Application::idle(uint64_t now) { |
| 2114 | if (_aboutToQuit) { | 2157 | if (_aboutToQuit) { |
| 2115 | return; // bail early, nothing to do here. | 2158 | return; // bail early, nothing to do here. |
| @@ -2649,8 +2692,8 @@ void Application::cycleCamera() { · 533 unmodified lines | |||
| 2649 | menu->setIsOptionChecked(MenuOption::ThirdPerson, false); | 2692 | menu->setIsOptionChecked(MenuOption::ThirdPerson, false); |
| 2650 | menu->setIsOptionChecked(MenuOption::FullscreenMirror, true); | 2693 | menu->setIsOptionChecked(MenuOption::FullscreenMirror, true); |
| 2651 | 2694 | ||
| 2652 | } else if (menu->isOptionChecked(MenuOption::IndependentMode)) { | 2695 | } else if (menu->isOptionChecked(MenuOption::IndependentMode) || menu->isOptionChecked(MenuOption::CameraEntityMode)) { |
| 2653 | // do nothing if in independe mode | 2696 | // do nothing if in independent or camera entity modes |
| 2654 | return; | 2697 | return; |
| 2655 | } | 2698 | } |
| 2656 | cameraMenuChanged(); // handle the menu change | 2699 | cameraMenuChanged(); // handle the menu change |
| @@ -2677,6 +2720,10 @@ void Application::cameraMenuChanged() { · 20 unmodified lines | |||
| 2677 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { | 2720 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { |
| 2678 | _myCamera.setMode(CAMERA_MODE_INDEPENDENT); | 2721 | _myCamera.setMode(CAMERA_MODE_INDEPENDENT); |
| 2679 | } | 2722 | } |
| 2723 | } else if (Menu::getInstance()->isOptionChecked(MenuOption::CameraEntityMode)) { | ||
| 2724 | if (_myCamera.getMode() != CAMERA_MODE_ENTITY) { | ||
| 2725 | _myCamera.setMode(CAMERA_MODE_ENTITY); | ||
| 2726 | } | ||
| 2680 | } | 2727 | } |
| 2681 | } | 2728 | } |
| 2682 | 2729 | ||
| @@ -2799,7 +2846,7 @@ void Application::update(float deltaTime) { · 116 unmodified lines | |||
| 2799 | float timeFactor = EXPECTED_FRAME_RATE * deltaTime; | 2846 | float timeFactor = EXPECTED_FRAME_RATE * deltaTime; |
| 2800 | myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH) / timeFactor); | 2847 | myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH) / timeFactor); |
| 2801 | myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW) / timeFactor); | 2848 | myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW) / timeFactor); |
| 2802 | myAvatar->setDriveKeys(STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW) / timeFactor); | 2849 | myAvatar->setDriveKeys(STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW)); |
| 2803 | } | 2850 | } |
| 2804 | } | 2851 | } |
| 2805 | myAvatar->setDriveKeys(ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); | 2852 | myAvatar->setDriveKeys(ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); |
| @@ -3498,10 +3545,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 692 unmodified lines | |||
| 3498 | if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowHulls)) { | 3545 | if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowHulls)) { |
| 3499 | renderDebugFlags = (RenderArgs::DebugFlags) (renderDebugFlags | (int)RenderArgs::RENDER_DEBUG_HULLS); | 3546 | renderDebugFlags = (RenderArgs::DebugFlags) (renderDebugFlags | (int)RenderArgs::RENDER_DEBUG_HULLS); |
| 3500 | } | 3547 | } |
| 3501 | if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned)) { | ||
| 3502 | renderDebugFlags = | ||
| 3503 | (RenderArgs::DebugFlags) (renderDebugFlags | (int)RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP); | ||
| 3504 | } | ||
| 3505 | renderArgs->_debugFlags = renderDebugFlags; | 3548 | renderArgs->_debugFlags = renderDebugFlags; |
| 3506 | //ViveControllerManager::getInstance().updateRendering(renderArgs, _main3DScene, pendingChanges); | 3549 | //ViveControllerManager::getInstance().updateRendering(renderArgs, _main3DScene, pendingChanges); |
| 3507 | } | 3550 | } |
| @@ -3561,6 +3604,9 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 53 unmodified lines | |||
| 3561 | renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems(); | 3604 | renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems(); |
| 3562 | 3605 | ||
| 3563 | renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus(); | 3606 | renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus(); |
| 3607 | if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned)) { | ||
| 3608 | renderContext._drawItemStatus |= render::showNetworkStatusFlag; | ||
| 3609 | } | ||
| 3564 | renderContext._drawHitEffect = sceneInterface->doEngineDisplayHitEffect(); | 3610 | renderContext._drawHitEffect = sceneInterface->doEngineDisplayHitEffect(); |
| 3565 | 3611 | ||
| 3566 | renderContext._occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion); | 3612 | renderContext._occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion); |
| @@ -4650,7 +4696,7 @@ DisplayPlugin* Application::getActiveDisplayPlugin() { · 1083 unmodified lines | |||
| 4650 | updateDisplayMode(); | 4696 | updateDisplayMode(); |
| 4651 | Q_ASSERT(_displayPlugin); | 4697 | Q_ASSERT(_displayPlugin); |
| 4652 | } | 4698 | } |
| 4653 | return _displayPlugin.data(); | 4699 | return _displayPlugin.get(); |
| 4654 | } | 4700 | } |
| 4655 | 4701 | ||
| 4656 | const DisplayPlugin* Application::getActiveDisplayPlugin() const { | 4702 | const DisplayPlugin* Application::getActiveDisplayPlugin() const { |
| @@ -4690,10 +4736,10 @@ void Application::updateDisplayMode() { · 33 unmodified lines | |||
| 4690 | bool first = true; | 4736 | bool first = true; |
| 4691 | foreach(auto displayPlugin, displayPlugins) { | 4737 | foreach(auto displayPlugin, displayPlugins) { |
| 4692 | addDisplayPluginToMenu(displayPlugin, first); | 4738 | addDisplayPluginToMenu(displayPlugin, first); |
| 4693 | QObject::connect(displayPlugin.data(), &DisplayPlugin::requestRender, [this] { | 4739 | QObject::connect(displayPlugin.get(), &DisplayPlugin::requestRender, [this] { |
| 4694 | paintGL(); | 4740 | paintGL(); |
| 4695 | }); | 4741 | }); |
| 4696 | QObject::connect(displayPlugin.data(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) { | 4742 | QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) { |
| 4697 | resizeGL(); | 4743 | resizeGL(); |
| 4698 | }); | 4744 | }); |
| 4699 | 4745 | ||
| @@ -4819,12 +4865,14 @@ void Application::updateInputModes() { · 119 unmodified lines | |||
| 4819 | foreach(auto inputPlugin, inputPlugins) { | 4865 | foreach(auto inputPlugin, inputPlugins) { |
| 4820 | QString name = inputPlugin->getName(); | 4866 | QString name = inputPlugin->getName(); |
| 4821 | QAction* action = menu->getActionForOption(name); | 4867 | QAction* action = menu->getActionForOption(name); |
| 4822 | if (action->isChecked() && !_activeInputPlugins.contains(inputPlugin)) { | 4868 | |
| 4823 | _activeInputPlugins.append(inputPlugin); | 4869 | auto it = std::find(std::begin(_activeInputPlugins), std::end(_activeInputPlugins), inputPlugin); |
| 4824 | newInputPlugins.append(inputPlugin); | 4870 | if (action->isChecked() && it == std::end(_activeInputPlugins)) { |
| 4825 | } else if (!action->isChecked() && _activeInputPlugins.contains(inputPlugin)) { | 4871 | _activeInputPlugins.push_back(inputPlugin); |
| 4826 | _activeInputPlugins.removeOne(inputPlugin); | 4872 | newInputPlugins.push_back(inputPlugin); |
| 4827 | removedInputPlugins.append(inputPlugin); | 4873 | } else if (!action->isChecked() && it != std::end(_activeInputPlugins)) { |
| 4874 | _activeInputPlugins.erase(it); | ||
| 4875 | removedInputPlugins.push_back(inputPlugin); | ||
| 4828 | } | 4876 | } |
| 4829 | } | 4877 | } |
| 4830 | 4878 | ||