From 6f84e4c9772627dbb1c511896f571977c8886d6f Mon Sep 17 00:00:00 2001 From: Nissim Hadar Date: Tue, 20 Feb 2018 23:45:07 -0800 Subject: [PATCH] Moved shadows and ambient occlusion to menu checkboxes. --- .../dialogs/GraphicsPreferencesDialog.qml | 19 ---------- .../hifi/tablet/TabletGraphicsPreferences.qml | 37 ------------------- interface/src/Menu.cpp | 14 +++++-- interface/src/Menu.h | 2 + .../src/DeferredLightingEffect.cpp | 2 +- 5 files changed, 13 insertions(+), 61 deletions(-) delete mode 100644 interface/resources/qml/hifi/dialogs/GraphicsPreferencesDialog.qml delete mode 100644 interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml diff --git a/interface/resources/qml/hifi/dialogs/GraphicsPreferencesDialog.qml b/interface/resources/qml/hifi/dialogs/GraphicsPreferencesDialog.qml deleted file mode 100644 index d95bafd0a9..0000000000 --- a/interface/resources/qml/hifi/dialogs/GraphicsPreferencesDialog.qml +++ /dev/null @@ -1,19 +0,0 @@ -import QtQuick 2.5 -import Qt.labs.settings 1.0 - -import "../../dialogs" - -PreferencesDialog { - id: root - objectName: "GraphicsPreferencesDialog" - title: "Graphics Settings" - showCategories: ["Graphics"] - property var settings: Settings { - category: root.objectName - property alias x: root.x - property alias y: root.y - property alias width: root.width - property alias height: root.height - } -} - diff --git a/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml deleted file mode 100644 index 25b5be05f2..0000000000 --- a/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml +++ /dev/null @@ -1,37 +0,0 @@ -// -// TabletGraphicsPreferences.qml -// -// Created by Vlad Stelmahovsky on 12 Mar 2017. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import QtQuick 2.5 -import QtQuick.Controls 1.4 -import "tabletWindows" -import "../../dialogs" - -StackView { - id: profileRoot - initialItem: root - objectName: "stack" - property string title: "Graphics Settings" - - signal sendToScript(var message); - - function pushSource(path) { - profileRoot.push(Qt.resolvedUrl(path)); - } - - function popSource() { - profileRoot.pop(); - } - - TabletPreferencesDialog { - id: root - objectName: "TabletGraphicsPreferences" - showCategories: ["Graphics"] - } -} diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index f3d8ea2344..051d5ce8ec 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -44,6 +44,7 @@ #include "ui/StandAloneJSConsole.h" #include "InterfaceLogging.h" #include "LocationBookmarks.h" +#include "DeferredLightingEffect.h" #if defined(Q_OS_MAC) || defined(Q_OS_WIN) #include "SpeechRecognizer.h" @@ -365,10 +366,15 @@ Menu::Menu() { MenuWrapper* developerMenu = addMenu("Developer", "Developer"); // Developer > Graphics... - action = addActionToQMenuAndActionHash(developerMenu, "Graphics..."); - connect(action, &QAction::triggered, [] { - qApp->showDialog(QString("hifi/dialogs/GraphicsPreferencesDialog.qml"), - QString("hifi/tablet/TabletGraphicsPreferences.qml"), "GraphicsPreferencesDialog"); + MenuWrapper* graphicsOptionsMenu = developerMenu->addMenu("Render"); + action = addCheckableActionToQMenuAndActionHash(graphicsOptionsMenu, MenuOption::Shadows, 0, true); + connect(action, &QAction::triggered, [action] { + DependencyManager::get()->setShadowMapEnabled(action->isChecked()); + }); + + action = addCheckableActionToQMenuAndActionHash(graphicsOptionsMenu, MenuOption::AmbientOcclusion, 0, false); + connect(action, &QAction::triggered, [action] { + DependencyManager::get()->setAmbientOcclusionEnabled(action->isChecked()); }); // Developer > UI >>> diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 8cb1804fd4..ec6fa42818 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -204,6 +204,8 @@ namespace MenuOption { const QString WorldAxes = "World Axes"; const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar"; const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar"; + const QString Shadows = "Shadows"; + const QString AmbientOcclusion = "AmbientOcclusion"; } #endif // hifi_Menu_h diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 665e767c7c..78bc3ba195 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -492,7 +492,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, batch.setResourceTexture(DEFERRED_BUFFER_DEPTH_UNIT, deferredFramebuffer->getPrimaryDepthTexture()); // FIXME: Different render modes should have different tasks - if (args->_renderMode == RenderArgs::DEFAULT_RENDER_MODE && deferredLightingEffect->isAmbientOcclusionEnabled()) { + if (args->_renderMode == RenderArgs::DEFAULT_RENDER_MODE && deferredLightingEffect->isAmbientOcclusionEnabled() && ambientOcclusionFramebuffer) { batch.setResourceTexture(DEFERRED_BUFFER_OBSCURANCE_UNIT, ambientOcclusionFramebuffer->getOcclusionTexture()); } else { // need to assign the white texture if ao is off