fix intensity calculation
parent
f0f09115f5
commit
2419a89d32
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue