From ef25a932b5d666f6aa65a8aa224d2c0647929770 Mon Sep 17 00:00:00 2001 From: antopilo Date: Sun, 1 Dec 2024 12:15:27 -0500 Subject: [PATCH] Now serializing all environment settings + optimized transform system --- Nuake/src/Scene/Lighting/Environment.cpp | 47 ++++++++++++++++++++- Nuake/src/Scene/Systems/AnimationSystem.cpp | 1 - Nuake/src/Scene/Systems/TransformSystem.cpp | 2 +- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/Nuake/src/Scene/Lighting/Environment.cpp b/Nuake/src/Scene/Lighting/Environment.cpp index ccd2b3b5..e95780f8 100644 --- a/Nuake/src/Scene/Lighting/Environment.cpp +++ b/Nuake/src/Scene/Lighting/Environment.cpp @@ -2,7 +2,7 @@ #include "Environment.h" #include "src/Core/Core.h" - +#include "src/Rendering/Textures/TextureManager.h" namespace Nuake { @@ -88,6 +88,8 @@ namespace Nuake SERIALIZE_VAL(BloomEnabled); SERIALIZE_VAL_LBL("BloomThreshold", mBloom->GetThreshold()); SERIALIZE_VAL_LBL("BloomIteration", mBloom->GetIteration()); + SERIALIZE_VAL_LBL("BloomDirtTexture", mBloom->GetLensDirt() ? mBloom->GetLensDirt()->GetPath() : ""); + SERIALIZE_VAL_LBL("BloomDirtIntensity", mBloom->GetLensDirtIntensity()); // Volumetric SERIALIZE_VAL(VolumetricEnabled); @@ -116,6 +118,13 @@ namespace Nuake // DOF SERIALIZE_VAL(DOFEnabled); + SERIALIZE_VAL(DOFAutoFocus); + SERIALIZE_VAL(DOFFocalDepth); + SERIALIZE_VAL(DOFManualFocus); + SERIALIZE_VAL(DOFDist); + SERIALIZE_VAL(DOFStart); + SERIALIZE_VAL(DOFFocalLength); + SERIALIZE_VAL(DOFShowFocus); // Barrel distortion SERIALIZE_VAL(BarrelDistortionEnabled); @@ -131,6 +140,12 @@ namespace Nuake SERIALIZE_VAL(AmbientTerm); SERIALIZE_VEC4(AmbientColor); + SERIALIZE_VAL(PosterizationEnabled); + SERIALIZE_VAL(PosterizationLevels); + + SERIALIZE_VAL(PixelizationEnabled); + SERIALIZE_VAL(PixelSize); + SERIALIZE_OBJECT(ProceduralSkybox); END_SERIALIZE(); } @@ -175,6 +190,21 @@ namespace Nuake mBloom->SetIteration(j["BloomIteration"]); } + if(j.contains("BloomDirtTexture")) + { + std::string texturePath = j["BloomDirtTexture"]; + if (!texturePath.empty()) + { + Ref lensDirtTexture = TextureManager::Get()->GetTexture(texturePath); + mBloom->SetLensDirt(lensDirtTexture); + } + } + + if (j.contains("BloomDirtIntensity")) + { + mBloom->SetLensDirtIntensity(j["BloomDirtIntensity"]); + } + // SSR if (j.contains("SSREnabled")) { @@ -279,6 +309,13 @@ namespace Nuake DOFEnabled = j["DOFEnabled"]; } + DESERIALIZE_VAL(DOFAutoFocus); + DESERIALIZE_VAL(DOFManualFocus); + DESERIALIZE_VAL(DOFFocalDepth); + DESERIALIZE_VAL(DOFFocalLength); + DESERIALIZE_VAL(DOFStart); + DESERIALIZE_VAL(DOFDist); + // Barrel distortion if (j.contains("BarrelDistortionEnabled")) { @@ -316,6 +353,14 @@ namespace Nuake VignetteIntensity = j["VignetteIntensity"]; } + DESERIALIZE_VAL(PosterizationEnabled); + DESERIALIZE_VAL(PosterizationLevels); + + DESERIALIZE_VAL(PixelizationEnabled); + DESERIALIZE_VAL(PixelSize); + + + return false; } } diff --git a/Nuake/src/Scene/Systems/AnimationSystem.cpp b/Nuake/src/Scene/Systems/AnimationSystem.cpp index 7ff1f244..9266dcbf 100644 --- a/Nuake/src/Scene/Systems/AnimationSystem.cpp +++ b/Nuake/src/Scene/Systems/AnimationSystem.cpp @@ -57,7 +57,6 @@ namespace Nuake anim->SetCurrentTime(animTime); model->SetCurrentBlendTime(blendWeight - ts); - Logger::Log("Blend time: " + std::to_string(model->GetCurrentBlendTime())); prevAnimTime = prevAnim->GetCurrentTime() + (ts * prevAnim->GetTicksPerSecond()); prevAnim->SetCurrentTime(prevAnimTime); } diff --git a/Nuake/src/Scene/Systems/TransformSystem.cpp b/Nuake/src/Scene/Systems/TransformSystem.cpp index 30ec2283..5ad24076 100644 --- a/Nuake/src/Scene/Systems/TransformSystem.cpp +++ b/Nuake/src/Scene/Systems/TransformSystem.cpp @@ -54,7 +54,7 @@ namespace Nuake const Matrix4& newLocalTransform = translationMatrix * rotationMatrix * scaleMatrix; transform.GlobalDirty = true; - UpdateDirtyFlagRecursive(currentEntity); + //UpdateDirtyFlagRecursive(currentEntity); transform.SetLocalTransform(newLocalTransform); transform.Dirty = false;