Simplify light strength ratio calculation
This commit is contained in:
parent
ef95b07926
commit
3df1b728e6
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue