2018-02-26 10:45:53 +00:00
|
|
|
#version 140
|
2018-02-23 16:35:39 +00:00
|
|
|
|
2018-02-27 10:42:35 +00:00
|
|
|
uniform sampler2D tex;
|
2018-06-15 16:36:51 +01:00
|
|
|
uniform vec3 diffuse;
|
2018-02-27 10:42:35 +00:00
|
|
|
|
|
|
|
in vec3 v_normal;
|
2018-02-26 13:59:32 +00:00
|
|
|
in vec2 v_tex_coords;
|
2018-02-27 10:42:35 +00:00
|
|
|
|
2018-02-26 10:45:53 +00:00
|
|
|
out vec4 color;
|
2018-02-23 16:35:39 +00:00
|
|
|
|
2018-02-27 10:42:35 +00:00
|
|
|
vec3 ambientLight = vec3(0.3,0.3,0.3);
|
|
|
|
vec3 directionnalLight = normalize(vec3(10,5,7));
|
|
|
|
vec3 directionnalLightFactor = vec3(0.6,0.6,0.6);
|
2018-02-26 13:59:32 +00:00
|
|
|
|
2018-02-23 16:35:39 +00:00
|
|
|
void main() {
|
2018-04-24 10:08:32 +01:00
|
|
|
|
2018-02-27 10:42:35 +00:00
|
|
|
vec3 lambertComponent = dot(directionnalLight, v_normal) * directionnalLightFactor;
|
|
|
|
lambertComponent = max(vec3(0.0, 0.0, 0.0), lambertComponent);
|
|
|
|
|
|
|
|
vec4 factor = vec4(ambientLight + lambertComponent, 1.0);
|
|
|
|
|
2018-06-15 16:36:51 +01:00
|
|
|
color = factor * vec4(diffuse, 1.0) * texture(tex, v_tex_coords);
|
2018-04-12 16:23:40 +01:00
|
|
|
|
2018-04-24 10:08:32 +01:00
|
|
|
if (color.a < 0.05) {
|
2018-04-12 16:23:40 +01:00
|
|
|
discard;
|
2018-04-17 09:45:44 +01:00
|
|
|
} else {
|
|
|
|
color.a = 1.0;
|
2018-04-12 16:23:40 +01:00
|
|
|
}
|
|
|
|
|
2018-02-23 16:35:39 +00:00
|
|
|
}
|
|
|
|
|