From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 10 Mar 2025 04:38:33 +0000 (+1100) Subject: Tweak sun shadow rotations (#35758) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=70fca49063a9c9b86bbf1e54c05806e6badb67e1;p=space-station-14.git Tweak sun shadow rotations (#35758) Won't use the entity's rotation for the matrix, I just forgot to do this. Means shadows will always point in the same direction and the points will correctly adjust as the entity rotates. --- diff --git a/Content.Client/Light/SunShadowOverlay.cs b/Content.Client/Light/SunShadowOverlay.cs index 38bb927676..a296f95479 100644 --- a/Content.Client/Light/SunShadowOverlay.cs +++ b/Content.Client/Light/SunShadowOverlay.cs @@ -114,7 +114,9 @@ public sealed class SunShadowOverlay : Overlay foreach (var ent in _shadows) { var xform = _entManager.GetComponent(ent.Owner); - var worldMatrix = _xformSys.GetWorldMatrix(xform); + var (worldPos, worldRot) = _xformSys.GetWorldPositionRotation(xform); + // Need no rotation on matrix as sun shadow direction doesn't care. + var worldMatrix = Matrix3x2.CreateTranslation(worldPos); var renderMatrix = Matrix3x2.Multiply(worldMatrix, invMatrix); var pointCount = ent.Comp.Points.Length; @@ -122,6 +124,10 @@ public sealed class SunShadowOverlay : Overlay for (var i = 0; i < pointCount; i++) { + // Update point based on entity rotation. + indices[i] = worldRot.RotateVec(indices[i]); + + // Add the offset point by the sun shadow direction. indices[pointCount + i] = indices[i] + direction; }