// Vertex shader for shadows maps

// c0..3	- WVP
// c4..7	- world to light proj x-form
// c8..11	- shadow projection for sample 1
// c12..15	- shadow projection for sample 2
// c16..19	- shadow projection for sample 3
// c20..23	- shadow projection for sample 4
// c30		- light direction
// c31		- diffuse light
// c32		- Z-bias

vs.1.0
dcl_position0 v0
dcl_normal0   v3
dcl_texcoord0 v7
;dcl_texcoord1 v8
;dcl_texcoord2 v9

def c50, 0.001, 0, 0, 0

// Transform vertex position
m4x4 oPos, v0, c0
// Compute texture coordinates for 4 shadow samples
m4x4 oT0, v0, c8
;m4x4 oT1, v0, c8

;m4x4 oT1, v0, c12
;m4x4 oT2, v0, c16
;m4x4 oT3, v0, c20
// Diffuse lighting
dp3 oD0, v3, c12
// Multiply by light color
;mul oD0, r0, c31
// Transform Z into projected light space
m4x4 r1, v0, c4
// Add Z-bias
add oT1.rgba, r1.z, c32.xxxx
;mul	oT1.rgba,r1.zzzz,c50.xxxx
