From a0f764a774580b916c7e3c9d94adbe712f152ceb Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 21 Sep 2025 21:58:03 +0200 Subject: [PATCH] Add skybox rotation feature #3592 --- Content/Engine/SkyboxMaterial.flax | 4 ++-- Source/Engine/Level/Actors/Skybox.cpp | 2 ++ Source/Engine/Level/Actors/Skybox.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Content/Engine/SkyboxMaterial.flax b/Content/Engine/SkyboxMaterial.flax index 8882f13ec..7f9545007 100644 --- a/Content/Engine/SkyboxMaterial.flax +++ b/Content/Engine/SkyboxMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e47dc45042b8b802c6b7dec8ffeab7feb761c7b31a116031fa6db5d6d41f7855 -size 31070 +oid sha256:98a0d6b06a90d753e68638ac64836cb96e6edc90e5b13770b722f33512034c09 +size 31650 diff --git a/Source/Engine/Level/Actors/Skybox.cpp b/Source/Engine/Level/Actors/Skybox.cpp index 6bfc98723..e08d8a61a 100644 --- a/Source/Engine/Level/Actors/Skybox.cpp +++ b/Source/Engine/Level/Actors/Skybox.cpp @@ -129,6 +129,7 @@ void Skybox::ApplySky(GPUContext* context, RenderContext& renderContext, const M material->SetParameterValue(TEXT("PanoramicTexture"), PanoramicTexture.Get(), false); material->SetParameterValue(TEXT("Color"), Color * Math::Exp2(Exposure), false); material->SetParameterValue(TEXT("IsPanoramic"), PanoramicTexture != nullptr, false); + material->SetParameterValue(TEXT("RotationEuler"), _rotationEuler, false); material->Bind(bindParams); } } @@ -163,4 +164,5 @@ void Skybox::OnTransformChanged() _box = BoundingBox(_transform.Translation); _sphere = BoundingSphere(_transform.Translation, 0.0f); + _rotationEuler = GetOrientation().GetEuler() * DegreesToRadians; } diff --git a/Source/Engine/Level/Actors/Skybox.h b/Source/Engine/Level/Actors/Skybox.h index f571a211f..fb831df44 100644 --- a/Source/Engine/Level/Actors/Skybox.h +++ b/Source/Engine/Level/Actors/Skybox.h @@ -18,6 +18,7 @@ class FLAXENGINE_API Skybox : public Actor, public ISkyRenderer private: AssetReference _proxyMaterial; int32 _sceneRenderingKey = -1; + Float3 _rotationEuler; public: ///