prevent point lights from overflowing shader

shadows
cosmonaut 2020-08-06 01:12:15 -07:00
parent d156fbc39a
commit 55b1555df2
3 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ namespace Kav
{
public interface PointLightEffect
{
PointLightCollection PointLights { get; } // TODO: should be a collection class?
int MaxPointLights { get; }
PointLightCollection PointLights { get; }
}
}

View File

@ -117,6 +117,8 @@ namespace Kav
}
}
public int MaxPointLights { get; } = 4;
public PointLightCollection PointLights
{
get { return pointLightCollection; }

View File

@ -30,6 +30,7 @@ namespace Kav
int i = 0;
foreach (var pointLight in pointLights)
{
if (i > pointLightEffect.MaxPointLights) { break; }
pointLightEffect.PointLights[i] = pointLight;
i++;
}