mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 19:13:38 +02:00
Simple change to the get cluster interface
This commit is contained in:
parent
92dbba0c8c
commit
c72b330821
3 changed files with 6 additions and 7 deletions
|
@ -69,8 +69,8 @@ ivec3 clusterGrid_getCluster(int index) {
|
|||
return ivec3(numPointLights, numSpotLights, contentOffset);
|
||||
}
|
||||
|
||||
int clusterGrid_getClusterLightId(int index, ivec2 cluster) {
|
||||
int arrayElement = cluster.y + index;
|
||||
int clusterGrid_getClusterLightId(int index, int offset) {
|
||||
int arrayElement = offset + index;
|
||||
int element = _clusterGridContent[arrayElement];
|
||||
return element;
|
||||
// int element = _clusterGridContent[arrayElement >> 1];
|
||||
|
|
|
@ -44,7 +44,7 @@ void main(void) {
|
|||
int numLights = cluster.x + cluster.y;
|
||||
float numLightsScale = clamp(numLights * 0.05, 0.01, 1.0);
|
||||
|
||||
ivec2 clusterAddress = ivec2(numLights, cluster.z);
|
||||
int clusterOffset = cluster.z;
|
||||
|
||||
ivec3 dims = frustumGrid.dims.xyz;
|
||||
dims.z +=1;
|
||||
|
@ -67,7 +67,7 @@ void main(void) {
|
|||
int numLightTouching = 0;
|
||||
for (int i = 0; i < numLights; i++) {
|
||||
// Need the light now
|
||||
int theLightIndex = clusterGrid_getClusterLightId(i, clusterAddress);
|
||||
int theLightIndex = clusterGrid_getClusterLightId(i, clusterOffset);
|
||||
Light light = getLight(theLightIndex);
|
||||
|
||||
// Clip againgst the light volume and Make the Light vector going from fragment to light center in world space
|
||||
|
|
|
@ -65,7 +65,6 @@ void main(void) {
|
|||
discard;
|
||||
}
|
||||
int lightClusterOffset = cluster.z;
|
||||
ivec2 clusterAddress = ivec2(numLights, lightClusterOffset);
|
||||
|
||||
ivec3 dims = frustumGrid.dims.xyz;
|
||||
if (clusterPos.x < 0 || clusterPos.x >= dims.x) {
|
||||
|
@ -97,7 +96,7 @@ void main(void) {
|
|||
int numLightTouching = 0;
|
||||
for (int i = 0; i < cluster.x; i++) {
|
||||
// Need the light now
|
||||
int theLightIndex = clusterGrid_getClusterLightId(i, clusterAddress);
|
||||
int theLightIndex = clusterGrid_getClusterLightId(i, lightClusterOffset);
|
||||
Light light = getLight(theLightIndex);
|
||||
|
||||
// Clip againgst the light volume and Make the Light vector going from fragment to light center in world space
|
||||
|
@ -145,7 +144,7 @@ void main(void) {
|
|||
|
||||
for (int i = cluster.x; i < numLights; i++) {
|
||||
// Need the light now
|
||||
int theLightIndex = clusterGrid_getClusterLightId(i, clusterAddress);
|
||||
int theLightIndex = clusterGrid_getClusterLightId(i, lightClusterOffset);
|
||||
Light light = getLight(theLightIndex);
|
||||
|
||||
// Clip againgst the light volume and Make the Light vector going from fragment to light center in world space
|
||||
|
|
Loading…
Reference in a new issue