2022-01-27 23:56:43 +01:00
|
|
|
#version 410 core
|
|
|
|
|
|
|
|
uniform sampler2D textureSampler;
|
|
|
|
uniform vec3 lightDir;
|
|
|
|
|
|
|
|
in vec3 interpNormal;
|
|
|
|
in vec2 interpTexCoord;
|
2022-02-13 01:51:44 +01:00
|
|
|
in vec3 fragPos;
|
2022-01-27 23:56:43 +01:00
|
|
|
|
2022-02-02 00:25:38 +01:00
|
|
|
in float visibility;
|
|
|
|
|
2022-02-13 01:51:44 +01:00
|
|
|
//vec4(0.0175,0.4716,0.5109,1.0)
|
|
|
|
|
2022-01-27 23:56:43 +01:00
|
|
|
void main()
|
|
|
|
{
|
2022-02-13 01:51:44 +01:00
|
|
|
|
|
|
|
|
2022-02-02 00:25:38 +01:00
|
|
|
vec2 modifiedTexCoord = vec2(interpTexCoord.x, 1.0 - interpTexCoord.y);
|
2022-02-13 01:51:44 +01:00
|
|
|
|
2022-01-27 23:56:43 +01:00
|
|
|
vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb;
|
2022-02-13 01:51:44 +01:00
|
|
|
|
2022-01-27 23:56:43 +01:00
|
|
|
vec3 normal = normalize(interpNormal);
|
|
|
|
float ambient = 0.2;
|
|
|
|
float diffuse = max(dot(normal, -lightDir), 0.0);
|
2022-02-02 00:25:38 +01:00
|
|
|
|
2022-02-13 01:51:44 +01:00
|
|
|
gl_FragColor = vec4(color * (ambient + (1-ambient) * diffuse), 1.0);
|
2022-02-02 00:25:38 +01:00
|
|
|
|
2022-02-13 01:51:44 +01:00
|
|
|
gl_FragColor = mix(vec4(0.0175,0.4716,0.5109,1), gl_FragColor, visibility);
|
2022-01-27 23:56:43 +01:00
|
|
|
}
|