blob: a323cc87978c715fa0be91464a0d106e084c2c97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
uniform sampler2D texture_data;
uniform vec2 texture_scale;
uniform vec2 texture_offset;
uniform float fog_distance;
uniform vec3 fog_color;
uniform float opacity;
in float vertex_depth;
void main()
{
vec2 tcfull = vec2(vertex_texcoord.x, 1.0 - vertex_texcoord.y);
vec4 texel = texture(texture_data, tcfull * texture_scale + texture_offset);
if (fog_distance > 0.0) {
float t = clamp(vertex_depth / fog_distance, 0.0, 1.0);
texel.rgb = mix(texel.rgb, fog_color, t);
if (t == 1.0) texel.a = 1.0;
}
texel.a *= opacity;
if (texel.a == 0.0) discard;
frag_color = texel;
}
|