Commit fe374cb8 authored by Anakin's avatar Anakin

made fshader.glsl compatible with older versions

parent fb49d868
......@@ -39,7 +39,7 @@ void main()
vec3 surfaceToLight;
float attenuation;
// directional light
if(light.position.w == 0)
if(light.position.w == 0.0f)
{
surfaceToLight = normalize(light.position.xyz);
}
......@@ -65,9 +65,12 @@ void main()
float specularCoefficient = 0.0;
if(diffuseCoefficient > 0.0)
specularCoefficient = pow(max(0.0, dot(surfaceToCamera, reflect(-surfaceToLight, normalWorld))), materialShininess);
vec3 specColor;
if(b_specular)
materialSpecularColor = vec3(surfaceColor.a);
vec3 specular = specularCoefficient * materialSpecularColor * light.intensities;
specColor = vec3(surfaceColor.a);
else
specColor = materialSpecularColor;
vec3 specular = specularCoefficient * specColor * light.intensities;
// linear color before gamma correction)
vec3 linearColor = ambient + attenuation * (diffuse + specular);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment