From 66fdfa40ad462a1b66366f0558dbdd01a1e83867 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 15:32:51 -0700 Subject: [PATCH 1/7] Hopefully implemented antialiasing setting. --- .../dialogs/graphics/GraphicsSettings.qml | 62 +++++++++++++++++++ interface/src/Menu.cpp | 4 +- .../scripting/RenderScriptingInterface.cpp | 50 +++++++++------ .../src/scripting/RenderScriptingInterface.h | 28 +++++---- .../render-utils/src/AntialiasingEffect.h | 3 +- 5 files changed, 112 insertions(+), 35 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index 6e345caaf7..2041bab9f8 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -358,6 +358,67 @@ Item { } } } + + ColumnLayout { + Layout.topMargin: 20 + Layout.preferredWidth: parent.width + spacing: 0 + + Item { + Layout.preferredWidth: parent.width + Layout.preferredHeight: 35 + + HifiStylesUit.RalewayRegular { + id: antialiasingHeader + text: "Anti-aliasing" + anchors.left: parent.left + anchors.top: parent.top + width: 130 + height: parent.height + size: 16 + color: "#FFFFFF" + } + + ListModel { + id: antialiasingModel + + ListElement { + text: "None" + } + ListElement { + text: "TAA" + } + ListElement { + text: "FXAA" + } + } + + HifiControlsUit.ComboBox { + id: antialiasingDropdown + anchors.left: antialiasingHeader.right + anchors.leftMargin: 20 + anchors.top: parent.top + width: 280 + height: parent.height + colorScheme: hifi.colorSchemes.dark + model: antialiasingModel + currentIndex: -1 + + function refreshAntialiasingDropdown() { + antialiasingDropdown.currentIndex = Render.antialiasingMode; + } + + Component.onCompleted: { + antialiasingDropdown.refreshAntialiasingDropdown(); + } + + onCurrentIndexChanged: { + Render.antialiasingMode = currentIndex; + antialiasingDropdown.displayText = model.get(currentIndex).text; + } + } + } + } } } @@ -365,5 +426,6 @@ Item { worldDetailDropdown.refreshWorldDetailDropdown(); renderingEffectsDropdown.refreshRenderingEffectsDropdownDisplay(); refreshRateDropdown.refreshRefreshRateDropdownDisplay(); + antialiasingDropdown.refreshAntialiasingDropdown(); } } diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 760a7b1127..0e0250501d 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -405,8 +405,8 @@ Menu::Menu() { // Developer > Render >>> MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, RenderScriptingInterface::getInstance()->getAntialiasingEnabled(), - RenderScriptingInterface::getInstance(), SLOT(setAntialiasingEnabled(bool))); + addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, RenderScriptingInterface::getInstance()->getAntialiasingMode(), + RenderScriptingInterface::getInstance(), SLOT(setAntialiasingMode(int))); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Shadows, 0, RenderScriptingInterface::getInstance()->getShadowsEnabled(), RenderScriptingInterface::getInstance(), SLOT(setShadowsEnabled(bool))); diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 56e9a93377..22598f690a 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -8,7 +8,6 @@ #include "RenderScriptingInterface.h" #include "LightingModel.h" -#include "AntialiasingEffect.h" RenderScriptingInterface* RenderScriptingInterface::getInstance() { @@ -29,13 +28,14 @@ void RenderScriptingInterface::loadSettings() { _renderMethod = (_renderMethodSetting.get()); _shadowsEnabled = (_shadowsEnabledSetting.get()); _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); - _antialiasingEnabled = (_antialiasingEnabledSetting.get()); + _antialiasingMode = (_antialiasingModeSetting.get()); _viewportResolutionScale = (_viewportResolutionScaleSetting.get()); }); forceRenderMethod((RenderMethod)_renderMethod); forceShadowsEnabled(_shadowsEnabled); forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); - forceAntialiasingEnabled(_antialiasingEnabled); + forceAntialiasingMode(_antialiasingMode); + forceAntialiasingMode(_antialiasingMode); forceViewportResolutionScale(_viewportResolutionScale); } @@ -121,33 +121,45 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { }); } -bool RenderScriptingInterface::getAntialiasingEnabled() const { - return _antialiasingEnabled; +AntialiasingConfig::Mode RenderScriptingInterface::getAntialiasingMode() const { + return _antialiasingMode; } -void RenderScriptingInterface::setAntialiasingEnabled(bool enabled) { - if (_antialiasingEnabled != enabled) { - forceAntialiasingEnabled(enabled); +void RenderScriptingInterface::setAntialiasingMode(AntialiasingConfig::Mode mode) { + if (_antialiasingMode != mode) { + forceAntialiasingMode(mode); emit settingsChanged(); } } -void RenderScriptingInterface::forceAntialiasingEnabled(bool enabled) { +void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mode) { _renderSettingLock.withWriteLock([&] { - _antialiasingEnabled = (enabled); - _antialiasingEnabledSetting.set(enabled); + _antialiasingMode = static_cast(mode); + _antialiasingModeSetting.set(mode); auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.JitterCam"); auto mainViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.Antialiasing"); if (mainViewJitterCamConfig && mainViewAntialiasingConfig) { - Menu::getInstance()->setIsOptionChecked(MenuOption::AntiAliasing, enabled); - if (enabled) { - mainViewJitterCamConfig->play(); - mainViewAntialiasingConfig->setDebugFXAA(false); - } - else { - mainViewJitterCamConfig->none(); - mainViewAntialiasingConfig->setDebugFXAA(true); + Menu::getInstance()->setIsOptionChecked(MenuOption::AntiAliasing, mode); + switch (mode) { + case AntialiasingConfig::Mode::NONE: + mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->setDebugFXAA(false); + break; + case AntialiasingConfig::TAA: + mainViewJitterCamConfig->play(); + mainViewAntialiasingConfig->setDebugFXAA(false); + break; + case AntialiasingConfig::Mode::FXAA: + mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->setDebugFXAA(true); + break; + default: + _antialiasingMode = AntialiasingConfig::Mode::NONE; + _antialiasingModeSetting.set(AntialiasingConfig::Mode::NONE); + mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->setDebugFXAA(false); + break; } } }); diff --git a/interface/src/scripting/RenderScriptingInterface.h b/interface/src/scripting/RenderScriptingInterface.h index 97b736259b..3c2b489a8e 100644 --- a/interface/src/scripting/RenderScriptingInterface.h +++ b/interface/src/scripting/RenderScriptingInterface.h @@ -13,6 +13,8 @@ #include "Application.h" #include "RenderForward.h" +#include "AntialiasingEffect.h" + /*@jsdoc * The Render API enables you to configure the graphics engine. @@ -27,7 +29,7 @@ * @property {boolean} shadowsEnabled - true if shadows are enabled, false if they're disabled. * @property {boolean} ambientOcclusionEnabled - true if ambient occlusion is enabled, false if it's * disabled. - * @property {boolean} antialiasingEnabled - true if anti-aliasing is enabled, false if it's disabled. + * @property {integer} antialiasingMode - The active anti-aliasing mode. * @property {number} viewportResolutionScale - The view port resolution scale, > 0.0. */ class RenderScriptingInterface : public QObject { @@ -35,7 +37,7 @@ class RenderScriptingInterface : public QObject { Q_PROPERTY(RenderMethod renderMethod READ getRenderMethod WRITE setRenderMethod NOTIFY settingsChanged) Q_PROPERTY(bool shadowsEnabled READ getShadowsEnabled WRITE setShadowsEnabled NOTIFY settingsChanged) Q_PROPERTY(bool ambientOcclusionEnabled READ getAmbientOcclusionEnabled WRITE setAmbientOcclusionEnabled NOTIFY settingsChanged) - Q_PROPERTY(bool antialiasingEnabled READ getAntialiasingEnabled WRITE setAntialiasingEnabled NOTIFY settingsChanged) + Q_PROPERTY(AntialiasingConfig::Mode antialiasingMode READ getAntialiasingMode WRITE setAntialiasingMode NOTIFY settingsChanged) Q_PROPERTY(float viewportResolutionScale READ getViewportResolutionScale WRITE setViewportResolutionScale NOTIFY settingsChanged) public: @@ -143,18 +145,18 @@ public slots: void setAmbientOcclusionEnabled(bool enabled); /*@jsdoc - * Gets whether or not anti-aliasing is enabled. - * @function Render.getAntialiasingEnabled - * @returns {boolean} true if anti-aliasing is enabled, false if it's disabled. + * Gets the active anti-aliasing mode. + * @function Render.getAntialiasingMode + * @returns {integer} the active anti-aliasing mode. */ - bool getAntialiasingEnabled() const; + AntialiasingConfig::Mode getAntialiasingMode() const; /*@jsdoc - * Sets whether or not anti-aliasing is enabled. - * @function Render.setAntialiasingEnabled - * @param {boolean} enabled - true to enable anti-aliasing, false to disable. + * Sets the active anti-aliasing mode. + * @function Render.setAntialiasingMode + * @param {integer} the active anti-aliasing mode. */ - void setAntialiasingEnabled(bool enabled); + void setAntialiasingMode(AntialiasingConfig::Mode mode); /*@jsdoc * Gets the view port resolution scale. @@ -192,21 +194,21 @@ private: int _renderMethod{ RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; bool _shadowsEnabled{ true }; bool _ambientOcclusionEnabled{ false }; - bool _antialiasingEnabled{ true }; + AntialiasingConfig::Mode _antialiasingMode; float _viewportResolutionScale{ 1.0f }; // Actual settings saved on disk Setting::Handle _renderMethodSetting { "renderMethod", RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; Setting::Handle _shadowsEnabledSetting { "shadowsEnabled", true }; Setting::Handle _ambientOcclusionEnabledSetting { "ambientOcclusionEnabled", false }; - Setting::Handle _antialiasingEnabledSetting { "antialiasingEnabled", true }; + Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; Setting::Handle _viewportResolutionScaleSetting { "viewportResolutionScale", 1.0f }; // Force assign both setting AND runtime value to the parameter value void forceRenderMethod(RenderMethod renderMethod); void forceShadowsEnabled(bool enabled); void forceAmbientOcclusionEnabled(bool enabled); - void forceAntialiasingEnabled(bool enabled); + void forceAntialiasingMode(AntialiasingConfig::Mode mode); void forceViewportResolutionScale(float scale); static std::once_flag registry_flag; diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index fc25343751..2e838764b4 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -110,7 +110,7 @@ public: AntialiasingConfig() : render::Job::Config(true) {} enum Mode { - OFF = 0, + NONE = 0, TAA, FXAA, MODE_COUNT @@ -144,6 +144,7 @@ public: signals: void dirty(); }; +Q_DECLARE_METATYPE(AntialiasingConfig::Mode); #define SET_BIT(bitfield, bitIndex, value) bitfield = ((bitfield) & ~(1 << (bitIndex))) | ((value) << (bitIndex)) #define GET_BIT(bitfield, bitIndex) ((bitfield) & (1 << (bitIndex))) From 8386f2eb61d8a033c7f09c5fec501eb843808cfa Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 19:19:20 -0700 Subject: [PATCH 2/7] Clumsy fix for enum storage. --- interface/src/Menu.cpp | 3 --- interface/src/Menu.h | 4 +++- interface/src/scripting/RenderScriptingInterface.cpp | 11 +++++------ interface/src/scripting/RenderScriptingInterface.h | 5 +++-- libraries/render-utils/src/AntialiasingEffect.h | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 0e0250501d..72504c5571 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -405,9 +405,6 @@ Menu::Menu() { // Developer > Render >>> MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, RenderScriptingInterface::getInstance()->getAntialiasingMode(), - RenderScriptingInterface::getInstance(), SLOT(setAntialiasingMode(int))); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Shadows, 0, RenderScriptingInterface::getInstance()->getShadowsEnabled(), RenderScriptingInterface::getInstance(), SLOT(setShadowsEnabled(bool))); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 5cd4c2112e..eecfd3af56 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -224,7 +224,9 @@ namespace MenuOption { const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar"; const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar"; const QString Shadows = "Shadows"; - const QString AntiAliasing = "Temporal Antialiasing (FXAA if disabled)"; + const QString AntiAliasingNONE = "Antialiasing Disabled"; + const QString AntiAliasingTAA = "Temporal Anti-aliasing"; + const QString AntiAliasingFXAA = "Fast Approximate Anti-aliasing"; const QString AmbientOcclusion = "Ambient Occlusion"; const QString NotificationSounds = "play_notification_sounds"; const QString NotificationSoundsSnapshot = "play_notification_sounds_snapshot"; diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 22598f690a..3b356913d9 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -28,14 +28,14 @@ void RenderScriptingInterface::loadSettings() { _renderMethod = (_renderMethodSetting.get()); _shadowsEnabled = (_shadowsEnabledSetting.get()); _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); - _antialiasingMode = (_antialiasingModeSetting.get()); + //_antialiasingMode = (_antialiasingModeSetting.get()); + _antialiasingMode = static_cast(_antialiasingModeSetting.get()); _viewportResolutionScale = (_viewportResolutionScaleSetting.get()); }); forceRenderMethod((RenderMethod)_renderMethod); forceShadowsEnabled(_shadowsEnabled); forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); forceAntialiasingMode(_antialiasingMode); - forceAntialiasingMode(_antialiasingMode); forceViewportResolutionScale(_viewportResolutionScale); } @@ -134,13 +134,11 @@ void RenderScriptingInterface::setAntialiasingMode(AntialiasingConfig::Mode mode void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mode) { _renderSettingLock.withWriteLock([&] { - _antialiasingMode = static_cast(mode); - _antialiasingModeSetting.set(mode); + _antialiasingMode = mode; auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.JitterCam"); auto mainViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.Antialiasing"); if (mainViewJitterCamConfig && mainViewAntialiasingConfig) { - Menu::getInstance()->setIsOptionChecked(MenuOption::AntiAliasing, mode); switch (mode) { case AntialiasingConfig::Mode::NONE: mainViewJitterCamConfig->none(); @@ -156,12 +154,13 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo break; default: _antialiasingMode = AntialiasingConfig::Mode::NONE; - _antialiasingModeSetting.set(AntialiasingConfig::Mode::NONE); mainViewJitterCamConfig->none(); mainViewAntialiasingConfig->setDebugFXAA(false); break; } } + + _antialiasingModeSetting.set(_antialiasingMode); }); } diff --git a/interface/src/scripting/RenderScriptingInterface.h b/interface/src/scripting/RenderScriptingInterface.h index 3c2b489a8e..88262b14c1 100644 --- a/interface/src/scripting/RenderScriptingInterface.h +++ b/interface/src/scripting/RenderScriptingInterface.h @@ -194,14 +194,15 @@ private: int _renderMethod{ RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; bool _shadowsEnabled{ true }; bool _ambientOcclusionEnabled{ false }; - AntialiasingConfig::Mode _antialiasingMode; + AntialiasingConfig::Mode _antialiasingMode{ AntialiasingConfig::Mode::TAA }; float _viewportResolutionScale{ 1.0f }; // Actual settings saved on disk Setting::Handle _renderMethodSetting { "renderMethod", RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; Setting::Handle _shadowsEnabledSetting { "shadowsEnabled", true }; Setting::Handle _ambientOcclusionEnabledSetting { "ambientOcclusionEnabled", false }; - Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; + //Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; + Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; Setting::Handle _viewportResolutionScaleSetting { "viewportResolutionScale", 1.0f }; // Force assign both setting AND runtime value to the parameter value diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index 2e838764b4..453c4ce992 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -115,6 +115,7 @@ public: FXAA, MODE_COUNT }; + Q_ENUM(Mode) // Stored as signed int. void setAAMode(int mode); int getAAMode() const { return _mode; } @@ -122,7 +123,7 @@ public: void setDebugFXAA(bool debug) { debugFXAAX = (debug ? 0.0f : 1.0f); emit dirty();} bool debugFXAA() const { return (debugFXAAX == 0.0f ? true : false); } - int _mode{ TAA }; + int _mode{ TAA }; // '_' prefix but not private? float blend{ 0.25f }; float sharpen{ 0.05f }; @@ -144,7 +145,6 @@ public: signals: void dirty(); }; -Q_DECLARE_METATYPE(AntialiasingConfig::Mode); #define SET_BIT(bitfield, bitIndex, value) bitfield = ((bitfield) & ~(1 << (bitIndex))) | ((value) << (bitIndex)) #define GET_BIT(bitfield, bitIndex) ((bitfield) & (1 << (bitIndex))) From e7d5a005b838d8fe0ca51fbfcbe4c58d7d1aa686 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 19:24:00 -0700 Subject: [PATCH 3/7] Forgot to remove these. --- interface/src/Menu.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/interface/src/Menu.h b/interface/src/Menu.h index eecfd3af56..c42345894c 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -224,9 +224,6 @@ namespace MenuOption { const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar"; const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar"; const QString Shadows = "Shadows"; - const QString AntiAliasingNONE = "Antialiasing Disabled"; - const QString AntiAliasingTAA = "Temporal Anti-aliasing"; - const QString AntiAliasingFXAA = "Fast Approximate Anti-aliasing"; const QString AmbientOcclusion = "Ambient Occlusion"; const QString NotificationSounds = "play_notification_sounds"; const QString NotificationSoundsSnapshot = "play_notification_sounds_snapshot"; From 3c85964c5d2693e6432383e6be9c555c1028ae06 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 13:25:31 -0700 Subject: [PATCH 4/7] Hopefully works. --- interface/src/scripting/RenderScriptingInterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 3b356913d9..741fafd0a9 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -142,6 +142,7 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo switch (mode) { case AntialiasingConfig::Mode::NONE: mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->blend = 1; mainViewAntialiasingConfig->setDebugFXAA(false); break; case AntialiasingConfig::TAA: From fc1a0d6a4cb203c7c71feb7144c7d60b046efc17 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 13:35:24 -0700 Subject: [PATCH 5/7] Apparently it worked. --- interface/src/scripting/RenderScriptingInterface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 741fafd0a9..58738d0929 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -147,15 +147,18 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo break; case AntialiasingConfig::TAA: mainViewJitterCamConfig->play(); + mainViewAntialiasingConfig->blend = 0.25; mainViewAntialiasingConfig->setDebugFXAA(false); break; case AntialiasingConfig::Mode::FXAA: mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->blend = 0.25; mainViewAntialiasingConfig->setDebugFXAA(true); break; default: _antialiasingMode = AntialiasingConfig::Mode::NONE; mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->blend = 1; mainViewAntialiasingConfig->setDebugFXAA(false); break; } From e6a41e85b234dd3f2927c08642c34750a9d48a98 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 13:40:36 -0700 Subject: [PATCH 6/7] Added comments. Referenced all enums explicitly. --- .../qml/hifi/dialogs/graphics/GraphicsSettings.qml | 5 +++-- interface/src/scripting/RenderScriptingInterface.cpp | 2 +- libraries/render-utils/src/AntialiasingEffect.cpp | 2 +- libraries/render-utils/src/AntialiasingEffect.h | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index 2041bab9f8..6ebb0099ca 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -378,10 +378,11 @@ Item { size: 16 color: "#FFFFFF" } - + ListModel { id: antialiasingModel - + + // Maintain same order as "AntialiasingConfig::Mode". ListElement { text: "None" } diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 58738d0929..5ecb1a6e43 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -145,7 +145,7 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo mainViewAntialiasingConfig->blend = 1; mainViewAntialiasingConfig->setDebugFXAA(false); break; - case AntialiasingConfig::TAA: + case AntialiasingConfig::Mode::TAA: mainViewJitterCamConfig->play(); mainViewAntialiasingConfig->blend = 0.25; mainViewAntialiasingConfig->setDebugFXAA(false); diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index c9da8373db..9083aa0c2e 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -140,7 +140,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const #else void AntialiasingConfig::setAAMode(int mode) { - _mode = std::min((int)AntialiasingConfig::MODE_COUNT, std::max(0, mode)); + _mode = std::min((int)AntialiasingConfig::MODE_COUNT, std::max(0, mode)); // Just use unsigned? emit dirty(); } diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index 453c4ce992..dc81132cca 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -217,10 +217,10 @@ private: }; -#else -class AntiAliasingConfig : public render::Job::Config { +#else // User setting for antialias mode will probably be broken. +class AntiAliasingConfig : public render::Job::Config { // Not to be confused with AntialiasingConfig... Q_OBJECT - Q_PROPERTY(bool enabled MEMBER enabled) + Q_PROPERTY(bool enabled MEMBER enabled) // Not sure if still useful. public: AntiAliasingConfig() : render::Job::Config(true) {} }; @@ -237,7 +237,7 @@ public: const gpu::PipelinePointer& getAntialiasingPipeline(); const gpu::PipelinePointer& getBlendPipeline(); - + private: gpu::FramebufferPointer _antialiasingBuffer; From 44fb53d4f26dc956500560bde30501f3cfd1bfc7 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 30 Oct 2021 10:43:10 -0700 Subject: [PATCH 7/7] Removed comment. --- libraries/render-utils/src/AntialiasingEffect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index dc81132cca..ddb243f064 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -220,7 +220,7 @@ private: #else // User setting for antialias mode will probably be broken. class AntiAliasingConfig : public render::Job::Config { // Not to be confused with AntialiasingConfig... Q_OBJECT - Q_PROPERTY(bool enabled MEMBER enabled) // Not sure if still useful. + Q_PROPERTY(bool enabled MEMBER enabled) public: AntiAliasingConfig() : render::Job::Config(true) {} };