Showing the changes to interface/src/Application.cpp (1 of 52 files). Show all
Unified · Split
| @@ -88,6 +88,7 @@ · 87 unmodified lines | |||
| 88 | #include <RenderDeferredTask.h> | 88 | #include <RenderDeferredTask.h> |
| 89 | #include <ResourceCache.h> | 89 | #include <ResourceCache.h> |
| 90 | #include <SceneScriptingInterface.h> | 90 | #include <SceneScriptingInterface.h> |
| 91 | #include <RecordingScriptingInterface.h> | ||
| 91 | #include <ScriptCache.h> | 92 | #include <ScriptCache.h> |
| 92 | #include <SoundCache.h> | 93 | #include <SoundCache.h> |
| 93 | #include <TextureCache.h> | 94 | #include <TextureCache.h> |
| @@ -128,7 +129,6 @@ · 34 unmodified lines | |||
| 128 | #include "scripting/LocationScriptingInterface.h" | 129 | #include "scripting/LocationScriptingInterface.h" |
| 129 | #include "scripting/MenuScriptingInterface.h" | 130 | #include "scripting/MenuScriptingInterface.h" |
| 130 | #include "scripting/SettingsScriptingInterface.h" | 131 | #include "scripting/SettingsScriptingInterface.h" |
| 131 | #include "scripting/RecordingScriptingInterface.h" | ||
| 132 | #include "scripting/WebWindowClass.h" | 132 | #include "scripting/WebWindowClass.h" |
| 133 | #include "scripting/WindowScriptingInterface.h" | 133 | #include "scripting/WindowScriptingInterface.h" |
| 134 | #include "scripting/ControllerScriptingInterface.h" | 134 | #include "scripting/ControllerScriptingInterface.h" |
| @@ -745,6 +745,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 610 unmodified lines | |||
| 745 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); | 745 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); |
| 746 | applicationUpdater->checkForUpdate(); | 746 | applicationUpdater->checkForUpdate(); |
| 747 | 747 | ||
| 748 | // Assign MyAvatar to th eRecording Singleton | ||
| 749 | DependencyManager::get<RecordingScriptingInterface>()->setControlledAvatar(getMyAvatar()); | ||
| 750 | |||
| 751 | |||
| 748 | // Now that menu is initalized we can sync myAvatar with it's state. | 752 | // Now that menu is initalized we can sync myAvatar with it's state. |
| 749 | getMyAvatar()->updateMotionBehaviorFromMenu(); | 753 | getMyAvatar()->updateMotionBehaviorFromMenu(); |
| 750 | 754 | ||
| @@ -839,6 +843,7 @@ void Application::cleanupBeforeQuit() { · 88 unmodified lines | |||
| 839 | #ifdef HAVE_IVIEWHMD | 843 | #ifdef HAVE_IVIEWHMD |
| 840 | DependencyManager::get<EyeTracker>()->setEnabled(false, true); | 844 | DependencyManager::get<EyeTracker>()->setEnabled(false, true); |
| 841 | #endif | 845 | #endif |
| 846 | DependencyManager::get<RecordingScriptingInterface>()->setControlledAvatar(nullptr); | ||
| 842 | 847 | ||
| 843 | AnimDebugDraw::getInstance().shutdown(); | 848 | AnimDebugDraw::getInstance().shutdown(); |
| 844 | 849 | ||
| @@ -1005,10 +1010,6 @@ void Application::initializeGL() { · 160 unmodified lines | |||
| 1005 | connect(&_octreeProcessor, &OctreePacketProcessor::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); | 1010 | connect(&_octreeProcessor, &OctreePacketProcessor::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); |
| 1006 | _entityEditSender.initialize(_enableProcessOctreeThread); | 1011 | _entityEditSender.initialize(_enableProcessOctreeThread); |
| 1007 | 1012 | ||
| 1008 | // call our timer function every second | ||
| 1009 | connect(&pingTimer, &QTimer::timeout, this, &Application::ping); | ||
| 1010 | pingTimer.start(1000); | ||
| 1011 | |||
| 1012 | _idleLoopStdev.reset(); | 1013 | _idleLoopStdev.reset(); |
| 1013 | 1014 | ||
| 1014 | // update before the first render | 1015 | // update before the first render |
| @@ -1232,6 +1233,19 @@ void Application::paintGL() { · 217 unmodified lines | |||
| 1232 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | 1233 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 1233 | } | 1234 | } |
| 1234 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; | 1235 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; |
| 1236 | } else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) { | ||
| 1237 | EntityItemPointer cameraEntity = _myCamera.getCameraEntityPointer(); | ||
| 1238 | if (cameraEntity != nullptr) { | ||
| 1239 | if (isHMDMode()) { | ||
| 1240 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); | ||
| 1241 | _myCamera.setRotation(cameraEntity->getRotation() * hmdRotation); | ||
| 1242 | glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); | ||
| 1243 | _myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset)); | ||
| 1244 | } else { | ||
| 1245 | _myCamera.setRotation(cameraEntity->getRotation()); | ||
| 1246 | _myCamera.setPosition(cameraEntity->getPosition()); | ||
| 1247 | } | ||
| 1248 | } | ||
| 1235 | } | 1249 | } |
| 1236 | // Update camera position | 1250 | // Update camera position |
| 1237 | if (!isHMDMode()) { | 1251 | if (!isHMDMode()) { |
| @@ -2136,13 +2150,6 @@ bool Application::acceptSnapshot(const QString& urlString) { · 898 unmodified lines | |||
| 2136 | return true; | 2150 | return true; |
| 2137 | } | 2151 | } |
| 2138 | 2152 | ||
| 2139 | // Every second, send a ping, if menu item is checked. | ||
| 2140 | void Application::ping() { | ||
| 2141 | if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) { | ||
| 2142 | DependencyManager::get<NodeList>()->sendPingPackets(); | ||
| 2143 | } | ||
| 2144 | } | ||
| 2145 | |||
| 2146 | void Application::idle(uint64_t now) { | 2153 | void Application::idle(uint64_t now) { |
| 2147 | if (_aboutToQuit) { | 2154 | if (_aboutToQuit) { |
| 2148 | return; // bail early, nothing to do here. | 2155 | return; // bail early, nothing to do here. |
| @@ -2682,8 +2689,8 @@ void Application::cycleCamera() { · 533 unmodified lines | |||
| 2682 | menu->setIsOptionChecked(MenuOption::ThirdPerson, false); | 2689 | menu->setIsOptionChecked(MenuOption::ThirdPerson, false); |
| 2683 | menu->setIsOptionChecked(MenuOption::FullscreenMirror, true); | 2690 | menu->setIsOptionChecked(MenuOption::FullscreenMirror, true); |
| 2684 | 2691 | ||
| 2685 | } else if (menu->isOptionChecked(MenuOption::IndependentMode)) { | 2692 | } else if (menu->isOptionChecked(MenuOption::IndependentMode) || menu->isOptionChecked(MenuOption::CameraEntityMode)) { |
| 2686 | // do nothing if in independe mode | 2693 | // do nothing if in independent or camera entity modes |
| 2687 | return; | 2694 | return; |
| 2688 | } | 2695 | } |
| 2689 | cameraMenuChanged(); // handle the menu change | 2696 | cameraMenuChanged(); // handle the menu change |
| @@ -2710,6 +2717,10 @@ void Application::cameraMenuChanged() { · 20 unmodified lines | |||
| 2710 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { | 2717 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { |
| 2711 | _myCamera.setMode(CAMERA_MODE_INDEPENDENT); | 2718 | _myCamera.setMode(CAMERA_MODE_INDEPENDENT); |
| 2712 | } | 2719 | } |
| 2720 | } else if (Menu::getInstance()->isOptionChecked(MenuOption::CameraEntityMode)) { | ||
| 2721 | if (_myCamera.getMode() != CAMERA_MODE_ENTITY) { | ||
| 2722 | _myCamera.setMode(CAMERA_MODE_ENTITY); | ||
| 2723 | } | ||
| 2713 | } | 2724 | } |
| 2714 | } | 2725 | } |
| 2715 | 2726 | ||
| @@ -3995,7 +4006,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 1279 unmodified lines | |||
| 3995 | RayToOverlayIntersectionResultFromScriptValue); | 4006 | RayToOverlayIntersectionResultFromScriptValue); |
| 3996 | 4007 | ||
| 3997 | scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data()); | 4008 | scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data()); |
| 3998 | scriptEngine->registerGlobalObject("Recording", DependencyManager::get<RecordingScriptingInterface>().data()); | ||
| 3999 | 4009 | ||
| 4000 | scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data()); | 4010 | scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data()); |
| 4001 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, | 4011 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, |