Apply brush rotation to base spotlight direction

This commit is contained in:
Jarrod Doyle 2024-12-10 19:51:08 +00:00
parent 29b1c78782
commit fc91970c45
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 7 additions and 7 deletions

View File

@ -218,19 +218,19 @@ public class LightMapper
var propModelName = _hierarchy.GetProperty<PropLabel>(id, "P$ModelName"); var propModelName = _hierarchy.GetProperty<PropLabel>(id, "P$ModelName");
propLightColor ??= new PropLightColor { Hue = 0, Saturation = 0 }; propLightColor ??= new PropLightColor { Hue = 0, Saturation = 0 };
var baseLight = new Light
{
Position = brush.position,
SpotlightDir = -Vector3.UnitZ,
SpotlightInnerAngle = -1.0f,
};
// TODO: Also apply scale? // TODO: Also apply scale?
var rot = Matrix4x4.Identity; var rot = Matrix4x4.Identity;
rot *= Matrix4x4.CreateRotationX(float.DegreesToRadians(brush.angle.X)); rot *= Matrix4x4.CreateRotationX(float.DegreesToRadians(brush.angle.X));
rot *= Matrix4x4.CreateRotationY(float.DegreesToRadians(brush.angle.Y)); rot *= Matrix4x4.CreateRotationY(float.DegreesToRadians(brush.angle.Y));
rot *= Matrix4x4.CreateRotationZ(float.DegreesToRadians(brush.angle.Z)); 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) if (propModelName != null)
{ {