Now using built-in exp function.

This commit is contained in:
Faerbit 2014-11-19 01:58:25 +01:00
parent 7d0cf9fca2
commit faf548d3ee

View File

@ -40,7 +40,7 @@ void main()
// only take lights into account with meaningful contribution
if (distance > 0.001f) {
vec3 lightVector = normalize(lightSources[i]-vec3(fragPosition));
float intensity = clamp(pow(2.718,(-(1/lightIntensities[i])*distance)), 0.0, 1.0);
float intensity = clamp(exp(-(1/lightIntensities[i])*distance), 0.0, 1.0);
diffuseColor += clamp(dot(normalize(vNormal), lightVector)
*diffuseFactor*intensity*lightColors[i], 0.0, 1.0);
vec3 cameraVector = normalize(camera - vec3(fragPosition));