#version 150

in vec2 t_uv;
out vec4 out_color;

uniform sampler2D nrm;
uniform sampler2D tex;

void main() {
   vec4 light_dir = normalize(vec4(1.0, 1.0, 1.0, 1.0));

   vec4 pixel = texture(tex, t_uv);
   vec4 normal = texture(nrm, t_uv);

   float l = max(dot(light_dir, normalize(normal)), 0.0);
   vec3 col = vec3(pixel) * pow(l, 4.0);
   if (pixel.a < 0.1) {
       discard;
   }
   out_color = vec4(col, 1.0);
}
