ttt3d/assets/shaders/fragment_shader.glsl

16 lines
292 B
Plaintext
Raw Normal View History

2018-12-17 10:27:54 +00:00
#version 330 core
2018-12-17 14:38:39 +00:00
uniform vec3 light_dir;
2018-12-17 10:27:54 +00:00
in vec3 frag_col;
2018-12-17 14:38:39 +00:00
in vec3 frag_pos;
in vec3 normal;
2018-12-17 10:27:54 +00:00
out vec3 col;
void main() {
2018-12-17 14:38:39 +00:00
vec3 norm = normalize(normal);
vec3 lightDir = normalize(-light_dir);
float diff = max(dot(norm, lightDir), 0.0);
vec3 diffuse = diff * frag_col;
col = diffuse;
2018-12-17 10:27:54 +00:00
}