prevent point lights from overflowing shader
parent
d156fbc39a
commit
55b1555df2
|
@ -2,6 +2,7 @@ namespace Kav
|
||||||
{
|
{
|
||||||
public interface PointLightEffect
|
public interface PointLightEffect
|
||||||
{
|
{
|
||||||
PointLightCollection PointLights { get; } // TODO: should be a collection class?
|
int MaxPointLights { get; }
|
||||||
|
PointLightCollection PointLights { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,8 @@ namespace Kav
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MaxPointLights { get; } = 4;
|
||||||
|
|
||||||
public PointLightCollection PointLights
|
public PointLightCollection PointLights
|
||||||
{
|
{
|
||||||
get { return pointLightCollection; }
|
get { return pointLightCollection; }
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace Kav
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var pointLight in pointLights)
|
foreach (var pointLight in pointLights)
|
||||||
{
|
{
|
||||||
|
if (i > pointLightEffect.MaxPointLights) { break; }
|
||||||
pointLightEffect.PointLights[i] = pointLight;
|
pointLightEffect.PointLights[i] = pointLight;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue