Skip to content

Commit e658373

Browse files
committed
Fix r_showLightTiles GLSL code
1 parent 0fa128f commit e658373

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/engine/renderer/glsl_source/computeLight_fp.glsl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ void computeDynamicLights( vec3 P, vec3 normal, vec3 viewDir, vec4 diffuse, vec4
227227
return;
228228
}
229229

230+
#if defined(r_showLightTiles)
231+
uint totalLights = 0u;
232+
#endif
233+
230234
vec2 tile = floor( gl_FragCoord.xy * ( 1.0 / float( TILE_SIZE ) ) ) + 0.5;
231235

232236
for( uint layer = 0u; layer < uint( NUM_LIGHT_LAYERS ); layer++ ) {
@@ -247,12 +251,15 @@ void computeDynamicLights( vec3 P, vec3 normal, vec3 viewDir, vec4 diffuse, vec4
247251
computeDynamicLight( idx, P, normal, viewDir, diffuse, material, color );
248252
lightCount++;
249253
}
254+
#if defined(r_showLightTiles)
255+
totalLights += lightCount;
256+
#endif
250257
}
251258

252259
#if defined(r_showLightTiles)
253-
if ( lightCount > 0 ) {
254-
color = vec4( float( lightCount ) / u_numLights, float( lightCount ) / u_numLights,
255-
float( lightCount ) / u_numLights, 1.0 );
260+
if ( totalLights > 0 ) {
261+
color = vec4( float( totalLights ) / u_numLights, float( totalLights ) / u_numLights,
262+
float( totalLights ) / u_numLights, 1.0 );
256263
}
257264
#endif
258265
}

0 commit comments

Comments
 (0)