#version 300 es

#define gl_Vertex _glesVertex
in vec4 _glesVertex;
#define gl_MultiTexCoord0 _glesMultiTexCoord0
in vec4 _glesMultiTexCoord0;
#define TANGENT vec4(normalize(_glesTANGENT.xyz), _glesTANGENT.w)
in vec4 _glesTANGENT;

struct v2f {
    highp vec4 pos;
    mediump vec2 uv;
    lowp vec4 color;
};

uniform highp mat4 glstate_matrix_mvp;

v2f vert( in highp vec4 pos, in mediump vec2 uv, in highp vec4 tangent ) {
    v2f o;
    o.pos = (glstate_matrix_mvp * pos);
    o.color.xy = (uv * 0.3);
    o.color.xyz += ((tangent.xyz * 0.5) + 0.5);
    o.color.w = 0.0;
    o.uv = uv;
    return o;
}

out mediump vec2 xlv_TEXCOORD0;
out lowp vec4 xlv_TEXCOORD1;
void main() {
    v2f xl_retval;
    xl_retval = vert( vec4(gl_Vertex), vec2(gl_MultiTexCoord0), vec4(TANGENT));
    gl_Position = vec4(xl_retval.pos);
    xlv_TEXCOORD0 = vec2(xl_retval.uv);
    xlv_TEXCOORD1 = vec4(xl_retval.color);
}
