// c0 - view projection world matrix
// c4 - light color
// c5 - light direction
// c6 - ambient color
// c7 - texture scale
// c8 - layer position
// c9 - layer scale
// c15 - light view projection world matrix
// c19 - world matrix

vs_1_1
dcl_position v0
dcl_normal v1
dcl_texcoord0 v2

def c11, 0.5, 0.5, 0.5, 0.5
def c12, 1, 1, 1, 1
def c25, 1, 0, 0, 0

m4x4 r4, v0, c0		// transform vertices using view projection transform
mov oPos, r4

dp3 r0, v1, c5		// perform lighting N dot L calculation in world
mov r3, c12
add r2, r3, -c6
mul r0, r0, r2
add r0, r0, c6
mul oD0, r0.x, c4		// calculate final vertex color from light intensity and interpolated diffuse vertex color 
mov oD0.a, c12

mov oT0.xy, v2		// copy texture coordinates to output

mul r1, v2, c40		// layer
add r0, r1, c8
mov oT3.xy, r0