summaryrefslogtreecommitdiff
path: root/shaders/tree_fragment.glsl
blob: 382ab4ea043f0d62b6baf7370486f87466ce3843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#version 120

uniform sampler2D tex;
uniform vec3 player_pos;
varying vec3 normal, pos;

void foggify(vec3 player_pos, vec3 pos);

void main() {
	vec4 color = texture2D(tex, gl_TexCoord[0].st);

	if(color.a < 0.7)
		discard;

	gl_FragColor = color;
	float n = clamp(dot(normal, vec3(0, 0, 1)) + .5, .3, 1);
	gl_FragColor.rgb *= n;

	foggify(player_pos, pos);
}

/* vim: set syn=glsl: */