attribute vec3 position;
attribute vec3 normal;
attribute vec2 texcoord;

uniform mat4 MVP;
uniform mat4 MV;
uniform mat3 N;
UNIFORMS

varying vec4 FS_diffuse_texcoord;
varying mediump vec3 FS_normal;
varying mediump vec3 FS_eye;
VARYINGS

void main(void)
{
    vec3 nor = N*normal;

    vec4 pos = MVP*vec4(position, 1.);

    SET_SHADOW
    SET_AMBIENT_OCCL

    FS_diffuse_texcoord = vec4(
            clamp(dot(LIGHT, nor)*_DIFFUSE, 0., 1.),
            0.,
            texcoord.x,
            texcoord.y
            );

    FS_normal = nor;
    FS_eye = (MV*vec4(position, 1.)).xyz;
    gl_Position = pos;
}

