|
|
@ -20,9 +20,7 @@ vec4 doLighting(vec3 viewPos, vec3 viewNormal, vec4 vertexColor)
|
|
|
|
d = length(lightDir);
|
|
|
|
d = length(lightDir);
|
|
|
|
lightDir = normalize(lightDir);
|
|
|
|
lightDir = normalize(lightDir);
|
|
|
|
|
|
|
|
|
|
|
|
lightResult.xyz += ambient * gl_LightSource[i].ambient.xyz;
|
|
|
|
lightResult.xyz += (ambient * gl_LightSource[i].ambient.xyz + diffuse.xyz * gl_LightSource[i].diffuse.xyz * max(dot(viewNormal.xyz, lightDir), 0.0)) * clamp(1.0 / (gl_LightSource[i].constantAttenuation + gl_LightSource[i].linearAttenuation * d + gl_LightSource[i].quadraticAttenuation * d * d), 0.0, 1.0);
|
|
|
|
lightResult.xyz += diffuse.xyz * gl_LightSource[i].diffuse.xyz * clamp(1.0 / (gl_LightSource[i].constantAttenuation + gl_LightSource[i].linearAttenuation * d + gl_LightSource[i].quadraticAttenuation * d * d), 0.0, 1.0)
|
|
|
|
|
|
|
|
* max(dot(viewNormal.xyz, lightDir), 0.0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lightResult.xyz += gl_LightModel.ambient.xyz * ambient;
|
|
|
|
lightResult.xyz += gl_LightModel.ambient.xyz * ambient;
|
|
|
|