From 2e983006939772040a25e97e1a0293f4ef1baf74 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 4 May 2026 08:47:21 +0200 Subject: [PATCH] Add minor changes --- Source/Engine/Core/Math/Double4x4.h | 32 +++++++++++++++++++++++++++ Source/Engine/Core/Math/Matrix.cpp | 8 +++++++ Source/Engine/Renderer/RenderList.cpp | 12 ++++++++++ Source/Engine/Renderer/RenderList.h | 4 ++++ 4 files changed, 56 insertions(+) diff --git a/Source/Engine/Core/Math/Double4x4.h b/Source/Engine/Core/Math/Double4x4.h index b8a20bf67..dbea17c41 100644 --- a/Source/Engine/Core/Math/Double4x4.h +++ b/Source/Engine/Core/Math/Double4x4.h @@ -66,6 +66,12 @@ public: double Values[4][4]; double Raw[16]; }; +public: + /// A matrix with all of its components set to zero. + static const Double4x4 Zero; + + /// The identity matrix. + static const Double4x4 Identity; public: /// @@ -73,6 +79,32 @@ public: /// Double4x4() = default; + /// + /// Initializes a new instance of the struct. + /// + Double4x4(double m11, double m12, double m13, double m14, + double m21, double m22, double m23, double m24, + double m31, double m32, double m33, double m34, + double m41, double m42, double m43, double m44) + : M11(m11) + , M12(m12) + , M13(m13) + , M14(m14) + , M21(m21) + , M22(m22) + , M23(m23) + , M24(m24) + , M31(m31) + , M32(m32) + , M33(m33) + , M34(m34) + , M41(m41) + , M42(m42) + , M43(m43) + , M44(m44) + { + } + Double4x4(const Matrix& matrix); public: diff --git a/Source/Engine/Core/Math/Matrix.cpp b/Source/Engine/Core/Math/Matrix.cpp index 4a73323d3..f8ee50c42 100644 --- a/Source/Engine/Core/Math/Matrix.cpp +++ b/Source/Engine/Core/Math/Matrix.cpp @@ -10,6 +10,7 @@ #include "../Types/String.h" static_assert(sizeof(Matrix) == 4 * 4 * 4, "Invalid Matrix type size."); +static_assert(sizeof(Double4x4) == 8 * 4 * 4, "Invalid Double4x4 type size."); const Matrix Matrix::Zero(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); const Matrix Matrix::Identity( @@ -18,6 +19,13 @@ const Matrix Matrix::Identity( 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); +const Double4x4 Double4x4::Zero(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); +const Double4x4 Double4x4::Identity( + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0); + Matrix::Matrix(const Matrix3x3& matrix) { Platform::MemoryCopy(&M11, &matrix.M11, sizeof(Float3)); diff --git a/Source/Engine/Renderer/RenderList.cpp b/Source/Engine/Renderer/RenderList.cpp index d0d33077e..6515d0ecc 100644 --- a/Source/Engine/Renderer/RenderList.cpp +++ b/Source/Engine/Renderer/RenderList.cpp @@ -97,6 +97,18 @@ bool RenderLightData::CanRenderShadow(const RenderView& view) const return result && ShadowsStrength > ZeroTolerance; } +#if !BUILD_RELEASE + +#include "Engine/Level/Actors/Light.h" +#include "Engine/Scripting/Scripting.h" + +Light* RenderLightData::GetActor() const +{ + return Scripting::TryFindObject(ID); +} + +#endif + void RenderDirectionalLightData::SetShaderData(ShaderLightData& data, bool useShadow) const { data.SpotAngles.X = -2.0f; diff --git a/Source/Engine/Renderer/RenderList.h b/Source/Engine/Renderer/RenderList.h index 8e64e072b..8041141b1 100644 --- a/Source/Engine/Renderer/RenderList.h +++ b/Source/Engine/Renderer/RenderList.h @@ -64,6 +64,10 @@ struct RenderLightData int32 ShadowsResolution; bool CanRenderShadow(const RenderView& view) const; +#if !BUILD_RELEASE + // Development-only, gets the actor that produced this light (from ID). + Light* GetActor() const; +#endif }; struct RenderDirectionalLightData : RenderLightData