Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -121,7 +121,7 @@ · 120 unmodified lines | ||
| 121 | 121 | #include "devices/RealSense.h" |
| 122 | 122 | #include "devices/SDL2Manager.h" |
| 123 | 123 | #include "devices/MIDIManager.h" |
| 124 | −#include "RenderDeferredTask.h" | |
| 124 | + | |
| 125 | 125 | #include "scripting/AccountScriptingInterface.h" |
| 126 | 126 | #include "scripting/AudioDeviceScriptingInterface.h" |
| 127 | 127 | #include "scripting/ClipboardScriptingInterface.h" |
| @@ -172,22 +172,6 @@ public: · 44 unmodified lines | ||
| 172 | 172 | }; |
| 173 | 173 | |
| 174 | 174 | |
| 175 | −template <typename F> | |
| 176 | −void with_stable_stack_check(F f) { | |
| 177 | − GLint mvDepth, prDepth; | |
| 178 | − glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &mvDepth); | |
| 179 | − glGetIntegerv(GL_PROJECTION_STACK_DEPTH, &prDepth); | |
| 180 | − f(); | |
| 181 | − GLint mvDepthFinal, prDepthFinal; | |
| 182 | − glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &mvDepthFinal); | |
| 183 | − glGetIntegerv(GL_PROJECTION_STACK_DEPTH, &prDepthFinal); | |
| 184 | − Q_ASSERT(mvDepth == mvDepthFinal); | |
| 185 | − Q_ASSERT(prDepth == prDepthFinal); | |
| 186 | − if (mvDepth != mvDepthFinal || prDepth != prDepthFinal) { | |
| 187 | − qFatal("Failed to preserve GL stack depth"); | |
| 188 | − } | |
| 189 | −} | |
| 190 | − | |
| 191 | 175 | using namespace std; |
| 192 | 176 | |
| 193 | 177 | // Starfield information |
| @@ -338,6 +322,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 144 unmodified lines | ||
| 338 | 322 | _previousScriptLocation("LastScriptLocation"), |
| 339 | 323 | _scriptsLocationHandle("scriptsLocation"), |
| 340 | 324 | _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES), |
| 325 | + _viewTransform(), | |
| 341 | 326 | _scaleMirror(1.0f), |
| 342 | 327 | _rotateMirror(0.0f), |
| 343 | 328 | _raiseMirror(0.0f), |
| @@ -361,7 +346,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 17 unmodified lines | ||
| 361 | 346 | _lastFaceTrackerUpdate(0), |
| 362 | 347 | _applicationOverlay() |
| 363 | 348 | { |
| 364 | − _offscreenContext = new OffscreenGlCanvas(); | |
| 365 | 349 | setInstance(this); |
| 366 | 350 | #ifdef Q_OS_WIN |
| 367 | 351 | installNativeEventFilter(&MyNativeEventFilter::getInstance()); |
| @@ -537,6 +521,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 169 unmodified lines | ||
| 537 | 521 | |
| 538 | 522 | ResourceCache::setRequestLimit(3); |
| 539 | 523 | |
| 524 | + _offscreenContext = new OffscreenGlCanvas(); | |
| 540 | 525 | _offscreenContext->create(); |
| 541 | 526 | _offscreenContext->makeCurrent(); |
| 542 | 527 | |
| @@ -566,16 +551,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 23 unmodified lines | ||
| 566 | 551 | // enable mouse tracking; otherwise, we only get drag events |
| 567 | 552 | container->setMouseTracking(true); |
| 568 | 553 | |
| 569 | − _menuBarHeight = Menu::getInstance()->height(); | |
| 570 | − | |
| 571 | −#if 0 | |
| 572 | − _fullscreenMenuWidget->setParent(_glWidget); | |
| 573 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen)) { | |
| 574 | − setFullscreen(true); // Initialize menu bar show/hide | |
| 575 | − } | |
| 576 | −#endif | |
| 577 | − | |
| 578 | − | |
| 579 | 554 | _toolWindow = new ToolWindow(); |
| 580 | 555 | _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint); |
| 581 | 556 | _toolWindow->setWindowTitle("Tools"); |
| @@ -901,13 +876,9 @@ void Application::initializeUi() { · 319 unmodified lines | ||
| 901 | 876 | } |
| 902 | 877 | |
| 903 | 878 | void Application::paintGL() { |
| 904 | − if (getCanvasSize() == uvec2(0)) { | |
| 905 | − return; | |
| 906 | − } | |
| 907 | 879 | PROFILE_RANGE(__FUNCTION__); |
| 908 | 880 | auto displayPlugin = getActiveDisplayPlugin(); |
| 909 | 881 | displayPlugin->preRender(); |
| 910 | − | |
| 911 | 882 | _offscreenContext->makeCurrent(); |
| 912 | 883 | |
| 913 | 884 | auto lodManager = DependencyManager::get<LODManager>(); |
| @@ -1649,19 +1620,6 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { · 735 unmodified lines | ||
| 1649 | 1620 | return; |
| 1650 | 1621 | } |
| 1651 | 1622 | |
| 1652 | −#if 0 | |
| 1653 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen)) { | |
| 1654 | − // Show/hide menu bar in fullscreen | |
| 1655 | − if (event->globalY() > _menuBarHeight) { | |
| 1656 | − _fullscreenMenuWidget->setFixedHeight(0); | |
| 1657 | − Menu::getInstance()->setFixedHeight(0); | |
| 1658 | − } else { | |
| 1659 | − _fullscreenMenuWidget->setFixedHeight(_menuBarHeight); | |
| 1660 | − Menu::getInstance()->setFixedHeight(_menuBarHeight); | |
| 1661 | − } | |
| 1662 | − } | |
| 1663 | −#endif | |
| 1664 | − | |
| 1665 | 1623 | _entities.mouseMoveEvent(event, deviceID); |
| 1666 | 1624 | |
| 1667 | 1625 | _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts |
| @@ -1977,94 +1935,6 @@ void Application::idle() { · 309 unmodified lines | ||
| 1977 | 1935 | lastIdleEnd = usecTimestampNow(); |
| 1978 | 1936 | } |
| 1979 | 1937 | |
| 1980 | −#if 0 | |
| 1981 | −void Application::setFullscreen(bool fullscreen) { | |
| 1982 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen) != fullscreen) { | |
| 1983 | − Menu::getInstance()->getActionForOption(MenuOption::Fullscreen)->setChecked(fullscreen); | |
| 1984 | − } | |
| 1985 | − | |
| 1986 | − // The following code block is useful on platforms that can have a visible | |
| 1987 | − // app menu in a fullscreen window. However the OSX mechanism hides the | |
| 1988 | − // application menu for fullscreen apps, so the check is not required. | |
| 1989 | −#ifndef Q_OS_MAC | |
| 1990 | − if (getActiveDisplayPlugin()->isHmd()) { | |
| 1991 | − if (fullscreen) { | |
| 1992 | − // Menu hide() disables menu commands, and show() after hide() doesn't work with Rift VR display. | |
| 1993 | − // So set height instead. | |
| 1994 | − _window->menuBar()->setMaximumHeight(0); | |
| 1995 | − } else { | |
| 1996 | − _window->menuBar()->setMaximumHeight(QWIDGETSIZE_MAX); | |
| 1997 | − } | |
| 1998 | − } else { | |
| 1999 | − if (fullscreen) { | |
| 2000 | − // Move menu to a QWidget floating above _glWidget so that show/hide doesn't adjust viewport. | |
| 2001 | − _menuBarHeight = Menu::getInstance()->height(); | |
| 2002 | − Menu::getInstance()->setParent(_fullscreenMenuWidget); | |
| 2003 | − Menu::getInstance()->setFixedWidth(_window->windowHandle()->screen()->size().width()); | |
| 2004 | − _fullscreenMenuWidget->show(); | |
| 2005 | − } else { | |
| 2006 | − // Restore menu to being part of MainWindow. | |
| 2007 | − _fullscreenMenuWidget->hide(); | |
| 2008 | − _window->setMenuBar(Menu::getInstance()); | |
| 2009 | − _window->menuBar()->setMaximumHeight(QWIDGETSIZE_MAX); | |
| 2010 | − } | |
| 2011 | − } | |
| 2012 | −#endif | |
| 2013 | − | |
| 2014 | − // Work around Qt bug that prevents floating menus being shown when in fullscreen mode. | |
| 2015 | − // https://bugreports.qt.io/browse/QTBUG-41883 | |
| 2016 | − // Known issue: Top-level menu items don't highlight when cursor hovers. This is probably a side-effect of the work-around. | |
| 2017 | − // TODO: Remove this work-around once the bug has been fixed and restore the following lines. | |
| 2018 | − //_window->setWindowState(fullscreen ? (_window->windowState() | Qt::WindowFullScreen) : | |
| 2019 | − // (_window->windowState() & ~Qt::WindowFullScreen)); | |
| 2020 | − _window->hide(); | |
| 2021 | − if (fullscreen) { | |
| 2022 | − _window->setWindowState(_window->windowState() | Qt::WindowFullScreen); | |
| 2023 | − // The next line produces the following warning in the log: | |
| 2024 | − // [WARNING][03 / 06 12:17 : 58] QWidget::setMinimumSize: (/ MainWindow) Negative sizes | |
| 2025 | − // (0, -1) are not possible | |
| 2026 | − // This is better than the alternative which is to have the window slightly less than fullscreen with a visible line | |
| 2027 | − // of pixels for the remainder of the screen. | |
| 2028 | − _window->setContentsMargins(0, 0, 0, -1); | |
| 2029 | − } else { | |
| 2030 | − _window->setWindowState(_window->windowState() & ~Qt::WindowFullScreen); | |
| 2031 | − _window->setContentsMargins(0, 0, 0, 0); | |
| 2032 | − } | |
| 2033 | − | |
| 2034 | − if (!_aboutToQuit) { | |
| 2035 | − _window->show(); | |
| 2036 | − } | |
| 2037 | −} | |
| 2038 | − | |
| 2039 | −void Application::setEnable3DTVMode(bool enable3DTVMode) { | |
| 2040 | − resizeGL(); | |
| 2041 | −} | |
| 2042 | − | |
| 2043 | −void Application::setEnableVRMode(bool enableVRMode) { | |
| 2044 | − if (Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode) != enableVRMode) { | |
| 2045 | − Menu::getInstance()->getActionForOption(MenuOption::EnableVRMode)->setChecked(enableVRMode); | |
| 2046 | − } | |
| 2047 | − | |
| 2048 | − if (enableVRMode) { | |
| 2049 | − if (!OculusManager::isConnected()) { | |
| 2050 | − // attempt to reconnect the Oculus manager - it's possible this was a workaround | |
| 2051 | − // for the sixense crash | |
| 2052 | − OculusManager::disconnect(); | |
| 2053 | − OculusManager::connect(_glWidget->context()->contextHandle()); | |
| 2054 | − _glWidget->setFocus(); | |
| 2055 | − _glWidget->makeCurrent(); | |
| 2056 | − glClear(GL_COLOR_BUFFER_BIT); | |
| 2057 | − } | |
| 2058 | − OculusManager::recalibrate(); | |
| 2059 | − } else { | |
| 2060 | − OculusManager::abandonCalibration(); | |
| 2061 | − OculusManager::disconnect(); | |
| 2062 | − } | |
| 2063 | − | |
| 2064 | − resizeGL(); | |
| 2065 | −} | |
| 2066 | −#endif | |
| 2067 | − | |
| 2068 | 1938 | void Application::setLowVelocityFilter(bool lowVelocityFilter) { |
| 2069 | 1939 | SixenseManager::getInstance().setLowVelocityFilter(lowVelocityFilter); |
| 2070 | 1940 | } |