From fc91970c450591932a7fef305ba7c2e95f080e10 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 10 Dec 2024 19:51:08 +0000 Subject: [PATCH] Apply brush rotation to base spotlight direction --- KeepersCompound.Lightmapper/LightMapper.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/KeepersCompound.Lightmapper/LightMapper.cs b/KeepersCompound.Lightmapper/LightMapper.cs index 20fd290..8bc9632 100644 --- a/KeepersCompound.Lightmapper/LightMapper.cs +++ b/KeepersCompound.Lightmapper/LightMapper.cs @@ -218,19 +218,19 @@ public class LightMapper var propModelName = _hierarchy.GetProperty(id, "P$ModelName"); propLightColor ??= new PropLightColor { Hue = 0, Saturation = 0 }; - - var baseLight = new Light - { - Position = brush.position, - SpotlightDir = -Vector3.UnitZ, - SpotlightInnerAngle = -1.0f, - }; // TODO: Also apply scale? var rot = Matrix4x4.Identity; rot *= Matrix4x4.CreateRotationX(float.DegreesToRadians(brush.angle.X)); rot *= Matrix4x4.CreateRotationY(float.DegreesToRadians(brush.angle.Y)); rot *= Matrix4x4.CreateRotationZ(float.DegreesToRadians(brush.angle.Z)); + + var baseLight = new Light + { + Position = brush.position, + SpotlightDir = Vector3.Transform(-Vector3.UnitZ, rot), + SpotlightInnerAngle = -1.0f, + }; if (propModelName != null) {