made fshader.glsl compatible with older versions
This commit is contained in:
parent
fb49d8685a
commit
fe374cb8f6
|
@ -39,7 +39,7 @@ void main()
|
||||||
vec3 surfaceToLight;
|
vec3 surfaceToLight;
|
||||||
float attenuation;
|
float attenuation;
|
||||||
// directional light
|
// directional light
|
||||||
if(light.position.w == 0)
|
if(light.position.w == 0.0f)
|
||||||
{
|
{
|
||||||
surfaceToLight = normalize(light.position.xyz);
|
surfaceToLight = normalize(light.position.xyz);
|
||||||
}
|
}
|
||||||
|
@ -65,9 +65,12 @@ void main()
|
||||||
float specularCoefficient = 0.0;
|
float specularCoefficient = 0.0;
|
||||||
if(diffuseCoefficient > 0.0)
|
if(diffuseCoefficient > 0.0)
|
||||||
specularCoefficient = pow(max(0.0, dot(surfaceToCamera, reflect(-surfaceToLight, normalWorld))), materialShininess);
|
specularCoefficient = pow(max(0.0, dot(surfaceToCamera, reflect(-surfaceToLight, normalWorld))), materialShininess);
|
||||||
|
vec3 specColor;
|
||||||
if(b_specular)
|
if(b_specular)
|
||||||
materialSpecularColor = vec3(surfaceColor.a);
|
specColor = vec3(surfaceColor.a);
|
||||||
vec3 specular = specularCoefficient * materialSpecularColor * light.intensities;
|
else
|
||||||
|
specColor = materialSpecularColor;
|
||||||
|
vec3 specular = specularCoefficient * specColor * light.intensities;
|
||||||
|
|
||||||
// linear color before gamma correction)
|
// linear color before gamma correction)
|
||||||
vec3 linearColor = ambient + attenuation * (diffuse + specular);
|
vec3 linearColor = ambient + attenuation * (diffuse + specular);
|
||||||
|
|
Loading…
Reference in New Issue