fetch the cluster content through a function to be able to change the implementation

This commit is contained in:
samcake 2016-09-14 09:28:51 -07:00
parent c622849481
commit af48d4f0bd
2 changed files with 5 additions and 1 deletions

View file

@ -73,4 +73,8 @@ ivec2 clusterGrid_getCluster(int index) {
return ivec2(numLights, contentOffset);
}
int clusterGrid_getClusterLightId(int index, ivec2 cluster) {
return _clusterGridContent[cluster.y + index];
}
<@endif@>

View file

@ -97,7 +97,7 @@ void main(void) {
// int numLights = lightIndex[0];
for (int i = 0; i < numLights; i++) {
// Need the light now
int theLightIndex = _clusterGridContent[lightClusterOffset + i];
int theLightIndex = clusterGrid_getClusterLightId(i, cluster);
Light light = getLight(theLightIndex);
bool isSpot = light_isSpot(light);
// Clip againgst the light volume and Make the Light vector going from fragment to light center in world space