lightResult.xyz += diffuseLight * shadowing - diffuseLight; // This light gets added a second time in the loop to fix Mesa users' slowdown, so we need to negate its contribution here.
#else
shadowDiffuse = diffuseLight;
lightResult.xyz += ambientLight;
lightResult.xyz -= shadowDiffuse; // This light gets added a second time in the loop to fix Mesa users' slowdown, so we need to negate its contribution here.
#endif
for (int i=1; i<MAX_LIGHTS; ++i)
for (int i=0; i<MAX_LIGHTS; ++i)
{
perLight(ambientLight, diffuseLight, i, viewPos, viewNormal, diffuse, ambient);