
// Input structure

struct myVertexOut {
    float4 lightVec : COLOR0;
    float4 texCoord0 : TEXCOORD0;
    float4 texCoord1 : TEXCOORD1;
};

float4 main(myVertexOut I,
            uniform sampler2D colorMap,
            uniform sampler2D normalMap) : COLOR
{
    // Lookup the colorMap texture
    float4 texColor = tex2D(colorMap, I.texCoord0.xy);
    // Get the normal from normal map lookup
    float4 normal = 2 * (tex2D(normalMap, I.texCoord1.xy) - 0.5);

    // Light vector from input color
    float3 light_vector = 2 * (I.lightVec.xyz - 0.5);

    // N dot L
    float4 dot_result = saturate(dot(light_vector, normal.xyz).xxxx);

    // Modulate color with N dot L
    return dot_result * texColor;
}

