From 5f355a14cdda016535863a8e75332ba097628517 Mon Sep 17 00:00:00 2001 From: Thomas Lowe Date: Mon, 29 Nov 2021 07:18:49 -0500 Subject: [PATCH] Changed default setting for anti-alias alpha test to true. Added checkbox in advanced page for anti-alias alpha test, connected to AA combobox in the graphics page. --- apps/launcher/advancedpage.cpp | 12 ++++++++++++ apps/launcher/advancedpage.hpp | 1 + apps/launcher/graphicspage.cpp | 3 +++ apps/launcher/graphicspage.hpp | 4 ++++ apps/launcher/maindialog.cpp | 2 +- files/settings-default.cfg | 2 +- files/ui/advancedpage.ui | 10 ++++++++++ 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index af1fa255db..c7e228878c 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -118,6 +118,11 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(bumpMapLocalLightingCheckBox, "apply lighting to environment maps", "Shaders"); loadSettingBool(radialFogCheckBox, "radial fog", "Shaders"); loadSettingBool(softParticlesCheckBox, "soft particles", "Shaders"); + loadSettingBool(antialiasAlphaTestCheckBox, "antialias alpha test", "Shaders"); + if (Settings::Manager::getInt("antialiasing", "Video") == 0) { + antialiasAlphaTestCheckBox->setCheckState(Qt::Unchecked); + antialiasAlphaTestCheckBox->setEnabled(false); + } loadSettingBool(magicItemAnimationsCheckBox, "use magic item animations", "Game"); connect(animSourcesCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotAnimSourcesToggled(bool))); loadSettingBool(animSourcesCheckBox, "use additional anim sources", "Game"); @@ -268,6 +273,7 @@ void Launcher::AdvancedPage::saveSettings() saveSettingBool(bumpMapLocalLightingCheckBox, "apply lighting to environment maps", "Shaders"); saveSettingBool(radialFogCheckBox, "radial fog", "Shaders"); saveSettingBool(softParticlesCheckBox, "soft particles", "Shaders"); + saveSettingBool(antialiasAlphaTestCheckBox, "antialias alpha test", "Shaders"); saveSettingBool(magicItemAnimationsCheckBox, "use magic item animations", "Game"); saveSettingBool(animSourcesCheckBox, "use additional anim sources", "Game"); saveSettingBool(weaponSheathingCheckBox, "weapon sheathing", "Game"); @@ -439,6 +445,12 @@ void Launcher::AdvancedPage::slotLoadedCellsChanged(QStringList cellNames) loadCellsForAutocomplete(cellNames); } +void Launcher::AdvancedPage::slotAASettingChanged(int aaLevel) { + antialiasAlphaTestCheckBox->setEnabled(aaLevel > 0); + if (aaLevel == 0) + antialiasAlphaTestCheckBox->setCheckState(Qt::Unchecked); +} + void Launcher::AdvancedPage::slotAnimSourcesToggled(bool checked) { weaponSheathingCheckBox->setEnabled(checked); diff --git a/apps/launcher/advancedpage.hpp b/apps/launcher/advancedpage.hpp index 1d16fae706..e26f1690e9 100644 --- a/apps/launcher/advancedpage.hpp +++ b/apps/launcher/advancedpage.hpp @@ -24,6 +24,7 @@ namespace Launcher public slots: void slotLoadedCellsChanged(QStringList cellNames); + void slotAASettingChanged(int aaLevel); private slots: void on_skipMenuCheckBox_stateChanged(int state); diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 8359834ddb..06cc98c741 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -47,7 +47,10 @@ Launcher::GraphicsPage::GraphicsPage(QWidget *parent) connect(screenComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(screenChanged(int))); connect(framerateLimitCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotFramerateLimitToggled(bool))); connect(shadowDistanceCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotShadowDistLimitToggled(bool))); +} +void Launcher::GraphicsPage::connectAntiAliasingChanged(const QObject* receiver, const char* slot) { + connect(antiAliasingComboBox, SIGNAL(currentIndexChanged(int)), receiver, slot); } bool Launcher::GraphicsPage::setupSDL() diff --git a/apps/launcher/graphicspage.hpp b/apps/launcher/graphicspage.hpp index a6754ccb04..9275bf8e3d 100644 --- a/apps/launcher/graphicspage.hpp +++ b/apps/launcher/graphicspage.hpp @@ -20,12 +20,16 @@ namespace Launcher public: explicit GraphicsPage(QWidget *parent = nullptr); + void connectAntiAliasingChanged(const QObject *receiver, const char *slot); void saveSettings(); bool loadSettings(); public slots: void screenChanged(int screen); + signals: + void signalAntiAliasingChanged(int aaValue); + private slots: void slotFullScreenChanged(int state); void slotStandardToggled(bool checked); diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 75d4464b68..d58be7afcf 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -146,7 +146,7 @@ void Launcher::MainDialog::createPages() connect(mDataFilesPage, SIGNAL(signalProfileChanged(int)), mPlayPage, SLOT(setProfilesIndex(int))); // Using Qt::QueuedConnection because signal is emitted in a subthread and slot is in the main thread connect(mDataFilesPage, SIGNAL(signalLoadedCellsChanged(QStringList)), mAdvancedPage, SLOT(slotLoadedCellsChanged(QStringList)), Qt::QueuedConnection); - + mGraphicsPage->connectAntiAliasingChanged(mAdvancedPage, SLOT(slotAASettingChanged(int))); } Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog() diff --git a/files/settings-default.cfg b/files/settings-default.cfg index c0083e4238..0e2c329ff2 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -492,7 +492,7 @@ minimum interior brightness = 0.08 # Convert the alpha test (cutout/punchthrough alpha) to alpha-to-coverage. # This allows MSAA to work with alpha-tested meshes, producing better-looking edges without pixelation. # When MSAA is off, this setting will have no visible effect, but might have a performance cost. -antialias alpha test = false +antialias alpha test = true # Soften intersection of blended particle systems with opaque geometry soft particles = false diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index 0e80f02700..0952e660d8 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -454,6 +454,16 @@ + + + + <html><head/><body><p>Enables alpha testing for smoother anti-aliasing (Requires anti-aliasing to be enabled)</p></body></html> + + + Use anti-alias alpha testing. + + +