From 2419a89d3245dc7d52f6b4301902f840ea10beaf Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Wed, 5 Aug 2020 15:09:48 -0700 Subject: [PATCH] fix intensity calculation --- Effects/PBREffect.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Effects/PBREffect.cs b/Effects/PBREffect.cs index daf85b1..efe9cd2 100644 --- a/Effects/PBREffect.cs +++ b/Effects/PBREffect.cs @@ -7,6 +7,7 @@ namespace Kav { private readonly Vector3[] positions = new Vector3[4]; private readonly Vector3[] colors = new Vector3[4]; + private readonly float[] intensities = new float[4]; readonly EffectParameter lightPositionsParam; readonly EffectParameter lightColorsParam; @@ -21,20 +22,23 @@ namespace Kav { get { + var color = colors[i] / intensities[i]; return new PointLight( positions[i], new Color( - colors[i].X, - colors[i].Y, - colors[i].Z, + color.X, + color.Y, + color.Z, 1f - ) + ), + intensities[i] ); } set { positions[i] = value.Position; colors[i] = value.Color.ToVector3() * value.Intensity; + intensities[i] = value.Intensity; lightPositionsParam.SetValue(positions); lightColorsParam.SetValue(colors); }