From 6568ad51f4421fe6689a3619c38108a6c9241aaf Mon Sep 17 00:00:00 2001 From: Jiaye Date: Mon, 30 Mar 2026 17:26:03 +0800 Subject: [PATCH] refactor(ibl): move DisableInInteriors to settings --- package/Shaders/Common/SharedData.hlsli | 3 ++- src/Features/IBL.cpp | 14 ++++++-------- src/Features/IBL.h | 4 +--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/package/Shaders/Common/SharedData.hlsli b/package/Shaders/Common/SharedData.hlsli index 4ea0d4d07c..ea8b8df909 100644 --- a/package/Shaders/Common/SharedData.hlsli +++ b/package/Shaders/Common/SharedData.hlsli @@ -197,7 +197,8 @@ namespace SharedData float SkyIBLSaturation; float FogAmount; uint DALCMode; // 0: Luminance Ratio, 1: Color Ratio, 2: DALC + Sky - float2 pad0; + uint DisableInInteriors; + float pad0; }; struct ExtendedTranslucencySettings diff --git a/src/Features/IBL.cpp b/src/Features/IBL.cpp index 29442fac96..00dd177ffc 100644 --- a/src/Features/IBL.cpp +++ b/src/Features/IBL.cpp @@ -20,7 +20,8 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( EnvIBLSaturation, SkyIBLSaturation, FogAmount, - DALCMode) + DALCMode, + DisableInInteriors) void IBL::DrawSettings() { @@ -76,7 +77,7 @@ void IBL::DrawSettings() if (auto _tt = Util::HoverTooltipWrapper()) { ImGui::Text("When Fog Mix is active, rescales the IBL-tinted fog to keep the original fog brightness.\nPrevents fog from becoming too bright or too dark."); } - ImGui::Checkbox("Disable in interiors", &disableInInteriors); + ImGui::Checkbox("Disable in interiors", (bool*)&settings.DisableInInteriors); if (auto _tt = Util::HoverTooltipWrapper()) { ImGui::Text("Disables IBL in interior cells."); } @@ -85,19 +86,16 @@ void IBL::DrawSettings() void IBL::LoadSettings(json& o_json) { settings = o_json; - disableInInteriors = o_json.value("DisableInInteriors", false); } void IBL::SaveSettings(json& o_json) { o_json = settings; - o_json["DisableInInteriors"] = disableInInteriors; } void IBL::RestoreDefaultSettings() { settings = {}; - disableInInteriors = false; } void IBL::RegisterWeatherVariables() @@ -173,7 +171,7 @@ void IBL::RegisterWeatherVariables() IBL::Settings IBL::GetCommonBufferData() const { Settings data = settings; - if (disableInInteriors && Util::IsInterior()) + if (settings.DisableInInteriors && Util::IsInterior()) data.EnableIBL = 0; return data; } @@ -183,7 +181,7 @@ void IBL::ReflectionsPrepass() if (loaded) { auto context = globals::d3d::context; - bool interiorDisabled = disableInInteriors && Util::IsInterior(); + bool interiorDisabled = settings.DisableInInteriors && Util::IsInterior(); // Set PS shader resource { @@ -200,7 +198,7 @@ void IBL::ReflectionsPrepass() void IBL::Prepass() { - if (disableInInteriors && Util::IsInterior()) + if (settings.DisableInInteriors && Util::IsInterior()) return; auto context = globals::d3d::context; diff --git a/src/Features/IBL.h b/src/Features/IBL.h index 24740ae8a8..3674668e81 100644 --- a/src/Features/IBL.h +++ b/src/Features/IBL.h @@ -41,8 +41,6 @@ struct IBL : Feature virtual void SetupResources() override; virtual void ClearShaderCache() override; - bool disableInInteriors = false; - struct Settings { uint EnableIBL = 0; @@ -55,7 +53,7 @@ struct IBL : Feature float SkyIBLSaturation = 1.0f; float FogAmount = 0.0f; uint DALCMode = 2; // 0: Luminance Ratio, 1: Color Ratio, 2: DALC + Sky - float pad0 = 0.0f; + uint DisableInInteriors = 1; float pad1 = 0.0f; } settings;