[[vertex]]

uniform mat4 mvp;

in vec4 pos;
in vec3 nor;
in vec2 uvs;
out vec3 n;

void main()
{
    n = nor;
    gl_Position = mvp * pos;
}

[[fragment]]

uniform mediump vec3 light_dir;
uniform mediump float ambient;

in mediump vec3 n;
out mediump vec4 frag;

void main()
{
    mediump float d = max(0.0, dot(normalize(n), light_dir));
    frag = vec4(vec3(d) + ambient, 1.0);
    //frag = vec4(normalize(n) * 0.5 + 0.5, 1.0);
}
