blob: 0b8146495bcd105ba9bf225826e810416f337eff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#version 330 core
// Ouput data
in vec2 UV;
in vec3 FragmentPos;
in vec3 Normal;
out vec3 color;
uniform sampler2D textureSampler;
void main() {
vec3 light_color_ambient = vec3(0.4, 0.6, 0.9);
vec3 light_color_diffuse = vec3(0.8, 1.0, 1.0);
vec3 lightpos = vec3(16, 26, 32);
float ambient_strength = 0.3;
vec3 ambient = ambient_strength * light_color_ambient;
vec3 norm = normalize(Normal);
vec3 light_dir = normalize(lightpos - FragmentPos);
float diff = max(dot(norm, light_dir), 0.0);
vec3 diffuse = diff * light_color_diffuse;
color = (ambient + diffuse) * texture(textureSampler, UV).rgb;
}
|