made fshader.glsl compatible with older versions
This commit is contained in:
parent
fb49d8685a
commit
fe374cb8f6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user