fix intensity calculation

shadows
Evan Hemsley 2020-08-05 15:09:48 -07:00
parent f0f09115f5
commit 2419a89d32
1 changed files with 8 additions and 4 deletions

View File

@ -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);
}