From d3c1aa6653712c9bb82203820eeeb37913b81f3e Mon Sep 17 00:00:00 2001 From: Sam Hellawell Date: Tue, 21 May 2024 01:47:48 +0100 Subject: [PATCH 1/2] Fix incorrect texture filtering GUI for nearest, allow to disable nearest from GUI --- apps/openmw/mwgui/settingswindow.cpp | 48 +++++++++++++++++++--------- files/data/l10n/OMWEngine/de.yaml | 1 + files/data/l10n/OMWEngine/en.yaml | 1 + files/data/l10n/OMWEngine/fr.yaml | 1 + files/data/l10n/OMWEngine/ru.yaml | 1 + files/data/l10n/OMWEngine/sv.yaml | 1 + 6 files changed, 38 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 075a338592..bb266208bf 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -43,16 +43,22 @@ namespace { - std::string textureMipmappingToStr(const std::string& val) + std::string textureFilteringToStr(const std::string& mipFilter, const std::string& magFilter) { - if (val == "linear") - return "#{OMWEngine:TextureFilteringTrilinear}"; - if (val == "nearest") - return "#{OMWEngine:TextureFilteringBilinear}"; - if (val == "none") + if (mipFilter == "none") return "#{OMWEngine:TextureFilteringDisabled}"; - Log(Debug::Warning) << "Warning: Invalid texture mipmap option: " << val; + if (magFilter == "linear") + { + if (mipFilter == "linear") + return "#{OMWEngine:TextureFilteringTrilinear}"; + if (mipFilter == "nearest") + return "#{OMWEngine:TextureFilteringBilinear}"; + } + else if (magFilter == "nearest") + return "#{OMWEngine:TextureFilteringNearest}"; + + Log(Debug::Warning) << "Warning: Invalid texture filtering options: " << mipFilter << ", " << magFilter; return "#{OMWEngine:TextureFilteringOther}"; } @@ -365,8 +371,8 @@ namespace MWGui } highlightCurrentResolution(); - const std::string& tmip = Settings::general().mTextureMipmap; - mTextureFilteringButton->setCaptionWithReplacing(textureMipmappingToStr(tmip)); + mTextureFilteringButton->setCaptionWithReplacing( + textureFilteringToStr(Settings::general().mTextureMipmap, Settings::general().mTextureMinFilter)); int waterTextureSize = Settings::water().mRttSize; if (waterTextureSize >= 512) @@ -684,12 +690,24 @@ namespace MWGui void SettingsWindow::onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos) { - if (pos == 0) - Settings::general().mTextureMipmap.set("nearest"); - else if (pos == 1) - Settings::general().mTextureMipmap.set("linear"); - else - Log(Debug::Warning) << "Unexpected option pos " << pos; + auto& generalSettings = Settings::general(); + switch (pos) + { + case 0: // Bilinear with mips + generalSettings.mTextureMipmap.set("nearest"); + generalSettings.mTextureMagFilter.set("linear"); + generalSettings.mTextureMinFilter.set("linear"); + break; + case 1: // Trilinear with mips + generalSettings.mTextureMipmap.set("linear"); + generalSettings.mTextureMagFilter.set("linear"); + generalSettings.mTextureMinFilter.set("linear"); + break; + default: + Log(Debug::Warning) << "Unexpected texture filtering option pos " << pos; + break; + } + apply(); } diff --git a/files/data/l10n/OMWEngine/de.yaml b/files/data/l10n/OMWEngine/de.yaml index 3b583bfb21..4b905f3ae3 100644 --- a/files/data/l10n/OMWEngine/de.yaml +++ b/files/data/l10n/OMWEngine/de.yaml @@ -159,6 +159,7 @@ TestingExteriorCells: "Außenzellen testen" TestingInteriorCells: "Innenzellen testen" TextureFiltering: "Texturfilter" TextureFilteringBilinear: "Bilinear" +TextureFilteringNearest: "Nächster" TextureFilteringDisabled: "Keiner" TextureFilteringOther: "Sonstiges" TextureFilteringTrilinear: "Trilinear" diff --git a/files/data/l10n/OMWEngine/en.yaml b/files/data/l10n/OMWEngine/en.yaml index 37f9486083..b869f848af 100644 --- a/files/data/l10n/OMWEngine/en.yaml +++ b/files/data/l10n/OMWEngine/en.yaml @@ -159,6 +159,7 @@ TestingExteriorCells: "Testing Exterior Cells" TestingInteriorCells: "Testing Interior Cells" TextureFiltering: "Texture Filtering" TextureFilteringBilinear: "Bilinear" +TextureFilteringNearest: "Nearest" TextureFilteringDisabled: "None" TextureFilteringOther: "Other" TextureFilteringTrilinear: "Trilinear" diff --git a/files/data/l10n/OMWEngine/fr.yaml b/files/data/l10n/OMWEngine/fr.yaml index 814314ff5a..78c0b8b382 100644 --- a/files/data/l10n/OMWEngine/fr.yaml +++ b/files/data/l10n/OMWEngine/fr.yaml @@ -159,6 +159,7 @@ TestingExteriorCells: "Vérification des espaces (cells) extérieurs" TestingInteriorCells: "Vérification des espaces (cells) intérieurs" TextureFiltering: "Filtre appliqué aux textures" TextureFilteringBilinear: "Bilinéaire" +TextureFilteringNearest: "Plus proche voisin" TextureFilteringDisabled: "Aucun" TextureFilteringOther: "Autre" TextureFilteringTrilinear: "Trilinéaire" diff --git a/files/data/l10n/OMWEngine/ru.yaml b/files/data/l10n/OMWEngine/ru.yaml index 1edecbf8b0..264d74a18b 100644 --- a/files/data/l10n/OMWEngine/ru.yaml +++ b/files/data/l10n/OMWEngine/ru.yaml @@ -159,6 +159,7 @@ TestingExteriorCells: "Проверка наружных ячеек" TestingInteriorCells: "Проверка ячеек-помещений" TextureFiltering: "Фильтрация текстур" TextureFilteringBilinear: "Билинейная" +TextureFilteringNearest: "Ступенчатая" TextureFilteringDisabled: "Отключена" TextureFilteringOther: "Другая" TextureFilteringTrilinear: "Трилинейная" diff --git a/files/data/l10n/OMWEngine/sv.yaml b/files/data/l10n/OMWEngine/sv.yaml index 791efb660d..d26d3c194d 100644 --- a/files/data/l10n/OMWEngine/sv.yaml +++ b/files/data/l10n/OMWEngine/sv.yaml @@ -159,6 +159,7 @@ TestingExteriorCells: "Testar exteriöra celler" TestingInteriorCells: "Testar interiöra celler" TextureFiltering: "Texturfiltrering" TextureFilteringBilinear: "Bilinjär" +TextureFilteringNearest: "Närmaste" TextureFilteringDisabled: "Ingen" TextureFilteringOther: "Annan" TextureFilteringTrilinear: "Trilinjär" From a7991f99881638101e3bcf3d42b988c2efb628dd Mon Sep 17 00:00:00 2001 From: Sam Hellawell Date: Tue, 21 May 2024 23:49:28 +0100 Subject: [PATCH 2/2] Update german translation --- files/data/l10n/OMWEngine/de.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/data/l10n/OMWEngine/de.yaml b/files/data/l10n/OMWEngine/de.yaml index 4b905f3ae3..97a34be4e3 100644 --- a/files/data/l10n/OMWEngine/de.yaml +++ b/files/data/l10n/OMWEngine/de.yaml @@ -159,7 +159,7 @@ TestingExteriorCells: "Außenzellen testen" TestingInteriorCells: "Innenzellen testen" TextureFiltering: "Texturfilter" TextureFilteringBilinear: "Bilinear" -TextureFilteringNearest: "Nächster" +TextureFilteringNearest: "Nächstgelegen" TextureFilteringDisabled: "Keiner" TextureFilteringOther: "Sonstiges" TextureFilteringTrilinear: "Trilinear"