28 lines
571 B
GLSL
28 lines
571 B
GLSL
#version 140
|
|
|
|
uniform sampler2D tex;
|
|
|
|
in vec3 v_normal;
|
|
in vec2 v_tex_coords;
|
|
|
|
out vec4 color;
|
|
|
|
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);
|
|
|
|
void main() {
|
|
vec3 lambertComponent = dot(directionnalLight, v_normal) * directionnalLightFactor;
|
|
lambertComponent = max(vec3(0.0, 0.0, 0.0), lambertComponent);
|
|
|
|
vec4 factor = vec4(ambientLight + lambertComponent, 1.0);
|
|
|
|
color = factor * texture(tex, v_tex_coords);
|
|
|
|
if (color.a < 0.5) {
|
|
discard;
|
|
}
|
|
|
|
}
|
|
|