]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - shaders/3d/entity/fragment.glsl
Include pthread_time on windows for clock_gettime
[dragonblocks_alpha.git] / shaders / 3d / entity / fragment.glsl
1 in vec3 fragmentPosition;
2 in vec3 fragmentTextureCoordinates;
3 in float fragmentLight;
4
5 out vec4 outColor;
6
7 uniform vec3 fogColor;
8 uniform vec3 cameraPos;
9 uniform samplerCube texture0;
10
11 void main()
12 {
13         outColor = texture(texture0, fragmentTextureCoordinates) * vec4(vec3(fragmentLight), 1.0);
14         outColor.rgb = mix(outColor.rgb, fogColor, clamp(length(fragmentPosition - cameraPos) / VIEW_DISTANCE, 0.0, 1.0));
15
16         if (outColor.a == 0.0)
17                 discard;
18 }