fix intensity calculation
parent
f0f09115f5
commit
2419a89d32
|
@ -7,6 +7,7 @@ namespace Kav
|
||||||
{
|
{
|
||||||
private readonly Vector3[] positions = new Vector3[4];
|
private readonly Vector3[] positions = new Vector3[4];
|
||||||
private readonly Vector3[] colors = new Vector3[4];
|
private readonly Vector3[] colors = new Vector3[4];
|
||||||
|
private readonly float[] intensities = new float[4];
|
||||||
|
|
||||||
readonly EffectParameter lightPositionsParam;
|
readonly EffectParameter lightPositionsParam;
|
||||||
readonly EffectParameter lightColorsParam;
|
readonly EffectParameter lightColorsParam;
|
||||||
|
@ -21,20 +22,23 @@ namespace Kav
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
var color = colors[i] / intensities[i];
|
||||||
return new PointLight(
|
return new PointLight(
|
||||||
positions[i],
|
positions[i],
|
||||||
new Color(
|
new Color(
|
||||||
colors[i].X,
|
color.X,
|
||||||
colors[i].Y,
|
color.Y,
|
||||||
colors[i].Z,
|
color.Z,
|
||||||
1f
|
1f
|
||||||
)
|
),
|
||||||
|
intensities[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
positions[i] = value.Position;
|
positions[i] = value.Position;
|
||||||
colors[i] = value.Color.ToVector3() * value.Intensity;
|
colors[i] = value.Color.ToVector3() * value.Intensity;
|
||||||
|
intensities[i] = value.Intensity;
|
||||||
lightPositionsParam.SetValue(positions);
|
lightPositionsParam.SetValue(positions);
|
||||||
lightColorsParam.SetValue(colors);
|
lightColorsParam.SetValue(colors);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue