aboutsummaryrefslogtreecommitdiff
path: root/shaders/main.frag
blob: f69789cc2c01251068a882628bcb3aeaf72ba28e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
varying vec3 norm;
varying vec2 uv;
varying vec3 frag_pos;

uniform sampler2D tex;
uniform bool highlight;

void main() {
	vec3 light_col = vec3(1, .964, .783);
	vec3 ambient = light_col * .2;

	vec3 light_dir = normalize(vec3(5, 10, -8));
	float diff = max(dot(normalize(norm), light_dir), 0.0);
	vec3 diffuse = diff * light_col;

	vec4 col = texture2D(tex, uv) * vec4(ambient + diffuse, 1);

	if (highlight) {
		col = mix(col, vec4(1, 0, 0, 1), .5);
	}
	gl_FragColor = col;
}