From 3df1b728e6b4396175cf4455bb78fe69ec985d2d Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sun, 27 Oct 2024 08:54:52 +0000 Subject: [PATCH] Simplify light strength ratio calculation --- KeepersCompound.LGS/Database/Chunks/WorldRep.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/KeepersCompound.LGS/Database/Chunks/WorldRep.cs b/KeepersCompound.LGS/Database/Chunks/WorldRep.cs index 5e3e35f..4b797b7 100644 --- a/KeepersCompound.LGS/Database/Chunks/WorldRep.cs +++ b/KeepersCompound.LGS/Database/Chunks/WorldRep.cs @@ -260,12 +260,7 @@ public class WorldRep : IChunk // the hue/saturation of coloured lights. Got to make sure we // maintain the colour ratios. var c = color * strength; - var ratio = 0.0f; - foreach (var e in new float[] { c.X, c.Y, c.Z }) - { - ratio = Math.Max(ratio, e / 255.0f); - } - + var ratio = Math.Max(Math.Max(Math.Max(0.0f, c.X), c.Y), c.Z) / 255.0f; if (ratio > 1.0f) { c /= ratio;