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 894e729fe..d88c468c4 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -18,11 +18,10 @@ struct Feature */ virtual bool SupportsVR() { return false; } - virtual void SetupResources() = 0; - virtual void Reset() = 0; + virtual void SetupResources() {} + virtual void Reset() {} - virtual void DrawSettings() = 0; - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) = 0; + virtual void DrawSettings() {} virtual void DrawDeferred() {} virtual void DrawPreProcess() {} virtual void Prepass() {} @@ -30,10 +29,13 @@ 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 RestoreDefaultSettings() = 0; + virtual void SaveSettings(json&) {} + virtual void LoadSettings(json&) {} + + 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 aef7772ad..fc978f649 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]; @@ -96,19 +92,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); -} - -void CloudShadows::Save(json&) -{ -} - void CloudShadows::SetupResources() { auto renderer = RE::BSGraphics::Renderer::GetSingleton(); @@ -136,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 cab672fe0..b30a8b869 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; } @@ -26,22 +26,11 @@ struct CloudShadows : Feature virtual void SetupResources() override; - virtual inline void Reset() override {} - - virtual void DrawSettings() override; - void CheckResourcesSide(int side); void ModifySky(RE::BSRenderPass* Pass); 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; - - virtual void RestoreDefaultSettings() override; - virtual inline void PostPostLoad() override { Hooks::Install(); } struct Hooks @@ -62,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.cpp b/src/Features/DynamicCubemaps.cpp index bb26c5d5e..2ce17f1a9 100644 --- a/src/Features/DynamicCubemaps.cpp +++ b/src/Features/DynamicCubemaps.cpp @@ -410,14 +410,6 @@ void DynamicCubemaps::PostDeferred() context->PSSetShaderResources(64, 2, views); } -void DynamicCubemaps::Prepass() -{ -} - -void DynamicCubemaps::Draw(const RE::BSShader*, const uint32_t) -{ -} - void DynamicCubemaps::SetupResources() { GetComputeShaderUpdate(); @@ -530,16 +522,3 @@ void DynamicCubemaps::Reset() else 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 044657fb8..d1b49cd18 100644 --- a/src/Features/DynamicCubemaps.h +++ b/src/Features/DynamicCubemaps.h @@ -91,22 +91,15 @@ 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(); - virtual void Reset(); + virtual void SetupResources() override; + virtual void Reset() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; 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); - - virtual void RestoreDefaultSettings(); - std::vector iniVRCubeMapSettings{ { "bAutoWaterSilhouetteReflections:Water" }, //IniSettings 0x1eaa018 { "bForceHighDetailReflections:Water" }, //IniSettings 0x1eaa030 @@ -129,11 +122,9 @@ struct DynamicCubemaps : Feature void UpdateCubemapCapture(); - virtual void Prepass() override; - void Inferrence(bool a_reflections); void Irradiance(bool a_reflections); - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; 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 64af630a9..751987736 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; @@ -28,19 +28,14 @@ struct ExtendedMaterials : Feature Settings settings; - virtual void SetupResources(){}; - virtual inline void Reset() {} - virtual void DataLoaded() override; - virtual void DrawSettings(); - - virtual void Draw(const RE::BSShader*, const uint32_t){}; + virtual void DrawSettings() 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(); + virtual void RestoreDefaultSettings() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; 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 6422762cf..f6d72834c 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; @@ -46,22 +46,21 @@ struct GrassCollision : Feature ConstantBuffer* perFrame = nullptr; int eyeCount = !REL::Module::IsVR() ? 1 : 2; - virtual void SetupResources(); - virtual void Reset(); + virtual void SetupResources() override; + virtual void Reset() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; 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); + 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; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; struct Hooks { 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 0a1ae2b7d..1ed6bd7cb 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -25,17 +25,12 @@ struct GrassLighting : Feature Settings settings; - virtual void SetupResources(){}; + virtual void DrawSettings() override; - virtual void DrawSettings(); - virtual void Reset(){}; + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; - virtual void Draw(const RE::BSShader*, const uint32_t){}; + virtual void RestoreDefaultSettings() override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - - virtual void RestoreDefaultSettings(); - - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/LightLimitFix.cpp b/src/Features/LightLimitFix.cpp index 32fe4d92e..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() @@ -557,10 +555,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..fecf60575 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; }; @@ -127,16 +127,15 @@ struct LightLimitFix : Feature Matrix viewMatrixCached[2]{}; Matrix viewMatrixInverseCached[2]{}; - virtual void SetupResources(); - virtual void Reset(); + 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(); + virtual void RestoreDefaultSettings() override; - virtual void DrawSettings(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); + virtual void DrawSettings() override; virtual void PostPostLoad() override; virtual void DataLoaded() override; @@ -309,7 +308,7 @@ struct LightLimitFix : Feature } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; template <> 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 1ad8ef32c..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 || @@ -26,17 +26,14 @@ 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 inline void Reset() override{}; virtual void SetupResources() override; virtual void ClearShaderCache() override; 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.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 7ddbbdeda..faa64ca35 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 @@ -54,25 +54,22 @@ struct ScreenSpaceShadows : Feature Texture2D* screenSpaceShadowsTexture = nullptr; - virtual void SetupResources(); - virtual void Reset(){}; + virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; virtual void ClearShaderCache() override; ID3D11ComputeShader* GetComputeRaymarch(); ID3D11ComputeShader* GetComputeRaymarchRight(); - virtual void Draw(const RE::BSShader*, const uint32_t){}; - 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(); - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/Skylighting.cpp b/src/Features/Skylighting.cpp index 8056d2d8b..ab9e12eb9 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(); @@ -101,21 +97,14 @@ void Skylighting::SetupResources() } } -void Skylighting::Reset() +void Skylighting::LoadSettings(json& o_json) { + settings = o_json; } -void Skylighting::Load(json& o_json) -{ - if (o_json[GetName()].is_object()) - settings = o_json[GetName()]; - - Feature::Load(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 ebca08abf..fc6b02df0 100644 --- a/src/Features/Skylighting.h +++ b/src/Features/Skylighting.h @@ -14,28 +14,25 @@ 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(); - virtual void Reset(); + virtual void SetupResources() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); - - 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(); virtual void Prepass() override; - virtual void RestoreDefaultSettings(); + virtual void RestoreDefaultSettings() override; ID3D11ComputeShader* GetSkylightingCS(); ID3D11ComputeShader* GetSkylightingShadowMapCS(); diff --git a/src/Features/SubsurfaceScattering.cpp b/src/Features/SubsurfaceScattering.cpp index 924a0451a..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() { { @@ -305,17 +302,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 f9c2a978c..83536e887 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(); - virtual void Reset(); - virtual void RestoreDefaultSettings(); + virtual void SetupResources() override; + virtual void Reset() override; + 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); @@ -83,12 +83,10 @@ struct SubsurfaceScattering : Feature void DrawSSS(); - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - - virtual void ClearShaderCache(); + virtual void ClearShaderCache() override; ID3D11ComputeShader* GetComputeShaderHorizontalBlur(); ID3D11ComputeShader* GetComputeShaderVerticalBlur(); @@ -117,5 +115,5 @@ struct SubsurfaceScattering : Feature } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/TerrainBlending.cpp b/src/Features/TerrainBlending.cpp index 04b754d49..aaefad1ba 100644 --- a/src/Features/TerrainBlending.cpp +++ b/src/Features/TerrainBlending.cpp @@ -3,14 +3,6 @@ #include "State.h" #include "Util.h" -void TerrainBlending::DrawSettings() -{ -} - -void TerrainBlending::Draw(const RE::BSShader*, const uint32_t) -{ -} - ID3D11VertexShader* TerrainBlending::GetTerrainVertexShader() { if (!terrainVertexShader) { @@ -138,23 +130,6 @@ void TerrainBlending::SetupResources() } } -void TerrainBlending::Reset() -{ -} - -void TerrainBlending::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void TerrainBlending::Save(json&) -{ -} - -void TerrainBlending::RestoreDefaultSettings() -{ -} - void TerrainBlending::PostPostLoad() { Hooks::Install(); diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index fb2b494fb..77a87c2d8 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -15,15 +15,10 @@ 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(); - virtual void Reset(); - - virtual void DrawSettings(); - - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); + virtual void SetupResources() override; ID3D11VertexShader* GetTerrainVertexShader(); ID3D11VertexShader* GetTerrainOffsetVertexShader(); @@ -34,10 +29,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; bool renderDepth = false; @@ -73,7 +64,7 @@ struct TerrainBlending : Feature ID3D11ComputeShader* depthBlendShader = nullptr; ID3D11ComputeShader* depthFixShader = nullptr; - virtual void ClearShaderCache(); + virtual void ClearShaderCache() override; struct Hooks { @@ -189,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.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 afbdfe98a..c1edae757 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 || @@ -114,19 +114,15 @@ struct TerrainOcclusion : public Feature virtual void DrawSettings() override; - virtual inline void Reset() override{}; - - virtual void Draw(const RE::BSShader*, const uint32_t) override{}; - virtual void Prepass() override; void LoadHeightmap(); 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; - 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 dd49e107e..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,19 +19,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() -{ -} - bool WaterCaustics::HasShaderDefine(RE::BSShader::Type) { return true; diff --git a/src/Features/WaterCaustics.h b/src/Features/WaterCaustics.h index 3aabc66dd..32400c0ac 100644 --- a/src/Features/WaterCaustics.h +++ b/src/Features/WaterCaustics.h @@ -15,23 +15,13 @@ 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(); - virtual inline void Reset() {} - - virtual void DrawSettings(); - - virtual void Draw(const RE::BSShader*, const uint32_t){}; + virtual void SetupResources() override; virtual void Prepass() override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - - virtual void RestoreDefaultSettings(); - - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WaterParallax.cpp b/src/Features/WaterParallax.cpp index a9b55baaa..f987b4429 100644 --- a/src/Features/WaterParallax.cpp +++ b/src/Features/WaterParallax.cpp @@ -1,33 +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::Load(json& o_json) -{ - Feature::Load(o_json); -} - -void WaterParallax::Save(json&) -{ -} - -void WaterParallax::RestoreDefaultSettings() -{ -} - bool WaterParallax::HasShaderDefine(RE::BSShader::Type) { return true; diff --git a/src/Features/WaterParallax.h b/src/Features/WaterParallax.h index 772e3d9c2..a28cd9a7c 100644 --- a/src/Features/WaterParallax.h +++ b/src/Features/WaterParallax.h @@ -13,20 +13,9 @@ 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(); - virtual inline void Reset() {} - - 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); - - virtual void RestoreDefaultSettings(); - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; }; diff --git a/src/Features/WetnessEffects.cpp b/src/Features/WetnessEffects.cpp index 1754a16f9..48860dfa5 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{}; @@ -348,26 +344,19 @@ WetnessEffects::PerFrame WetnessEffects::GetCommonBufferData() return data; } -void WetnessEffects::SetupResources() -{ -} - 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 12e58576f..cfefcdd0f 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; }; @@ -77,17 +77,14 @@ struct WetnessEffects : Feature uint32_t lastWeatherID = 0; float previousWeatherTransitionPercentage = 0.0f; - virtual void SetupResources(); - virtual void Reset(); + virtual void Reset() override; - virtual void DrawSettings(); + virtual void DrawSettings() override; - virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor); + virtual void LoadSettings(json& o_json) override; + virtual void SaveSettings(json& o_json) override; - virtual void Load(json& o_json); - virtual void Save(json& o_json); - - 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); @@ -100,5 +97,5 @@ struct WetnessEffects : Feature } }; - bool SupportsVR() override { return true; }; + virtual bool SupportsVR() override { return true; }; };