Showing the changes to interface/src/Application.cpp (1 of 87 files). Show all
Unified · Split
| @@ -115,6 +115,7 @@ · 114 unmodified lines | ||
| 115 | 115 | #include "devices/Faceshift.h" |
| 116 | 116 | #include "devices/Leapmotion.h" |
| 117 | 117 | #include "devices/RealSense.h" |
| 118 | +#include "devices/SDL2Manager.h" | |
| 118 | 119 | #include "devices/MIDIManager.h" |
| 119 | 120 | #include "devices/OculusManager.h" |
| 120 | 121 | #include "devices/TV3DManager.h" |
| @@ -129,7 +130,6 @@ · 8 unmodified lines | ||
| 129 | 130 | #include "scripting/AudioDeviceScriptingInterface.h" |
| 130 | 131 | #include "scripting/ClipboardScriptingInterface.h" |
| 131 | 132 | #include "scripting/HMDScriptingInterface.h" |
| 132 | −#include "scripting/JoystickScriptingInterface.h" | |
| 133 | 133 | #include "scripting/GlobalServicesScriptingInterface.h" |
| 134 | 134 | #include "scripting/LocationScriptingInterface.h" |
| 135 | 135 | #include "scripting/MenuScriptingInterface.h" |
| @@ -196,7 +196,6 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 60 unmodified lines | ||
| 196 | 196 | const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js"; |
| 197 | 197 | Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); |
| 198 | 198 | |
| 199 | − | |
| 200 | 199 | #ifdef Q_OS_WIN |
| 201 | 200 | class MyNativeEventFilter : public QAbstractNativeEventFilter { |
| 202 | 201 | public: |
| @@ -889,6 +888,9 @@ void Application::paintGL() { · 686 unmodified lines | ||
| 889 | 888 | } |
| 890 | 889 | |
| 891 | 890 | glEnable(GL_LINE_SMOOTH); |
| 891 | + | |
| 892 | + Menu::getInstance()->setIsOptionChecked("First Person", _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN); | |
| 893 | + Application::getInstance()->cameraMenuChanged(); | |
| 892 | 894 | |
| 893 | 895 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| 894 | 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 | 911 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 910 | − static const float THIRD_PERSON_CAMERA_DISTANCE = 1.5f; | |
| 911 | 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 | 914 | if (OculusManager::isConnected()) { |
| 914 | 915 | _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation()); |
| 915 | 916 | } else { |
| @@ -1492,6 +1493,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 576 unmodified lines | ||
| 1492 | 1493 | |
| 1493 | 1494 | void Application::focusOutEvent(QFocusEvent* event) { |
| 1494 | 1495 | _keyboardMouseDevice.focusOutEvent(event); |
| 1496 | + SixenseManager::getInstance().focusOutEvent(); | |
| 1497 | + SDL2Manager::getInstance()->focusOutEvent(); | |
| 1495 | 1498 | |
| 1496 | 1499 | // synthesize events for keys currently pressed, since we may not get their release events |
| 1497 | 1500 | foreach (int key, _keysPressed) { |
| @@ -1927,11 +1930,15 @@ void Application::setEnableVRMode(bool enableVRMode) { · 429 unmodified lines | ||
| 1927 | 1930 | // attempt to reconnect the Oculus manager - it's possible this was a workaround |
| 1928 | 1931 | // for the sixense crash |
| 1929 | 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 | 1938 | OculusManager::recalibrate(); |
| 1933 | 1939 | } else { |
| 1934 | 1940 | OculusManager::abandonCalibration(); |
| 1941 | + OculusManager::disconnect(); | |
| 1935 | 1942 | |
| 1936 | 1943 | _mirrorCamera.setHmdPosition(glm::vec3()); |
| 1937 | 1944 | _mirrorCamera.setHmdRotation(glm::quat()); |
| @@ -2167,13 +2174,6 @@ void Application::init() { · 229 unmodified lines | ||
| 2167 | 2174 | |
| 2168 | 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 | 2177 | TV3DManager::connect(); |
| 2178 | 2178 | if (TV3DManager::isConnected()) { |
| 2179 | 2179 | QMetaObject::invokeMethod(Menu::getInstance()->getActionForOption(MenuOption::Fullscreen), |
| @@ -2406,10 +2406,14 @@ void Application::cameraMenuChanged() { · 226 unmodified lines | ||
| 2406 | 2406 | } else if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) { |
| 2407 | 2407 | if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { |
| 2408 | 2408 | _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); |
| 2409 | + _myAvatar->setBoomLength(MyAvatar::ZOOM_MIN); | |
| 2409 | 2410 | } |
| 2410 | 2411 | } else { |
| 2411 | 2412 | if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) { |
| 2412 | 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 | 2493 | SixenseManager::getInstance().update(deltaTime); |
| 2490 | − JoystickScriptingInterface::getInstance().update(); | |
| 2494 | + SDL2Manager::getInstance()->update(); | |
| 2491 | 2495 | } |
| 2492 | 2496 | |
| 2493 | 2497 | _userInputMapper.update(deltaTime); |
| @@ -2508,7 +2512,8 @@ void Application::update(float deltaTime) { · 14 unmodified lines | ||
| 2508 | 2512 | _myAvatar->setDriveKeys(ROT_DOWN, _userInputMapper.getActionState(UserInputMapper::PITCH_DOWN)); |
| 2509 | 2513 | _myAvatar->setDriveKeys(ROT_LEFT, _userInputMapper.getActionState(UserInputMapper::YAW_LEFT)); |
| 2510 | 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 | 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 | 3265 | template <> const Item::Bound payloadGetBound(const BackgroundRenderData::Pointer& stuff) { return Item::Bound(); } |
| 3261 | 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 | 3271 | // Background rendering decision |
| 3264 | 3272 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); |
| 3265 | 3273 | auto skybox = model::SkyboxPointer(); |
| @@ -3327,7 +3335,8 @@ namespace render { · 61 unmodified lines | ||
| 3327 | 3335 | PerformanceTimer perfTimer("atmosphere"); |
| 3328 | 3336 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 3329 | 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 | 3346 | skybox = skyStage->getSkybox(); |
| 3338 | 3347 | if (skybox) { |
| 3339 | − gpu::Batch batch; | |
| 3340 | 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 | 4088 | scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data()); |
| 4080 | 4089 | |
| 4081 | − scriptEngine->registerGlobalObject("Joysticks", &JoystickScriptingInterface::getInstance()); | |
| 4082 | 4090 | qScriptRegisterMetaType(scriptEngine, joystickToScriptValue, joystickFromScriptValue); |
| 4083 | 4091 | |
| 4084 | 4092 | scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface); |