History

Working on cleaning up diff

Brad Davis committed 11 years ago

Commit 7f6bb551 parent ae882c84 files · +3 −167Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+3−133
@@ -121,7 +121,7 @@ · 120 unmodified lines
121121 #include "devices/RealSense.h"
122122 #include "devices/SDL2Manager.h"
123123 #include "devices/MIDIManager.h"
124−#include "RenderDeferredTask.h"
124+
125125 #include "scripting/AccountScriptingInterface.h"
126126 #include "scripting/AudioDeviceScriptingInterface.h"
127127 #include "scripting/ClipboardScriptingInterface.h"
@@ -172,22 +172,6 @@ public: · 44 unmodified lines
172172 };
173173
174174
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−
191175 using namespace std;
192176
193177 // Starfield information
@@ -338,6 +322,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 144 unmodified lines
338322 _previousScriptLocation("LastScriptLocation"),
339323 _scriptsLocationHandle("scriptsLocation"),
340324 _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
325+ _viewTransform(),
341326 _scaleMirror(1.0f),
342327 _rotateMirror(0.0f),
343328 _raiseMirror(0.0f),
@@ -361,7 +346,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 17 unmodified lines
361346 _lastFaceTrackerUpdate(0),
362347 _applicationOverlay()
363348 {
364− _offscreenContext = new OffscreenGlCanvas();
365349 setInstance(this);
366350 #ifdef Q_OS_WIN
367351 installNativeEventFilter(&MyNativeEventFilter::getInstance());
@@ -537,6 +521,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 169 unmodified lines
537521
538522 ResourceCache::setRequestLimit(3);
539523
524+ _offscreenContext = new OffscreenGlCanvas();
540525 _offscreenContext->create();
541526 _offscreenContext->makeCurrent();
542527
@@ -566,16 +551,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 23 unmodified lines
566551 // enable mouse tracking; otherwise, we only get drag events
567552 container->setMouseTracking(true);
568553
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−
579554 _toolWindow = new ToolWindow();
580555 _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
581556 _toolWindow->setWindowTitle("Tools");
@@ -901,13 +876,9 @@ void Application::initializeUi() { · 319 unmodified lines
901876 }
902877
903878 void Application::paintGL() {
904− if (getCanvasSize() == uvec2(0)) {
905− return;
906− }
907879 PROFILE_RANGE(__FUNCTION__);
908880 auto displayPlugin = getActiveDisplayPlugin();
909881 displayPlugin->preRender();
910−
911882 _offscreenContext->makeCurrent();
912883
913884 auto lodManager = DependencyManager::get<LODManager>();
@@ -1649,19 +1620,6 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { · 735 unmodified lines
16491620 return;
16501621 }
16511622
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−
16651623 _entities.mouseMoveEvent(event, deviceID);
16661624
16671625 _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts
@@ -1977,94 +1935,6 @@ void Application::idle() { · 309 unmodified lines
19771935 lastIdleEnd = usecTimestampNow();
19781936 }
19791937
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−
20681938 void Application::setLowVelocityFilter(bool lowVelocityFilter) {
20691939 SixenseManager::getInstance().setLowVelocityFilter(lowVelocityFilter);
20701940 }