From 18cd4c558b8c6b5f47e53d4fca7aa4c11cd61e66 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 4 Jul 2024 12:48:58 +0200 Subject: [PATCH 1/9] refactor: make feature->Draw optional --- src/Feature.h | 2 +- src/Features/CloudShadows.cpp | 4 ---- src/Features/CloudShadows.h | 2 -- src/Features/DynamicCubemaps.cpp | 4 ---- src/Features/DynamicCubemaps.h | 2 -- src/Features/ExtendedMaterials.h | 2 -- src/Features/GrassCollision.h | 1 - src/Features/GrassLighting.h | 2 -- src/Features/LightLimitFix.cpp | 4 ---- src/Features/LightLimitFix.h | 1 - src/Features/ScreenSpaceGI.h | 2 -- src/Features/ScreenSpaceShadows.h | 2 -- src/Features/Skylighting.cpp | 4 ---- src/Features/Skylighting.h | 2 -- src/Features/SubsurfaceScattering.h | 2 +- src/Features/TerrainBlending.cpp | 4 ---- src/Features/TerrainBlending.h | 2 -- src/Features/TerrainOcclusion.h | 2 -- src/Features/WaterCaustics.h | 2 -- src/Features/WaterParallax.h | 2 +- src/Features/WetnessEffects.cpp | 4 ---- src/Features/WetnessEffects.h | 2 -- 22 files changed, 3 insertions(+), 51 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index 894e729fe..7eca80363 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -22,7 +22,7 @@ struct Feature virtual void Reset() = 0; virtual void DrawSettings() = 0; - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) = 0; + virtual void Draw(const RE::BSShader*, const uint32_t) {} virtual void DrawDeferred() {} virtual void DrawPreProcess() {} virtual void Prepass() {} diff --git a/src/Features/CloudShadows.cpp b/src/Features/CloudShadows.cpp index aef7772ad..4e691eb7b 100644 --- a/src/Features/CloudShadows.cpp +++ b/src/Features/CloudShadows.cpp @@ -96,10 +96,6 @@ void CloudShadows::Prepass() context->PSSetShaderResources(27, 1, &srv); } -void CloudShadows::Draw(const RE::BSShader*, const uint32_t) -{ -} - void CloudShadows::Load(json& o_json) { Feature::Load(o_json); diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index cab672fe0..c9db89fc7 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -35,8 +35,6 @@ struct CloudShadows : Feature virtual void Prepass() override; - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; - virtual void Load(json& o_json) override; virtual void Save(json& o_json) override; diff --git a/src/Features/DynamicCubemaps.cpp b/src/Features/DynamicCubemaps.cpp index bb26c5d5e..e5987cb89 100644 --- a/src/Features/DynamicCubemaps.cpp +++ b/src/Features/DynamicCubemaps.cpp @@ -414,10 +414,6 @@ void DynamicCubemaps::Prepass() { } -void DynamicCubemaps::Draw(const RE::BSShader*, const uint32_t) -{ -} - void DynamicCubemaps::SetupResources() { GetComputeShaderUpdate(); diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 044657fb8..50dcd6922 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -100,8 +100,6 @@ struct DynamicCubemaps : Feature virtual void DrawSettings(); virtual void DataLoaded() override; - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); - virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/ExtendedMaterials.h b/src/Features/ExtendedMaterials.h index 64af630a9..ced51069b 100644 --- a/src/Features/ExtendedMaterials.h +++ b/src/Features/ExtendedMaterials.h @@ -35,8 +35,6 @@ struct ExtendedMaterials : Feature virtual void DrawSettings(); - virtual void Draw(const RE::BSShader*, const uint32_t){}; - virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/GrassCollision.h b/src/Features/GrassCollision.h index 6422762cf..b7a1a527e 100644 --- a/src/Features/GrassCollision.h +++ b/src/Features/GrassCollision.h @@ -52,7 +52,6 @@ struct GrassCollision : Feature virtual void DrawSettings(); void UpdateCollisions(PerFrame& perFrame); void Update(); - virtual void Draw(const RE::BSShader*, const uint32_t){}; virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index 0a1ae2b7d..8a226a410 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -30,8 +30,6 @@ struct GrassLighting : Feature virtual void DrawSettings(); virtual void Reset(){}; - virtual void Draw(const RE::BSShader*, const uint32_t){}; - virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/LightLimitFix.cpp b/src/Features/LightLimitFix.cpp index 32fe4d92e..61caf5182 100644 --- a/src/Features/LightLimitFix.cpp +++ b/src/Features/LightLimitFix.cpp @@ -557,10 +557,6 @@ bool LightLimitFix::AddParticleLight(RE::BSRenderPass* a_pass, LightLimitFix::Co return true; } -void LightLimitFix::Draw(const RE::BSShader*, const uint32_t) -{ -} - void LightLimitFix::PostPostLoad() { ParticleLights::GetSingleton()->GetConfigs(); diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index ff516371d..bc6740d70 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -136,7 +136,6 @@ struct LightLimitFix : Feature virtual void RestoreDefaultSettings(); virtual void DrawSettings(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); virtual void PostPostLoad() override; virtual void DataLoaded() override; diff --git a/src/Features/ScreenSpaceGI.h b/src/Features/ScreenSpaceGI.h index 1ad8ef32c..e7bf442fd 100644 --- a/src/Features/ScreenSpaceGI.h +++ b/src/Features/ScreenSpaceGI.h @@ -35,8 +35,6 @@ struct ScreenSpaceGI : Feature void CompileComputeShaders(); bool ShadersOK(); - virtual inline void Draw(const RE::BSShader*, const uint32_t) override{}; - void DrawSSGI(Texture2D* srcPrevAmbient); void UpdateSB(); diff --git a/src/Features/ScreenSpaceShadows.h b/src/Features/ScreenSpaceShadows.h index 7ddbbdeda..201e5e776 100644 --- a/src/Features/ScreenSpaceShadows.h +++ b/src/Features/ScreenSpaceShadows.h @@ -63,8 +63,6 @@ struct ScreenSpaceShadows : Feature ID3D11ComputeShader* GetComputeRaymarch(); ID3D11ComputeShader* GetComputeRaymarchRight(); - virtual void Draw(const RE::BSShader*, const uint32_t){}; - virtual void Prepass() override; virtual void Load(json& o_json); diff --git a/src/Features/Skylighting.cpp b/src/Features/Skylighting.cpp index 8056d2d8b..0a62164c5 100644 --- a/src/Features/Skylighting.cpp +++ b/src/Features/Skylighting.cpp @@ -18,10 +18,6 @@ void Skylighting::DrawSettings() ImGui::Checkbox("Render Trees", &settings.RenderTrees); } -void Skylighting::Draw(const RE::BSShader*, const uint32_t) -{ -} - void Skylighting::SetupResources() { GetSkylightingCS(); diff --git a/src/Features/Skylighting.h b/src/Features/Skylighting.h index ebca08abf..ef430ba48 100644 --- a/src/Features/Skylighting.h +++ b/src/Features/Skylighting.h @@ -26,8 +26,6 @@ struct Skylighting : Feature virtual void DrawSettings(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); - virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/SubsurfaceScattering.h b/src/Features/SubsurfaceScattering.h index f9c2a978c..144c42aea 100644 --- a/src/Features/SubsurfaceScattering.h +++ b/src/Features/SubsurfaceScattering.h @@ -83,7 +83,7 @@ struct SubsurfaceScattering : Feature void DrawSSS(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); + virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/TerrainBlending.cpp b/src/Features/TerrainBlending.cpp index 04b754d49..767517e17 100644 --- a/src/Features/TerrainBlending.cpp +++ b/src/Features/TerrainBlending.cpp @@ -7,10 +7,6 @@ void TerrainBlending::DrawSettings() { } -void TerrainBlending::Draw(const RE::BSShader*, const uint32_t) -{ -} - ID3D11VertexShader* TerrainBlending::GetTerrainVertexShader() { if (!terrainVertexShader) { diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index fb2b494fb..0e9b2e094 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -23,8 +23,6 @@ struct TerrainBlending : Feature virtual void DrawSettings(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); - ID3D11VertexShader* GetTerrainVertexShader(); ID3D11VertexShader* GetTerrainOffsetVertexShader(); diff --git a/src/Features/TerrainOcclusion.h b/src/Features/TerrainOcclusion.h index afbdfe98a..786bb3bc7 100644 --- a/src/Features/TerrainOcclusion.h +++ b/src/Features/TerrainOcclusion.h @@ -116,8 +116,6 @@ struct TerrainOcclusion : public Feature virtual inline void Reset() override{}; - virtual void Draw(const RE::BSShader*, const uint32_t) override{}; - virtual void Prepass() override; void LoadHeightmap(); void Precompute(); diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index 3aabc66dd..66661378d 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -24,8 +24,6 @@ struct WaterCaustics : Feature virtual void DrawSettings(); - virtual void Draw(const RE::BSShader*, const uint32_t){}; - virtual void Prepass() override; virtual void Load(json& o_json); diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index 772e3d9c2..9f2a008a9 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -22,7 +22,7 @@ struct WaterParallax : Feature virtual void DrawSettings(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); + virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/WetnessEffects.cpp b/src/Features/WetnessEffects.cpp index 1754a16f9..c32325474 100644 --- a/src/Features/WetnessEffects.cpp +++ b/src/Features/WetnessEffects.cpp @@ -245,10 +245,6 @@ void WetnessEffects::CalculateWetness(RE::TESWeather* weather, RE::Sky* sky, flo weatherPuddleDepth = puddleDepthDelta > 0 ? std::min(weatherPuddleDepth + puddleDepthDelta, MAX_PUDDLE_DEPTH) : std::max(weatherPuddleDepth + puddleDepthDelta, 0.0f); } -void WetnessEffects::Draw(const RE::BSShader*, const uint32_t) -{ -} - WetnessEffects::PerFrame WetnessEffects::GetCommonBufferData() { PerFrame data{}; diff --git a/src/Features/WetnessEffects.h b/src/Features/WetnessEffects.h index 12e58576f..66f0ba5cb 100644 --- a/src/Features/WetnessEffects.h +++ b/src/Features/WetnessEffects.h @@ -82,8 +82,6 @@ struct WetnessEffects : Feature virtual void DrawSettings(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); - virtual void Load(json& o_json); virtual void Save(json& o_json); From c85a6d1ced907b6dd5952dffdaf99392dfa2df63 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 4 Jul 2024 12:49:41 +0200 Subject: [PATCH 2/9] refactor: make feature->Reset optional --- src/Feature.h | 2 +- src/Features/CloudShadows.h | 2 -- src/Features/DynamicCubemaps.h | 2 +- src/Features/ExtendedMaterials.h | 1 - src/Features/GrassCollision.h | 2 +- src/Features/GrassLighting.h | 1 - src/Features/LightLimitFix.h | 2 +- src/Features/ScreenSpaceGI.h | 1 - src/Features/ScreenSpaceShadows.h | 1 - src/Features/Skylighting.cpp | 4 ---- src/Features/Skylighting.h | 1 - src/Features/SubsurfaceScattering.h | 2 +- src/Features/TerrainBlending.cpp | 4 ---- src/Features/TerrainBlending.h | 1 - src/Features/TerrainOcclusion.h | 2 -- src/Features/WaterCaustics.h | 1 - src/Features/WaterParallax.h | 1 - src/Features/WetnessEffects.h | 2 +- 18 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index 7eca80363..bbe0bae46 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -19,7 +19,7 @@ struct Feature virtual bool SupportsVR() { return false; } virtual void SetupResources() = 0; - virtual void Reset() = 0; + virtual void Reset() {} virtual void DrawSettings() = 0; virtual void Draw(const RE::BSShader*, const uint32_t) {} diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index c9db89fc7..cbc706383 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -26,8 +26,6 @@ struct CloudShadows : Feature virtual void SetupResources() override; - virtual inline void Reset() override {} - virtual void DrawSettings() override; void CheckResourcesSide(int side); diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 50dcd6922..71e4284c2 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -95,7 +95,7 @@ struct DynamicCubemaps : Feature bool HasShaderDefine(RE::BSShader::Type) override { return true; }; virtual void SetupResources(); - virtual void Reset(); + virtual void Reset() override; virtual void DrawSettings(); virtual void DataLoaded() override; diff --git a/src/Features/ExtendedMaterials.h b/src/Features/ExtendedMaterials.h index ced51069b..417242486 100644 --- a/src/Features/ExtendedMaterials.h +++ b/src/Features/ExtendedMaterials.h @@ -29,7 +29,6 @@ struct ExtendedMaterials : Feature Settings settings; virtual void SetupResources(){}; - virtual inline void Reset() {} virtual void DataLoaded() override; diff --git a/src/Features/GrassCollision.h b/src/Features/GrassCollision.h index b7a1a527e..44ae6e1c5 100644 --- a/src/Features/GrassCollision.h +++ b/src/Features/GrassCollision.h @@ -47,7 +47,7 @@ struct GrassCollision : Feature int eyeCount = !REL::Module::IsVR() ? 1 : 2; virtual void SetupResources(); - virtual void Reset(); + virtual void Reset() override; virtual void DrawSettings(); void UpdateCollisions(PerFrame& perFrame); diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index 8a226a410..d005edf50 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -28,7 +28,6 @@ struct GrassLighting : Feature virtual void SetupResources(){}; virtual void DrawSettings(); - virtual void Reset(){}; virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index bc6740d70..335da13c0 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -128,7 +128,7 @@ struct LightLimitFix : Feature Matrix viewMatrixInverseCached[2]{}; virtual void SetupResources(); - virtual void Reset(); + virtual void Reset() override; virtual void Load(json& o_json); virtual void Save(json& o_json); diff --git a/src/Features/ScreenSpaceGI.h b/src/Features/ScreenSpaceGI.h index e7bf442fd..9581621f5 100644 --- a/src/Features/ScreenSpaceGI.h +++ b/src/Features/ScreenSpaceGI.h @@ -29,7 +29,6 @@ struct ScreenSpaceGI : Feature virtual void Load(json& o_json) override; virtual void Save(json& o_json) override; - virtual inline void Reset() override{}; virtual void SetupResources() override; virtual void ClearShaderCache() override; void CompileComputeShaders(); diff --git a/src/Features/ScreenSpaceShadows.h b/src/Features/ScreenSpaceShadows.h index 201e5e776..0145fd09e 100644 --- a/src/Features/ScreenSpaceShadows.h +++ b/src/Features/ScreenSpaceShadows.h @@ -55,7 +55,6 @@ struct ScreenSpaceShadows : Feature Texture2D* screenSpaceShadowsTexture = nullptr; virtual void SetupResources(); - virtual void Reset(){}; virtual void DrawSettings(); diff --git a/src/Features/Skylighting.cpp b/src/Features/Skylighting.cpp index 0a62164c5..493c0fea8 100644 --- a/src/Features/Skylighting.cpp +++ b/src/Features/Skylighting.cpp @@ -97,10 +97,6 @@ void Skylighting::SetupResources() } } -void Skylighting::Reset() -{ -} - void Skylighting::Load(json& o_json) { if (o_json[GetName()].is_object()) diff --git a/src/Features/Skylighting.h b/src/Features/Skylighting.h index ef430ba48..c41d21b8e 100644 --- a/src/Features/Skylighting.h +++ b/src/Features/Skylighting.h @@ -22,7 +22,6 @@ struct Skylighting : Feature bool HasShaderDefine(RE::BSShader::Type) override { return true; }; virtual void SetupResources(); - virtual void Reset(); virtual void DrawSettings(); diff --git a/src/Features/SubsurfaceScattering.h b/src/Features/SubsurfaceScattering.h index 144c42aea..2a9f53055 100644 --- a/src/Features/SubsurfaceScattering.h +++ b/src/Features/SubsurfaceScattering.h @@ -72,7 +72,7 @@ struct SubsurfaceScattering : Feature bool HasShaderDefine(RE::BSShader::Type) override { return true; }; virtual void SetupResources(); - virtual void Reset(); + virtual void Reset() override; virtual void RestoreDefaultSettings(); virtual void DrawSettings(); diff --git a/src/Features/TerrainBlending.cpp b/src/Features/TerrainBlending.cpp index 767517e17..cc725c33c 100644 --- a/src/Features/TerrainBlending.cpp +++ b/src/Features/TerrainBlending.cpp @@ -134,10 +134,6 @@ void TerrainBlending::SetupResources() } } -void TerrainBlending::Reset() -{ -} - void TerrainBlending::Load(json& o_json) { Feature::Load(o_json); diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index 0e9b2e094..a6483d49a 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -19,7 +19,6 @@ struct TerrainBlending : Feature virtual inline bool HasShaderDefine(RE::BSShader::Type) { return true; } virtual void SetupResources(); - virtual void Reset(); virtual void DrawSettings(); diff --git a/src/Features/TerrainOcclusion.h b/src/Features/TerrainOcclusion.h index 786bb3bc7..70d45770e 100644 --- a/src/Features/TerrainOcclusion.h +++ b/src/Features/TerrainOcclusion.h @@ -114,8 +114,6 @@ struct TerrainOcclusion : public Feature virtual void DrawSettings() override; - virtual inline void Reset() override{}; - virtual void Prepass() override; void LoadHeightmap(); void Precompute(); diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index 66661378d..b6c00ac55 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -20,7 +20,6 @@ struct WaterCaustics : Feature bool HasShaderDefine(RE::BSShader::Type shaderType) override; virtual void SetupResources(); - virtual inline void Reset() {} virtual void DrawSettings(); diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index 9f2a008a9..f5ceb5f81 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -18,7 +18,6 @@ struct WaterParallax : Feature bool HasShaderDefine(RE::BSShader::Type shaderType) override; virtual void SetupResources(); - virtual inline void Reset() {} virtual void DrawSettings(); diff --git a/src/Features/WetnessEffects.h b/src/Features/WetnessEffects.h index 66f0ba5cb..7d7b7afe1 100644 --- a/src/Features/WetnessEffects.h +++ b/src/Features/WetnessEffects.h @@ -78,7 +78,7 @@ struct WetnessEffects : Feature float previousWeatherTransitionPercentage = 0.0f; virtual void SetupResources(); - virtual void Reset(); + virtual void Reset() override; virtual void DrawSettings(); From d765dc07582d8369309563f972f429e4f46cbbc2 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 4 Jul 2024 13:15:29 +0200 Subject: [PATCH 3/9] refactor: make feature->SetupResources optional --- src/Feature.h | 2 +- src/Features/DynamicCubemaps.h | 2 +- src/Features/ExtendedMaterials.h | 2 -- src/Features/GrassCollision.h | 2 +- src/Features/GrassLighting.h | 2 -- src/Features/LightLimitFix.h | 2 +- src/Features/ScreenSpaceShadows.h | 2 +- src/Features/Skylighting.h | 2 +- src/Features/SubsurfaceScattering.h | 2 +- src/Features/TerrainBlending.h | 2 +- src/Features/WaterCaustics.h | 2 +- src/Features/WaterParallax.h | 2 +- src/Features/WetnessEffects.cpp | 4 ---- src/Features/WetnessEffects.h | 1 - 14 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index bbe0bae46..ddf5a1727 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -18,7 +18,7 @@ struct Feature */ virtual bool SupportsVR() { return false; } - virtual void SetupResources() = 0; + virtual void SetupResources() {} virtual void Reset() {} virtual void DrawSettings() = 0; diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 71e4284c2..b4d9cf77b 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -94,7 +94,7 @@ struct DynamicCubemaps : Feature inline std::string_view GetShaderDefineName() override { return "DYNAMIC_CUBEMAPS"; } bool HasShaderDefine(RE::BSShader::Type) override { return true; }; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void Reset() override; virtual void DrawSettings(); diff --git a/src/Features/ExtendedMaterials.h b/src/Features/ExtendedMaterials.h index 417242486..b56609d67 100644 --- a/src/Features/ExtendedMaterials.h +++ b/src/Features/ExtendedMaterials.h @@ -28,8 +28,6 @@ struct ExtendedMaterials : Feature Settings settings; - virtual void SetupResources(){}; - virtual void DataLoaded() override; virtual void DrawSettings(); diff --git a/src/Features/GrassCollision.h b/src/Features/GrassCollision.h index 44ae6e1c5..77c3166da 100644 --- a/src/Features/GrassCollision.h +++ b/src/Features/GrassCollision.h @@ -46,7 +46,7 @@ struct GrassCollision : Feature ConstantBuffer* perFrame = nullptr; int eyeCount = !REL::Module::IsVR() ? 1 : 2; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void Reset() override; virtual void DrawSettings(); diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index d005edf50..20b034e3c 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -25,8 +25,6 @@ struct GrassLighting : Feature Settings settings; - virtual void SetupResources(){}; - virtual void DrawSettings(); virtual void Load(json& o_json); diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index 335da13c0..a408843a5 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -127,7 +127,7 @@ struct LightLimitFix : Feature Matrix viewMatrixCached[2]{}; Matrix viewMatrixInverseCached[2]{}; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void Reset() override; virtual void Load(json& o_json); diff --git a/src/Features/ScreenSpaceShadows.h b/src/Features/ScreenSpaceShadows.h index 0145fd09e..5ce601f34 100644 --- a/src/Features/ScreenSpaceShadows.h +++ b/src/Features/ScreenSpaceShadows.h @@ -54,7 +54,7 @@ struct ScreenSpaceShadows : Feature Texture2D* screenSpaceShadowsTexture = nullptr; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void DrawSettings(); diff --git a/src/Features/Skylighting.h b/src/Features/Skylighting.h index c41d21b8e..904592774 100644 --- a/src/Features/Skylighting.h +++ b/src/Features/Skylighting.h @@ -21,7 +21,7 @@ struct Skylighting : Feature inline std::string_view GetShaderDefineName() override { return "SKYLIGHTING"; } bool HasShaderDefine(RE::BSShader::Type) override { return true; }; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void DrawSettings(); diff --git a/src/Features/SubsurfaceScattering.h b/src/Features/SubsurfaceScattering.h index 2a9f53055..7b695ce00 100644 --- a/src/Features/SubsurfaceScattering.h +++ b/src/Features/SubsurfaceScattering.h @@ -71,7 +71,7 @@ struct SubsurfaceScattering : Feature bool HasShaderDefine(RE::BSShader::Type) override { return true; }; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void Reset() override; virtual void RestoreDefaultSettings(); diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index a6483d49a..e5825e57b 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -18,7 +18,7 @@ struct TerrainBlending : Feature virtual inline std::string_view GetShaderDefineName() { return "TERRAIN_BLENDING"; } virtual inline bool HasShaderDefine(RE::BSShader::Type) { return true; } - virtual void SetupResources(); + virtual void SetupResources() override; virtual void DrawSettings(); diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index b6c00ac55..5aa5cce2c 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -19,7 +19,7 @@ struct WaterCaustics : Feature bool HasShaderDefine(RE::BSShader::Type shaderType) override; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void DrawSettings(); diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index f5ceb5f81..b45c5c4f2 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -17,7 +17,7 @@ struct WaterParallax : Feature bool HasShaderDefine(RE::BSShader::Type shaderType) override; - virtual void SetupResources(); + virtual void SetupResources() override; virtual void DrawSettings(); diff --git a/src/Features/WetnessEffects.cpp b/src/Features/WetnessEffects.cpp index c32325474..99b5ea7fc 100644 --- a/src/Features/WetnessEffects.cpp +++ b/src/Features/WetnessEffects.cpp @@ -344,10 +344,6 @@ WetnessEffects::PerFrame WetnessEffects::GetCommonBufferData() return data; } -void WetnessEffects::SetupResources() -{ -} - void WetnessEffects::Reset() { requiresUpdate = true; diff --git a/src/Features/WetnessEffects.h b/src/Features/WetnessEffects.h index 7d7b7afe1..579a166bb 100644 --- a/src/Features/WetnessEffects.h +++ b/src/Features/WetnessEffects.h @@ -77,7 +77,6 @@ struct WetnessEffects : Feature uint32_t lastWeatherID = 0; float previousWeatherTransitionPercentage = 0.0f; - virtual void SetupResources(); virtual void Reset() override; virtual void DrawSettings(); From ebbded5346dc71621dd2270530a3b113d60f69b6 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 4 Jul 2024 13:18:39 +0200 Subject: [PATCH 4/9] refactor: remove unnecessary override --- src/Features/DynamicCubemaps.cpp | 4 ---- src/Features/DynamicCubemaps.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/src/Features/DynamicCubemaps.cpp b/src/Features/DynamicCubemaps.cpp index e5987cb89..920189d5b 100644 --- a/src/Features/DynamicCubemaps.cpp +++ b/src/Features/DynamicCubemaps.cpp @@ -410,10 +410,6 @@ void DynamicCubemaps::PostDeferred() context->PSSetShaderResources(64, 2, views); } -void DynamicCubemaps::Prepass() -{ -} - void DynamicCubemaps::SetupResources() { GetComputeShaderUpdate(); diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index b4d9cf77b..305070262 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -127,8 +127,6 @@ struct DynamicCubemaps : Feature void UpdateCubemapCapture(); - virtual void Prepass() override; - void Inferrence(bool a_reflections); void Irradiance(bool a_reflections); From 303368a49dbc10c0d89b112ac52360b35e917034 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 4 Jul 2024 13:56:45 +0200 Subject: [PATCH 5/9] refactor: simplify feature::Save/Load and made them optional --- src/Feature.cpp | 10 +++++++++- src/Feature.h | 7 +++++-- src/Features/CloudShadows.cpp | 9 --------- src/Features/CloudShadows.h | 3 --- src/Features/DynamicCubemaps.cpp | 9 --------- src/Features/DynamicCubemaps.h | 3 --- src/Features/ExtendedMaterials.cpp | 11 ++++------- src/Features/ExtendedMaterials.h | 4 ++-- src/Features/GrassCollision.cpp | 11 ++++------- src/Features/GrassCollision.h | 4 ++-- src/Features/GrassLighting.cpp | 11 ++++------- src/Features/GrassLighting.h | 4 ++-- src/Features/LightLimitFix.cpp | 10 ++++------ src/Features/LightLimitFix.h | 4 ++-- src/Features/ScreenSpaceGI.cpp | 11 ++++------- src/Features/ScreenSpaceGI.h | 4 ++-- src/Features/ScreenSpaceShadows.cpp | 11 ++++------- src/Features/ScreenSpaceShadows.h | 4 ++-- src/Features/Skylighting.cpp | 11 ++++------- src/Features/Skylighting.h | 4 ++-- src/Features/SubsurfaceScattering.cpp | 11 ++++------- src/Features/SubsurfaceScattering.h | 4 ++-- src/Features/TerrainBlending.cpp | 9 --------- src/Features/TerrainBlending.h | 3 --- src/Features/TerrainOcclusion.cpp | 11 ++++------- src/Features/TerrainOcclusion.h | 4 ++-- src/Features/WaterCaustics.cpp | 9 --------- src/Features/WaterCaustics.h | 3 --- src/Features/WaterParallax.cpp | 9 --------- src/Features/WaterParallax.h | 3 --- src/Features/WetnessEffects.cpp | 11 ++++------- src/Features/WetnessEffects.h | 4 ++-- 32 files changed, 74 insertions(+), 152 deletions(-) diff --git a/src/Feature.cpp b/src/Feature.cpp index bc4dec97a..1034b6653 100644 --- a/src/Feature.cpp +++ b/src/Feature.cpp @@ -19,8 +19,11 @@ #include "State.h" -void Feature::Load(json&) +void Feature::Load(json& o_json) { + if (o_json[GetName()].is_object()) + LoadSettings(o_json[GetName()]); + // Convert string to wstring auto ini_filename = std::format("{}.ini", GetShortName()); std::wstring ini_filename_w; @@ -63,6 +66,11 @@ void Feature::Load(json&) } } +void Feature::Save(json& o_json) +{ + SaveSettings(o_json[GetName()]); +} + bool Feature::ValidateCache(CSimpleIniA& a_ini) { auto name = GetName(); diff --git a/src/Feature.h b/src/Feature.h index ddf5a1727..0190fb516 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -30,8 +30,11 @@ struct Feature virtual void DataLoaded() {} virtual void PostPostLoad() {} - virtual void Load(json& o_json); - virtual void Save(json& o_json) = 0; + void Load(json& o_json); + void Save(json& o_json); + + virtual void SaveSettings(json&) {} + virtual void LoadSettings(json&) {} virtual void RestoreDefaultSettings() = 0; diff --git a/src/Features/CloudShadows.cpp b/src/Features/CloudShadows.cpp index 4e691eb7b..3fe20dbaa 100644 --- a/src/Features/CloudShadows.cpp +++ b/src/Features/CloudShadows.cpp @@ -96,15 +96,6 @@ void CloudShadows::Prepass() context->PSSetShaderResources(27, 1, &srv); } -void CloudShadows::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void CloudShadows::Save(json&) -{ -} - void CloudShadows::SetupResources() { auto renderer = RE::BSGraphics::Renderer::GetSingleton(); diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index cbc706383..0314ba883 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -33,9 +33,6 @@ struct CloudShadows : Feature virtual void Prepass() override; - virtual void Load(json& o_json) override; - virtual void Save(json& o_json) override; - virtual void RestoreDefaultSettings() override; virtual inline void PostPostLoad() override { Hooks::Install(); } diff --git a/src/Features/DynamicCubemaps.cpp b/src/Features/DynamicCubemaps.cpp index 920189d5b..43a9ccc5c 100644 --- a/src/Features/DynamicCubemaps.cpp +++ b/src/Features/DynamicCubemaps.cpp @@ -523,15 +523,6 @@ void DynamicCubemaps::Reset() activeReflections = false; } -void DynamicCubemaps::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void DynamicCubemaps::Save(json&) -{ -} - void DynamicCubemaps::RestoreDefaultSettings() { } \ No newline at end of file diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 305070262..676f1d3e7 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -100,9 +100,6 @@ struct DynamicCubemaps : Feature virtual void DrawSettings(); virtual void DataLoaded() override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - virtual void RestoreDefaultSettings(); std::vector iniVRCubeMapSettings{ diff --git a/src/Features/ExtendedMaterials.cpp b/src/Features/ExtendedMaterials.cpp index ca03c2179..1eed865a0 100644 --- a/src/Features/ExtendedMaterials.cpp +++ b/src/Features/ExtendedMaterials.cpp @@ -73,17 +73,14 @@ void ExtendedMaterials::DrawSettings() } } -void ExtendedMaterials::Load(json& o_json) +void ExtendedMaterials::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void ExtendedMaterials::Save(json& o_json) +void ExtendedMaterials::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void ExtendedMaterials::RestoreDefaultSettings() diff --git a/src/Features/ExtendedMaterials.h b/src/Features/ExtendedMaterials.h index b56609d67..4be268daa 100644 --- a/src/Features/ExtendedMaterials.h +++ b/src/Features/ExtendedMaterials.h @@ -32,8 +32,8 @@ struct ExtendedMaterials : Feature virtual void DrawSettings(); - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void RestoreDefaultSettings(); diff --git a/src/Features/GrassCollision.cpp b/src/Features/GrassCollision.cpp index 73fa39832..cec9a8fdc 100644 --- a/src/Features/GrassCollision.cpp +++ b/src/Features/GrassCollision.cpp @@ -190,17 +190,14 @@ void GrassCollision::Update() } } -void GrassCollision::Load(json& o_json) +void GrassCollision::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void GrassCollision::Save(json& o_json) +void GrassCollision::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void GrassCollision::RestoreDefaultSettings() diff --git a/src/Features/GrassCollision.h b/src/Features/GrassCollision.h index 77c3166da..cff092a9e 100644 --- a/src/Features/GrassCollision.h +++ b/src/Features/GrassCollision.h @@ -53,8 +53,8 @@ struct GrassCollision : Feature void UpdateCollisions(PerFrame& perFrame); void Update(); - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void RestoreDefaultSettings(); diff --git a/src/Features/GrassLighting.cpp b/src/Features/GrassLighting.cpp index cc86a36e7..58b274540 100644 --- a/src/Features/GrassLighting.cpp +++ b/src/Features/GrassLighting.cpp @@ -66,17 +66,14 @@ void GrassLighting::DrawSettings() } } -void GrassLighting::Load(json& o_json) +void GrassLighting::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void GrassLighting::Save(json& o_json) +void GrassLighting::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void GrassLighting::RestoreDefaultSettings() diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index 20b034e3c..ee6656962 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -27,8 +27,8 @@ struct GrassLighting : Feature virtual void DrawSettings(); - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void RestoreDefaultSettings(); diff --git a/src/Features/LightLimitFix.cpp b/src/Features/LightLimitFix.cpp index 61caf5182..507d55206 100644 --- a/src/Features/LightLimitFix.cpp +++ b/src/Features/LightLimitFix.cpp @@ -245,16 +245,14 @@ void LightLimitFix::Reset() std::swap(particleLights, queuedParticleLights); } -void LightLimitFix::Load(json& o_json) +void LightLimitFix::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - Feature::Load(o_json); + settings = o_json; } -void LightLimitFix::Save(json& o_json) +void LightLimitFix::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void LightLimitFix::RestoreDefaultSettings() diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index a408843a5..db1250cd9 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -130,8 +130,8 @@ struct LightLimitFix : Feature virtual void SetupResources() override; virtual void Reset() override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void RestoreDefaultSettings(); diff --git a/src/Features/ScreenSpaceGI.cpp b/src/Features/ScreenSpaceGI.cpp index 7a451807d..81ce3302d 100644 --- a/src/Features/ScreenSpaceGI.cpp +++ b/src/Features/ScreenSpaceGI.cpp @@ -344,17 +344,14 @@ void ScreenSpaceGI::DrawSettings() } } -void ScreenSpaceGI::Load(json& o_json) +void ScreenSpaceGI::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void ScreenSpaceGI::Save([[maybe_unused]] json& o_json) +void ScreenSpaceGI::SaveSettings([[maybe_unused]] json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void ScreenSpaceGI::SetupResources() diff --git a/src/Features/ScreenSpaceGI.h b/src/Features/ScreenSpaceGI.h index 9581621f5..49aae1e53 100644 --- a/src/Features/ScreenSpaceGI.h +++ b/src/Features/ScreenSpaceGI.h @@ -26,8 +26,8 @@ struct ScreenSpaceGI : Feature virtual void RestoreDefaultSettings() override; virtual void DrawSettings() override; - virtual void Load(json& o_json) override; - virtual void Save(json& o_json) override; + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void SetupResources() override; virtual void ClearShaderCache() override; diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index 5375703ae..58374ca37 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -223,17 +223,14 @@ void ScreenSpaceShadows::Prepass() context->PSSetShaderResources(17, 1, &view); } -void ScreenSpaceShadows::Load(json& o_json) +void ScreenSpaceShadows::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - bendSettings = o_json[GetName()]; - - Feature::Load(o_json); + bendSettings = o_json; } -void ScreenSpaceShadows::Save(json& o_json) +void ScreenSpaceShadows::SaveSettings(json& o_json) { - o_json[GetName()] = bendSettings; + o_json = bendSettings; } void ScreenSpaceShadows::RestoreDefaultSettings() diff --git a/src/Features/ScreenSpaceShadows.h b/src/Features/ScreenSpaceShadows.h index 5ce601f34..1a83adaf8 100644 --- a/src/Features/ScreenSpaceShadows.h +++ b/src/Features/ScreenSpaceShadows.h @@ -64,8 +64,8 @@ struct ScreenSpaceShadows : Feature virtual void Prepass() override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; void DrawShadows(); diff --git a/src/Features/Skylighting.cpp b/src/Features/Skylighting.cpp index 493c0fea8..ab9e12eb9 100644 --- a/src/Features/Skylighting.cpp +++ b/src/Features/Skylighting.cpp @@ -97,17 +97,14 @@ void Skylighting::SetupResources() } } -void Skylighting::Load(json& o_json) +void Skylighting::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void Skylighting::Save(json& o_json) +void Skylighting::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void Skylighting::PostPostLoad() diff --git a/src/Features/Skylighting.h b/src/Features/Skylighting.h index 904592774..5b1b6d8df 100644 --- a/src/Features/Skylighting.h +++ b/src/Features/Skylighting.h @@ -25,8 +25,8 @@ struct Skylighting : Feature virtual void DrawSettings(); - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void PostPostLoad(); diff --git a/src/Features/SubsurfaceScattering.cpp b/src/Features/SubsurfaceScattering.cpp index 924a0451a..8b21a1415 100644 --- a/src/Features/SubsurfaceScattering.cpp +++ b/src/Features/SubsurfaceScattering.cpp @@ -305,17 +305,14 @@ void SubsurfaceScattering::RestoreDefaultSettings() settings = {}; } -void SubsurfaceScattering::Load(json& o_json) +void SubsurfaceScattering::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void SubsurfaceScattering::Save(json& o_json) +void SubsurfaceScattering::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void SubsurfaceScattering::ClearShaderCache() diff --git a/src/Features/SubsurfaceScattering.h b/src/Features/SubsurfaceScattering.h index 7b695ce00..1dd1c029e 100644 --- a/src/Features/SubsurfaceScattering.h +++ b/src/Features/SubsurfaceScattering.h @@ -85,8 +85,8 @@ struct SubsurfaceScattering : Feature virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void ClearShaderCache(); ID3D11ComputeShader* GetComputeShaderHorizontalBlur(); diff --git a/src/Features/TerrainBlending.cpp b/src/Features/TerrainBlending.cpp index cc725c33c..02521e914 100644 --- a/src/Features/TerrainBlending.cpp +++ b/src/Features/TerrainBlending.cpp @@ -134,15 +134,6 @@ void TerrainBlending::SetupResources() } } -void TerrainBlending::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void TerrainBlending::Save(json&) -{ -} - void TerrainBlending::RestoreDefaultSettings() { } diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index e5825e57b..d2b12acd6 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -31,9 +31,6 @@ struct TerrainBlending : Feature ID3D11ComputeShader* GetDepthBlendShader(); ID3D11ComputeShader* GetDepthFixShader(); - virtual void Load(json& o_json); - virtual void Save(json& o_json); - virtual void RestoreDefaultSettings(); virtual void PostPostLoad() override; diff --git a/src/Features/TerrainOcclusion.cpp b/src/Features/TerrainOcclusion.cpp index ae014d493..38513e671 100644 --- a/src/Features/TerrainOcclusion.cpp +++ b/src/Features/TerrainOcclusion.cpp @@ -22,17 +22,14 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( AOPower, AOFadeOutHeight) -void TerrainOcclusion::Load(json& o_json) +void TerrainOcclusion::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void TerrainOcclusion::Save(json& o_json) +void TerrainOcclusion::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void TerrainOcclusion::DrawSettings() diff --git a/src/Features/TerrainOcclusion.h b/src/Features/TerrainOcclusion.h index 70d45770e..3a47b6f80 100644 --- a/src/Features/TerrainOcclusion.h +++ b/src/Features/TerrainOcclusion.h @@ -119,8 +119,8 @@ struct TerrainOcclusion : public Feature void Precompute(); void UpdateShadow(); - virtual void Load(json& o_json) override; - virtual void Save(json&) override; + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual inline void RestoreDefaultSettings() override { settings = {}; } virtual void ClearShaderCache() override; diff --git a/src/Features/WaterCaustics.cpp b/src/Features/WaterCaustics.cpp index dd49e107e..654a4728c 100644 --- a/src/Features/WaterCaustics.cpp +++ b/src/Features/WaterCaustics.cpp @@ -23,15 +23,6 @@ void WaterCaustics::Prepass() context->PSSetShaderResources(70, 1, &causticsView); } -void WaterCaustics::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void WaterCaustics::Save(json&) -{ -} - void WaterCaustics::RestoreDefaultSettings() { } diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index 5aa5cce2c..c03182795 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -25,9 +25,6 @@ struct WaterCaustics : Feature virtual void Prepass() override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - virtual void RestoreDefaultSettings(); bool SupportsVR() override { return true; }; diff --git a/src/Features/WaterParallax.cpp b/src/Features/WaterParallax.cpp index a9b55baaa..416221fe1 100644 --- a/src/Features/WaterParallax.cpp +++ b/src/Features/WaterParallax.cpp @@ -15,15 +15,6 @@ void WaterParallax::SetupResources() { } -void WaterParallax::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void WaterParallax::Save(json&) -{ -} - void WaterParallax::RestoreDefaultSettings() { } diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index b45c5c4f2..3fc7c87d4 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -23,9 +23,6 @@ struct WaterParallax : Feature virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - virtual void RestoreDefaultSettings(); bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WetnessEffects.cpp b/src/Features/WetnessEffects.cpp index 99b5ea7fc..48860dfa5 100644 --- a/src/Features/WetnessEffects.cpp +++ b/src/Features/WetnessEffects.cpp @@ -349,17 +349,14 @@ void WetnessEffects::Reset() requiresUpdate = true; } -void WetnessEffects::Load(json& o_json) +void WetnessEffects::LoadSettings(json& o_json) { - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(o_json); + settings = o_json; } -void WetnessEffects::Save(json& o_json) +void WetnessEffects::SaveSettings(json& o_json) { - o_json[GetName()] = settings; + o_json = settings; } void WetnessEffects::RestoreDefaultSettings() diff --git a/src/Features/WetnessEffects.h b/src/Features/WetnessEffects.h index 579a166bb..277d6a98b 100644 --- a/src/Features/WetnessEffects.h +++ b/src/Features/WetnessEffects.h @@ -81,8 +81,8 @@ struct WetnessEffects : Feature virtual void DrawSettings(); - virtual void Load(json& o_json); - virtual void Save(json& o_json); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; virtual void RestoreDefaultSettings(); float CalculateWeatherTransitionPercentage(float skyCurrentWeatherPct, float beginFade, bool fadeIn); From 73b31608535318453422d81ade578730b945b617 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 4 Jul 2024 14:10:03 +0200 Subject: [PATCH 6/9] refactor: add virtual and override keywords to features --- src/Features/CloudShadows.h | 4 ++-- src/Features/DynamicCubemaps.h | 6 +++--- src/Features/ExtendedMaterials.h | 6 +++--- src/Features/GrassCollision.h | 6 +++--- src/Features/GrassLighting.h | 4 ++-- src/Features/LightLimitFix.h | 6 +++--- src/Features/ScreenSpaceGI.h | 4 ++-- src/Features/ScreenSpaceShadows.h | 6 +++--- src/Features/Skylighting.h | 10 +++++----- src/Features/SubsurfaceScattering.h | 8 ++++---- src/Features/TerrainBlending.h | 10 +++++----- src/Features/TerrainOcclusion.h | 2 +- src/Features/WaterCaustics.h | 6 +++--- src/Features/WaterParallax.h | 6 +++--- src/Features/WetnessEffects.h | 6 +++--- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index 0314ba883..c8b793800 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -11,8 +11,8 @@ struct CloudShadows : Feature return &singleton; } - virtual inline std::string GetName() override { return "Cloud Shadows"; } - virtual inline std::string GetShortName() override { return "CloudShadows"; } + virtual inline std::string GetName() { return "Cloud Shadows"; } + virtual inline std::string GetShortName() { return "CloudShadows"; } virtual inline std::string_view GetShaderDefineName() override { return "CLOUD_SHADOWS"; } virtual inline bool HasShaderDefine(RE::BSShader::Type) override { return true; } diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 676f1d3e7..041c2530c 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -91,16 +91,16 @@ struct DynamicCubemaps : Feature virtual inline std::string GetName() { return "Dynamic Cubemaps"; } virtual inline std::string GetShortName() { return "DynamicCubemaps"; } - inline std::string_view GetShaderDefineName() override { return "DYNAMIC_CUBEMAPS"; } + virtual inline std::string_view GetShaderDefineName() override { return "DYNAMIC_CUBEMAPS"; } bool HasShaderDefine(RE::BSShader::Type) override { return true; }; virtual void SetupResources() override; virtual void Reset() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void DataLoaded() override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; std::vector iniVRCubeMapSettings{ { "bAutoWaterSilhouetteReflections:Water" }, //IniSettings 0x1eaa018 diff --git a/src/Features/ExtendedMaterials.h b/src/Features/ExtendedMaterials.h index 4be268daa..e9a7b6639 100644 --- a/src/Features/ExtendedMaterials.h +++ b/src/Features/ExtendedMaterials.h @@ -12,7 +12,7 @@ struct ExtendedMaterials : Feature virtual inline std::string GetName() { return "Extended Materials"; } virtual inline std::string GetShortName() { return "ExtendedMaterials"; } - inline std::string_view GetShaderDefineName() override { return "EXTENDED_MATERIALS"; } + virtual inline std::string_view GetShaderDefineName() override { return "EXTENDED_MATERIALS"; } bool HasShaderDefine(RE::BSShader::Type shaderType) override; @@ -30,12 +30,12 @@ struct ExtendedMaterials : Feature virtual void DataLoaded() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; bool SupportsVR() override { return true; }; }; diff --git a/src/Features/GrassCollision.h b/src/Features/GrassCollision.h index cff092a9e..2e3fb6b08 100644 --- a/src/Features/GrassCollision.h +++ b/src/Features/GrassCollision.h @@ -13,7 +13,7 @@ struct GrassCollision : Feature virtual inline std::string GetName() { return "Grass Collision"; } virtual inline std::string GetShortName() { return "GrassCollision"; } - inline std::string_view GetShaderDefineName() override { return "GRASS_COLLISION"; } + virtual inline std::string_view GetShaderDefineName() override { return "GRASS_COLLISION"; } bool HasShaderDefine(RE::BSShader::Type shaderType) override; @@ -49,14 +49,14 @@ struct GrassCollision : Feature virtual void SetupResources() override; virtual void Reset() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; void UpdateCollisions(PerFrame& perFrame); void Update(); virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; virtual void PostPostLoad() override; diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index ee6656962..13ecc408b 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -25,12 +25,12 @@ struct GrassLighting : Feature Settings settings; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; bool SupportsVR() override { return true; }; }; diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index db1250cd9..3ddf35923 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -21,7 +21,7 @@ struct LightLimitFix : Feature virtual inline std::string GetName() { return "Light Limit Fix"; } virtual inline std::string GetShortName() { return "LightLimitFix"; } - inline std::string_view GetShaderDefineName() override { return "LIGHT_LIMIT_FIX"; } + virtual inline std::string_view GetShaderDefineName() override { return "LIGHT_LIMIT_FIX"; } bool HasShaderDefine(RE::BSShader::Type) override { return true; }; @@ -133,9 +133,9 @@ struct LightLimitFix : Feature virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void PostPostLoad() override; virtual void DataLoaded() override; diff --git a/src/Features/ScreenSpaceGI.h b/src/Features/ScreenSpaceGI.h index 49aae1e53..3a476ad2c 100644 --- a/src/Features/ScreenSpaceGI.h +++ b/src/Features/ScreenSpaceGI.h @@ -15,8 +15,8 @@ struct ScreenSpaceGI : Feature virtual inline std::string GetName() override { return "Screen Space GI"; } virtual inline std::string GetShortName() override { return "ScreenSpaceGI"; } - inline std::string_view GetShaderDefineName() override { return "SSGI"; } - inline bool HasShaderDefine(RE::BSShader::Type t) override + virtual inline std::string_view GetShaderDefineName() override { return "SSGI"; } + virtual inline bool HasShaderDefine(RE::BSShader::Type t) override { return t == RE::BSShader::Type::Lighting || t == RE::BSShader::Type::Grass || diff --git a/src/Features/ScreenSpaceShadows.h b/src/Features/ScreenSpaceShadows.h index 1a83adaf8..6682e6b36 100644 --- a/src/Features/ScreenSpaceShadows.h +++ b/src/Features/ScreenSpaceShadows.h @@ -13,7 +13,7 @@ struct ScreenSpaceShadows : Feature virtual inline std::string GetName() { return "Screen-Space Shadows"; } virtual inline std::string GetShortName() { return "ScreenSpaceShadows"; } - inline std::string_view GetShaderDefineName() override { return "SCREEN_SPACE_SHADOWS"; } + virtual inline std::string_view GetShaderDefineName() override { return "SCREEN_SPACE_SHADOWS"; } bool HasShaderDefine(RE::BSShader::Type shaderType) override; struct BendSettings @@ -56,7 +56,7 @@ struct ScreenSpaceShadows : Feature virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void ClearShaderCache() override; ID3D11ComputeShader* GetComputeRaymarch(); @@ -69,7 +69,7 @@ struct ScreenSpaceShadows : Feature void DrawShadows(); - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; bool SupportsVR() override { return true; }; }; diff --git a/src/Features/Skylighting.h b/src/Features/Skylighting.h index 5b1b6d8df..fc6b02df0 100644 --- a/src/Features/Skylighting.h +++ b/src/Features/Skylighting.h @@ -14,16 +14,16 @@ struct Skylighting : Feature return &singleton; } - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; virtual inline std::string GetName() { return "Skylighting"; } virtual inline std::string GetShortName() { return "Skylighting"; } - inline std::string_view GetShaderDefineName() override { return "SKYLIGHTING"; } - bool HasShaderDefine(RE::BSShader::Type) override { return true; }; + virtual inline std::string_view GetShaderDefineName() override { return "SKYLIGHTING"; } + virtual bool HasShaderDefine(RE::BSShader::Type) override { return true; }; virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; @@ -32,7 +32,7 @@ struct Skylighting : Feature virtual void Prepass() override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; ID3D11ComputeShader* GetSkylightingCS(); ID3D11ComputeShader* GetSkylightingShadowMapCS(); diff --git a/src/Features/SubsurfaceScattering.h b/src/Features/SubsurfaceScattering.h index 1dd1c029e..cf835b4d1 100644 --- a/src/Features/SubsurfaceScattering.h +++ b/src/Features/SubsurfaceScattering.h @@ -67,15 +67,15 @@ struct SubsurfaceScattering : Feature virtual inline std::string GetName() { return "Subsurface Scattering"; } virtual inline std::string GetShortName() { return "SubsurfaceScattering"; } - inline std::string_view GetShaderDefineName() override { return "SSS"; } + virtual inline std::string_view GetShaderDefineName() override { return "SSS"; } bool HasShaderDefine(RE::BSShader::Type) override { return true; }; virtual void SetupResources() override; virtual void Reset() override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; float3 Gaussian(DiffusionProfile& a_profile, float variance, float r); float3 Profile(DiffusionProfile& a_profile, float r); @@ -88,7 +88,7 @@ struct SubsurfaceScattering : Feature virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; - virtual void ClearShaderCache(); + virtual void ClearShaderCache() override; ID3D11ComputeShader* GetComputeShaderHorizontalBlur(); ID3D11ComputeShader* GetComputeShaderVerticalBlur(); diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index d2b12acd6..f24a8b7aa 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -15,12 +15,12 @@ struct TerrainBlending : Feature virtual inline std::string GetName() { return "Terrain Blending"; } virtual inline std::string GetShortName() { return "TerrainBlending"; } - virtual inline std::string_view GetShaderDefineName() { return "TERRAIN_BLENDING"; } - virtual inline bool HasShaderDefine(RE::BSShader::Type) { return true; } + virtual inline std::string_view GetShaderDefineName() override { return "TERRAIN_BLENDING"; } + virtual inline bool HasShaderDefine(RE::BSShader::Type) override { return true; } virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; ID3D11VertexShader* GetTerrainVertexShader(); ID3D11VertexShader* GetTerrainOffsetVertexShader(); @@ -31,7 +31,7 @@ struct TerrainBlending : Feature ID3D11ComputeShader* GetDepthBlendShader(); ID3D11ComputeShader* GetDepthFixShader(); - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; virtual void PostPostLoad() override; bool renderDepth = false; @@ -67,7 +67,7 @@ struct TerrainBlending : Feature ID3D11ComputeShader* depthBlendShader = nullptr; ID3D11ComputeShader* depthFixShader = nullptr; - virtual void ClearShaderCache(); + virtual void ClearShaderCache() override; struct Hooks { diff --git a/src/Features/TerrainOcclusion.h b/src/Features/TerrainOcclusion.h index 3a47b6f80..1120b5df8 100644 --- a/src/Features/TerrainOcclusion.h +++ b/src/Features/TerrainOcclusion.h @@ -13,7 +13,7 @@ struct TerrainOcclusion : public Feature virtual inline std::string GetName() { return "Terrain Occlusion"; } virtual inline std::string GetShortName() { return "TerrainOcclusion"; } - inline std::string_view GetShaderDefineName() override { return "TERRA_OCC"; } + virtual inline std::string_view GetShaderDefineName() override { return "TERRA_OCC"; } inline bool HasShaderDefine(RE::BSShader::Type type) override { return type == RE::BSShader::Type::Lighting || diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index c03182795..24e30e3ce 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -15,17 +15,17 @@ struct WaterCaustics : Feature virtual inline std::string GetName() { return "Water Caustics"; } virtual inline std::string GetShortName() { return "WaterCaustics"; } - inline std::string_view GetShaderDefineName() override { return "WATER_CAUSTICS"; } + virtual inline std::string_view GetShaderDefineName() override { return "WATER_CAUSTICS"; } bool HasShaderDefine(RE::BSShader::Type shaderType) override; virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void Prepass() override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index 3fc7c87d4..4983fd3ee 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -13,16 +13,16 @@ struct WaterParallax : Feature virtual inline std::string GetName() { return "Water Parallax"; } virtual inline std::string GetShortName() { return "WaterParallax"; } - inline std::string_view GetShaderDefineName() override { return "WATER_PARALLAX"; } + virtual inline std::string_view GetShaderDefineName() override { return "WATER_PARALLAX"; } bool HasShaderDefine(RE::BSShader::Type shaderType) override; virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WetnessEffects.h b/src/Features/WetnessEffects.h index 277d6a98b..f61f5cc81 100644 --- a/src/Features/WetnessEffects.h +++ b/src/Features/WetnessEffects.h @@ -15,7 +15,7 @@ struct WetnessEffects : Feature virtual inline std::string GetName() { return "Wetness Effects"; } virtual inline std::string GetShortName() { return "WetnessEffects"; } - inline std::string_view GetShaderDefineName() override { return "WETNESS_EFFECTS"; } + virtual inline std::string_view GetShaderDefineName() override { return "WETNESS_EFFECTS"; } bool HasShaderDefine(RE::BSShader::Type) override { return true; }; @@ -79,12 +79,12 @@ struct WetnessEffects : Feature virtual void Reset() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; float CalculateWeatherTransitionPercentage(float skyCurrentWeatherPct, float beginFade, bool fadeIn); void CalculateWetness(RE::TESWeather* weather, RE::Sky* sky, float seconds, float& wetness, float& puddleWetness); From cdc5addacc494e32cb2dc0420af674625a9ca22f Mon Sep 17 00:00:00 2001 From: FlayaN Date: Fri, 19 Jul 2024 22:18:50 +0200 Subject: [PATCH 7/9] refactor: make feature->DrawSettings optional --- src/Feature.h | 2 +- src/Features/CloudShadows.cpp | 4 ---- src/Features/CloudShadows.h | 2 -- src/Features/TerrainBlending.cpp | 4 ---- src/Features/TerrainBlending.h | 2 -- 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index 0190fb516..4b1ddbd50 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -21,7 +21,7 @@ struct Feature virtual void SetupResources() {} virtual void Reset() {} - virtual void DrawSettings() = 0; + virtual void DrawSettings() {} virtual void Draw(const RE::BSShader*, const uint32_t) {} virtual void DrawDeferred() {} virtual void DrawPreProcess() {} diff --git a/src/Features/CloudShadows.cpp b/src/Features/CloudShadows.cpp index 3fe20dbaa..e62bca838 100644 --- a/src/Features/CloudShadows.cpp +++ b/src/Features/CloudShadows.cpp @@ -5,10 +5,6 @@ #include "Deferred.h" #include "Util.h" -void CloudShadows::DrawSettings() -{ -} - void CloudShadows::CheckResourcesSide(int side) { static Util::FrameChecker frame_checker[6]; diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index c8b793800..37c99a8ee 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -26,8 +26,6 @@ struct CloudShadows : Feature virtual void SetupResources() override; - virtual void DrawSettings() override; - void CheckResourcesSide(int side); void ModifySky(RE::BSRenderPass* Pass); diff --git a/src/Features/TerrainBlending.cpp b/src/Features/TerrainBlending.cpp index 02521e914..eba37b191 100644 --- a/src/Features/TerrainBlending.cpp +++ b/src/Features/TerrainBlending.cpp @@ -3,10 +3,6 @@ #include "State.h" #include "Util.h" -void TerrainBlending::DrawSettings() -{ -} - ID3D11VertexShader* TerrainBlending::GetTerrainVertexShader() { if (!terrainVertexShader) { diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index f24a8b7aa..60da7c7ad 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -20,8 +20,6 @@ struct TerrainBlending : Feature virtual void SetupResources() override; - virtual void DrawSettings() override; - ID3D11VertexShader* GetTerrainVertexShader(); ID3D11VertexShader* GetTerrainOffsetVertexShader(); From b66151d7dcb8b63ce977e94a0bc21082d320f1de Mon Sep 17 00:00:00 2001 From: FlayaN Date: Fri, 19 Jul 2024 22:31:02 +0200 Subject: [PATCH 8/9] refactor: make feature->RestoreDefaultSettings optional --- src/Feature.h | 2 +- src/Features/CloudShadows.cpp | 4 ---- src/Features/CloudShadows.h | 2 -- src/Features/DynamicCubemaps.cpp | 4 ---- src/Features/DynamicCubemaps.h | 2 -- src/Features/TerrainBlending.cpp | 4 ---- src/Features/TerrainBlending.h | 1 - 7 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index 4b1ddbd50..d8f0669a0 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -36,7 +36,7 @@ struct Feature virtual void SaveSettings(json&) {} virtual void LoadSettings(json&) {} - virtual void RestoreDefaultSettings() = 0; + virtual void RestoreDefaultSettings() {} virtual bool ValidateCache(CSimpleIniA& a_ini); virtual void WriteDiskCacheInfo(CSimpleIniA& a_ini); diff --git a/src/Features/CloudShadows.cpp b/src/Features/CloudShadows.cpp index e62bca838..fc978f649 100644 --- a/src/Features/CloudShadows.cpp +++ b/src/Features/CloudShadows.cpp @@ -119,7 +119,3 @@ void CloudShadows::SetupResources() } } } - -void CloudShadows::RestoreDefaultSettings() -{ -} \ No newline at end of file diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index 37c99a8ee..c9632ce13 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -31,8 +31,6 @@ struct CloudShadows : Feature virtual void Prepass() override; - virtual void RestoreDefaultSettings() override; - virtual inline void PostPostLoad() override { Hooks::Install(); } struct Hooks diff --git a/src/Features/DynamicCubemaps.cpp b/src/Features/DynamicCubemaps.cpp index 43a9ccc5c..2ce17f1a9 100644 --- a/src/Features/DynamicCubemaps.cpp +++ b/src/Features/DynamicCubemaps.cpp @@ -522,7 +522,3 @@ void DynamicCubemaps::Reset() else activeReflections = false; } - -void DynamicCubemaps::RestoreDefaultSettings() -{ -} \ No newline at end of file diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 041c2530c..4b0f46f0d 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -100,8 +100,6 @@ struct DynamicCubemaps : Feature virtual void DrawSettings() override; virtual void DataLoaded() override; - virtual void RestoreDefaultSettings() override; - std::vector iniVRCubeMapSettings{ { "bAutoWaterSilhouetteReflections:Water" }, //IniSettings 0x1eaa018 { "bForceHighDetailReflections:Water" }, //IniSettings 0x1eaa030 diff --git a/src/Features/TerrainBlending.cpp b/src/Features/TerrainBlending.cpp index eba37b191..aaefad1ba 100644 --- a/src/Features/TerrainBlending.cpp +++ b/src/Features/TerrainBlending.cpp @@ -130,10 +130,6 @@ void TerrainBlending::SetupResources() } } -void TerrainBlending::RestoreDefaultSettings() -{ -} - void TerrainBlending::PostPostLoad() { Hooks::Install(); diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index 60da7c7ad..f2c5ce0f9 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -29,7 +29,6 @@ struct TerrainBlending : Feature ID3D11ComputeShader* GetDepthBlendShader(); ID3D11ComputeShader* GetDepthFixShader(); - virtual void RestoreDefaultSettings() override; virtual void PostPostLoad() override; bool renderDepth = false; From d44d5d469cb73a85c66fb0a903281ffc8566ca94 Mon Sep 17 00:00:00 2001 From: FlayaN Date: Tue, 23 Jul 2024 17:10:18 +0200 Subject: [PATCH 9/9] refactor: remove feature-Draw and remove empty functions --- src/Feature.h | 1 - src/Features/CloudShadows.h | 2 +- src/Features/DynamicCubemaps.h | 2 +- src/Features/ExtendedMaterials.h | 2 +- src/Features/GrassCollision.h | 2 +- src/Features/GrassLighting.h | 2 +- src/Features/LightLimitFix.h | 2 +- src/Features/ScreenSpaceShadows.h | 2 +- src/Features/SubsurfaceScattering.cpp | 5 +---- src/Features/SubsurfaceScattering.h | 4 +--- src/Features/TerrainBlending.h | 2 +- src/Features/TerrainOcclusion.h | 2 +- src/Features/WaterCaustics.cpp | 8 -------- src/Features/WaterCaustics.h | 6 +----- src/Features/WaterParallax.cpp | 19 ------------------- src/Features/WaterParallax.h | 9 +-------- src/Features/WetnessEffects.h | 2 +- 17 files changed, 14 insertions(+), 58 deletions(-) diff --git a/src/Feature.h b/src/Feature.h index d8f0669a0..d88c468c4 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -22,7 +22,6 @@ struct Feature virtual void Reset() {} virtual void DrawSettings() {} - virtual void Draw(const RE::BSShader*, const uint32_t) {} virtual void DrawDeferred() {} virtual void DrawPreProcess() {} virtual void Prepass() {} diff --git a/src/Features/CloudShadows.h b/src/Features/CloudShadows.h index c9632ce13..b30a8b869 100644 --- a/src/Features/CloudShadows.h +++ b/src/Features/CloudShadows.h @@ -51,5 +51,5 @@ struct CloudShadows : Feature logger::info("[Cloud Shadows] Installed hooks"); } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/DynamicCubemaps.h b/src/Features/DynamicCubemaps.h index 4b0f46f0d..d1b49cd18 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -126,5 +126,5 @@ struct DynamicCubemaps : Feature void Irradiance(bool a_reflections); - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/ExtendedMaterials.h b/src/Features/ExtendedMaterials.h index e9a7b6639..751987736 100644 --- a/src/Features/ExtendedMaterials.h +++ b/src/Features/ExtendedMaterials.h @@ -37,5 +37,5 @@ struct ExtendedMaterials : Feature virtual void RestoreDefaultSettings() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/GrassCollision.h b/src/Features/GrassCollision.h index 2e3fb6b08..f6d72834c 100644 --- a/src/Features/GrassCollision.h +++ b/src/Features/GrassCollision.h @@ -60,7 +60,7 @@ struct GrassCollision : Feature virtual void PostPostLoad() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; struct Hooks { diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index 13ecc408b..1ed6bd7cb 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -32,5 +32,5 @@ struct GrassLighting : Feature virtual void RestoreDefaultSettings() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index 3ddf35923..fecf60575 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -308,7 +308,7 @@ struct LightLimitFix : Feature } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; template <> diff --git a/src/Features/ScreenSpaceShadows.h b/src/Features/ScreenSpaceShadows.h index 6682e6b36..faa64ca35 100644 --- a/src/Features/ScreenSpaceShadows.h +++ b/src/Features/ScreenSpaceShadows.h @@ -71,5 +71,5 @@ struct ScreenSpaceShadows : Feature virtual void RestoreDefaultSettings() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/SubsurfaceScattering.cpp b/src/Features/SubsurfaceScattering.cpp index 8b21a1415..85847c3ed 100644 --- a/src/Features/SubsurfaceScattering.cpp +++ b/src/Features/SubsurfaceScattering.cpp @@ -1,3 +1,4 @@ + #include "SubsurfaceScattering.h" #include "Deferred.h" @@ -240,10 +241,6 @@ void SubsurfaceScattering::DrawSSS() context->CSSetShader(shader, nullptr, 0); } -void SubsurfaceScattering::Draw(const RE::BSShader*, const uint32_t) -{ -} - void SubsurfaceScattering::SetupResources() { { diff --git a/src/Features/SubsurfaceScattering.h b/src/Features/SubsurfaceScattering.h index cf835b4d1..83536e887 100644 --- a/src/Features/SubsurfaceScattering.h +++ b/src/Features/SubsurfaceScattering.h @@ -83,8 +83,6 @@ struct SubsurfaceScattering : Feature void DrawSSS(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; - virtual void LoadSettings(json& o_json) override; virtual void SaveSettings(json& o_json) override; @@ -117,5 +115,5 @@ struct SubsurfaceScattering : Feature } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index f2c5ce0f9..77a87c2d8 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -180,5 +180,5 @@ struct TerrainBlending : Feature logger::info("[Terrain Blending] Installed hooks"); } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/TerrainOcclusion.h b/src/Features/TerrainOcclusion.h index 1120b5df8..c1edae757 100644 --- a/src/Features/TerrainOcclusion.h +++ b/src/Features/TerrainOcclusion.h @@ -124,5 +124,5 @@ struct TerrainOcclusion : public Feature virtual inline void RestoreDefaultSettings() override { settings = {}; } virtual void ClearShaderCache() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; \ No newline at end of file diff --git a/src/Features/WaterCaustics.cpp b/src/Features/WaterCaustics.cpp index 654a4728c..7c9a16276 100644 --- a/src/Features/WaterCaustics.cpp +++ b/src/Features/WaterCaustics.cpp @@ -5,10 +5,6 @@ #include -void WaterCaustics::DrawSettings() -{ -} - void WaterCaustics::SetupResources() { auto& device = State::GetSingleton()->device; @@ -23,10 +19,6 @@ void WaterCaustics::Prepass() context->PSSetShaderResources(70, 1, &causticsView); } -void WaterCaustics::RestoreDefaultSettings() -{ -} - bool WaterCaustics::HasShaderDefine(RE::BSShader::Type) { return true; diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index 24e30e3ce..32400c0ac 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -21,11 +21,7 @@ struct WaterCaustics : Feature virtual void SetupResources() override; - virtual void DrawSettings() override; - virtual void Prepass() override; - virtual void RestoreDefaultSettings() override; - - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WaterParallax.cpp b/src/Features/WaterParallax.cpp index 416221fe1..f987b4429 100644 --- a/src/Features/WaterParallax.cpp +++ b/src/Features/WaterParallax.cpp @@ -1,24 +1,5 @@ #include "WaterParallax.h" -#include "State.h" -#include "Util.h" - -void WaterParallax::DrawSettings() -{ -} - -void WaterParallax::Draw(const RE::BSShader*, const uint32_t) -{ -} - -void WaterParallax::SetupResources() -{ -} - -void WaterParallax::RestoreDefaultSettings() -{ -} - bool WaterParallax::HasShaderDefine(RE::BSShader::Type) { return true; diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index 4983fd3ee..a28cd9a7c 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -17,12 +17,5 @@ struct WaterParallax : Feature bool HasShaderDefine(RE::BSShader::Type shaderType) override; - virtual void SetupResources() override; - - virtual void DrawSettings() override; - - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) override; - - virtual void RestoreDefaultSettings() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WetnessEffects.h b/src/Features/WetnessEffects.h index f61f5cc81..cfefcdd0f 100644 --- a/src/Features/WetnessEffects.h +++ b/src/Features/WetnessEffects.h @@ -97,5 +97,5 @@ struct WetnessEffects : Feature } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; };