Showing the changes to interface/src/Application.cpp (1 of 87 files). Show all
Unified · Split
| @@ -115,6 +115,7 @@ · 114 unmodified lines | |||
| 115 | #include "devices/Faceshift.h" | 115 | #include "devices/Faceshift.h" |
| 116 | #include "devices/Leapmotion.h" | 116 | #include "devices/Leapmotion.h" |
| 117 | #include "devices/RealSense.h" | 117 | #include "devices/RealSense.h" |
| 118 | #include "devices/SDL2Manager.h" | ||
| 118 | #include "devices/MIDIManager.h" | 119 | #include "devices/MIDIManager.h" |
| 119 | #include "devices/OculusManager.h" | 120 | #include "devices/OculusManager.h" |
| 120 | #include "devices/TV3DManager.h" | 121 | #include "devices/TV3DManager.h" |
| @@ -129,7 +130,6 @@ · 8 unmodified lines | |||
| 129 | #include "scripting/AudioDeviceScriptingInterface.h" | 130 | #include "scripting/AudioDeviceScriptingInterface.h" |
| 130 | #include "scripting/ClipboardScriptingInterface.h" | 131 | #include "scripting/ClipboardScriptingInterface.h" |
| 131 | #include "scripting/HMDScriptingInterface.h" | 132 | #include "scripting/HMDScriptingInterface.h" |
| 132 | #include "scripting/JoystickScriptingInterface.h" | ||
| 133 | #include "scripting/GlobalServicesScriptingInterface.h" | 133 | #include "scripting/GlobalServicesScriptingInterface.h" |
| 134 | #include "scripting/LocationScriptingInterface.h" | 134 | #include "scripting/LocationScriptingInterface.h" |
| 135 | #include "scripting/MenuScriptingInterface.h" | 135 | #include "scripting/MenuScriptingInterface.h" |
| @@ -196,7 +196,6 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 60 unmodified lines | |||
| 196 | const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js"; | 196 | const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js"; |
| 197 | Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); | 197 | Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); |
| 198 | 198 | ||
| 199 | |||
| 200 | #ifdef Q_OS_WIN | 199 | #ifdef Q_OS_WIN |
| 201 | class MyNativeEventFilter : public QAbstractNativeEventFilter { | 200 | class MyNativeEventFilter : public QAbstractNativeEventFilter { |
| 202 | public: | 201 | public: |
| @@ -889,6 +888,9 @@ void Application::paintGL() { · 686 unmodified lines | |||
| 889 | } | 888 | } |
| 890 | 889 | ||
| 891 | glEnable(GL_LINE_SMOOTH); | 890 | glEnable(GL_LINE_SMOOTH); |
| 891 | |||
| 892 | Menu::getInstance()->setIsOptionChecked("First Person", _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN); | ||
| 893 | Application::getInstance()->cameraMenuChanged(); | ||
| 892 | 894 | ||
| 893 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { | 895 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| 894 | // Always use the default eye position, not the actual head eye position. | 896 | // Always use the default eye position, not the actual head eye position. |
| @@ -907,9 +909,8 @@ void Application::paintGL() { · 12 unmodified lines | |||
| 907 | } | 909 | } |
| 908 | 910 | ||
| 909 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { | 911 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 910 | static const float THIRD_PERSON_CAMERA_DISTANCE = 1.5f; | ||
| 911 | _myCamera.setPosition(_myAvatar->getDefaultEyePosition() + | 912 | _myCamera.setPosition(_myAvatar->getDefaultEyePosition() + |
| 912 | _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * THIRD_PERSON_CAMERA_DISTANCE * _myAvatar->getScale()); | 913 | _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale()); |
| 913 | if (OculusManager::isConnected()) { | 914 | if (OculusManager::isConnected()) { |
| 914 | _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation()); | 915 | _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation()); |
| 915 | } else { | 916 | } else { |
| @@ -1492,6 +1493,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 576 unmodified lines | |||
| 1492 | 1493 | ||
| 1493 | void Application::focusOutEvent(QFocusEvent* event) { | 1494 | void Application::focusOutEvent(QFocusEvent* event) { |
| 1494 | _keyboardMouseDevice.focusOutEvent(event); | 1495 | _keyboardMouseDevice.focusOutEvent(event); |
| 1496 | SixenseManager::getInstance().focusOutEvent(); | ||
| 1497 | SDL2Manager::getInstance()->focusOutEvent(); | ||
| 1495 | 1498 | ||
| 1496 | // synthesize events for keys currently pressed, since we may not get their release events | 1499 | // synthesize events for keys currently pressed, since we may not get their release events |
| 1497 | foreach (int key, _keysPressed) { | 1500 | foreach (int key, _keysPressed) { |
| @@ -1927,11 +1930,15 @@ void Application::setEnableVRMode(bool enableVRMode) { · 429 unmodified lines | |||
| 1927 | // attempt to reconnect the Oculus manager - it's possible this was a workaround | 1930 | // attempt to reconnect the Oculus manager - it's possible this was a workaround |
| 1928 | // for the sixense crash | 1931 | // for the sixense crash |
| 1929 | OculusManager::disconnect(); | 1932 | OculusManager::disconnect(); |
| 1930 | OculusManager::connect(); | 1933 | OculusManager::connect(_glWidget->context()->contextHandle()); |
| 1934 | _glWidget->setFocus(); | ||
| 1935 | _glWidget->makeCurrent(); | ||
| 1936 | glClear(GL_COLOR_BUFFER_BIT); | ||
| 1931 | } | 1937 | } |
| 1932 | OculusManager::recalibrate(); | 1938 | OculusManager::recalibrate(); |
| 1933 | } else { | 1939 | } else { |
| 1934 | OculusManager::abandonCalibration(); | 1940 | OculusManager::abandonCalibration(); |
| 1941 | OculusManager::disconnect(); | ||
| 1935 | 1942 | ||
| 1936 | _mirrorCamera.setHmdPosition(glm::vec3()); | 1943 | _mirrorCamera.setHmdPosition(glm::vec3()); |
| 1937 | _mirrorCamera.setHmdRotation(glm::quat()); | 1944 | _mirrorCamera.setHmdRotation(glm::quat()); |
| @@ -2167,13 +2174,6 @@ void Application::init() { · 229 unmodified lines | |||
| 2167 | 2174 | ||
| 2168 | _mirrorCamera.setMode(CAMERA_MODE_MIRROR); | 2175 | _mirrorCamera.setMode(CAMERA_MODE_MIRROR); |
| 2169 | 2176 | ||
| 2170 | OculusManager::connect(); | ||
| 2171 | if (OculusManager::isConnected()) { | ||
| 2172 | QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen), | ||
| 2173 | "trigger", | ||
| 2174 | Qt::QueuedConnection); | ||
| 2175 | } | ||
| 2176 | |||
| 2177 | TV3DManager::connect(); | 2177 | TV3DManager::connect(); |
| 2178 | if (TV3DManager::isConnected()) { | 2178 | if (TV3DManager::isConnected()) { |
| 2179 | QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen), | 2179 | QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen), |
| @@ -2406,10 +2406,14 @@ void Application::cameraMenuChanged() { · 226 unmodified lines | |||
| 2406 | } else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) { | 2406 | } else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) { |
| 2407 | if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { | 2407 | if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { |
| 2408 | _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); | 2408 | _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); |
| 2409 | _myAvatar->setBoomLength(MyAvatar::ZOOM_MIN); | ||
| 2409 | } | 2410 | } |
| 2410 | } else { | 2411 | } else { |
| 2411 | if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) { | 2412 | if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) { |
| 2412 | _myCamera.setMode(CAMERA_MODE_THIRD_PERSON); | 2413 | _myCamera.setMode(CAMERA_MODE_THIRD_PERSON); |
| 2414 | if (_myAvatar->getBoomLength() == MyAvatar::ZOOM_MIN) { | ||
| 2415 | _myAvatar->setBoomLength(MyAvatar::ZOOM_DEFAULT); | ||
| 2416 | } | ||
| 2413 | } | 2417 | } |
| 2414 | } | 2418 | } |
| 2415 | } | 2419 | } |
| @@ -2487,7 +2491,7 @@ void Application::update(float deltaTime) { · 71 unmodified lines | |||
| 2487 | } | 2491 | } |
| 2488 | 2492 | ||
| 2489 | SixenseManager::getInstance().update(deltaTime); | 2493 | SixenseManager::getInstance().update(deltaTime); |
| 2490 | JoystickScriptingInterface::getInstance().update(); | 2494 | SDL2Manager::getInstance()->update(); |
| 2491 | } | 2495 | } |
| 2492 | 2496 | ||
| 2493 | _userInputMapper.update(deltaTime); | 2497 | _userInputMapper.update(deltaTime); |
| @@ -2508,7 +2512,8 @@ void Application::update(float deltaTime) { · 14 unmodified lines | |||
| 2508 | _myAvatar->setDriveKeys(ROT_DOWN, _userInputMapper.getActionState(UserInputMapper::PITCH_DOWN)); | 2512 | _myAvatar->setDriveKeys(ROT_DOWN, _userInputMapper.getActionState(UserInputMapper::PITCH_DOWN)); |
| 2509 | _myAvatar->setDriveKeys(ROT_LEFT, _userInputMapper.getActionState(UserInputMapper::YAW_LEFT)); | 2513 | _myAvatar->setDriveKeys(ROT_LEFT, _userInputMapper.getActionState(UserInputMapper::YAW_LEFT)); |
| 2510 | _myAvatar->setDriveKeys(ROT_RIGHT, _userInputMapper.getActionState(UserInputMapper::YAW_RIGHT)); | 2514 | _myAvatar->setDriveKeys(ROT_RIGHT, _userInputMapper.getActionState(UserInputMapper::YAW_RIGHT)); |
| 2511 | 2515 | _myAvatar->setDriveKeys(BOOM_IN, _userInputMapper.getActionState(UserInputMapper::BOOM_IN)); | |
| 2516 | _myAvatar->setDriveKeys(BOOM_OUT, _userInputMapper.getActionState(UserInputMapper::BOOM_OUT)); | ||
| 2512 | 2517 | ||
| 2513 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... | 2518 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |
| 2514 | 2519 | ||
| @@ -3260,6 +3265,9 @@ namespace render { · 745 unmodified lines | |||
| 3260 | template <> const Item::Bound payloadGetBound(const BackgroundRenderData::Pointer& stuff) { return Item::Bound(); } | 3265 | template <> const Item::Bound payloadGetBound(const BackgroundRenderData::Pointer& stuff) { return Item::Bound(); } |
| 3261 | template <> void payloadRender(const BackgroundRenderData::Pointer& background, RenderArgs* args) { | 3266 | template <> void payloadRender(const BackgroundRenderData::Pointer& background, RenderArgs* args) { |
| 3262 | 3267 | ||
| 3268 | Q_ASSERT(args->_batch); | ||
| 3269 | gpu::Batch& batch = *args->_batch; | ||
| 3270 | |||
| 3263 | // Background rendering decision | 3271 | // Background rendering decision |
| 3264 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); | 3272 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); |
| 3265 | auto skybox = model::SkyboxPointer(); | 3273 | auto skybox = model::SkyboxPointer(); |
| @@ -3327,7 +3335,8 @@ namespace render { · 61 unmodified lines | |||
| 3327 | PerformanceTimer perfTimer("atmosphere"); | 3335 | PerformanceTimer perfTimer("atmosphere"); |
| 3328 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 3336 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 3329 | "Application::displaySide() ... atmosphere..."); | 3337 | "Application::displaySide() ... atmosphere..."); |
| 3330 | background->_environment->renderAtmospheres(*(args->_viewFrustum)); | 3338 | |
| 3339 | background->_environment->renderAtmospheres(batch, *(args->_viewFrustum)); | ||
| 3331 | } | 3340 | } |
| 3332 | 3341 | ||
| 3333 | } | 3342 | } |
| @@ -3336,13 +3345,13 @@ namespace render { · 2 unmodified lines | |||
| 3336 | 3345 | ||
| 3337 | skybox = skyStage->getSkybox(); | 3346 | skybox = skyStage->getSkybox(); |
| 3338 | if (skybox) { | 3347 | if (skybox) { |
| 3339 | gpu::Batch batch; | ||
| 3340 | model::Skybox::render(batch, *(Application::getInstance()->getDisplayViewFrustum()), *skybox); | 3348 | model::Skybox::render(batch, *(Application::getInstance()->getDisplayViewFrustum()), *skybox); |
| 3341 | |||
| 3342 | gpu::GLBackend::renderBatch(batch, true); | ||
| 3343 | glUseProgram(0); | ||
| 3344 | } | 3349 | } |
| 3345 | } | 3350 | } |
| 3351 | // FIX ME - If I don't call this renderBatch() here, then the atmosphere and skybox don't render, but it | ||
| 3352 | // seems like these payloadRender() methods shouldn't be doing this. We need to investigate why the engine | ||
| 3353 | // isn't rendering our batch | ||
| 3354 | gpu::GLBackend::renderBatch(batch, true); | ||
| 3346 | } | 3355 | } |
| 3347 | } | 3356 | } |
| 3348 | 3357 | ||
| @@ -4078,7 +4087,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 729 unmodified lines | |||
| 4078 | 4087 | ||
| 4079 | scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data()); | 4088 | scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data()); |
| 4080 | 4089 | ||
| 4081 | scriptEngine->registerGlobalObject("Joysticks", &JoystickScriptingInterface::getInstance()); | ||
| 4082 | qScriptRegisterMetaType(scriptEngine, joystickToScriptValue, joystickFromScriptValue); | 4090 | qScriptRegisterMetaType(scriptEngine, joystickToScriptValue, joystickFromScriptValue); |
| 4083 | 4091 | ||
| 4084 | scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface); | 4092 | scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface); |