;stream 0;
;float    v0[3];  // Position
;D3DCOLOR v3;     // Normal
;float    v7[2];  // Tex coord 0
;D3DCOLOR v8;     // Binormal
;D3DCOLOR v9;     // Tangent

; Constants:
; 0..3 - Composite World-View-Projection Matrix
; 4..7 - light view proj  Matrix
; 8     - Object Space Light Position
; 12     - Object Space Light direction
; 9     - Object space Eye vector
//def c10, 0.5f,0.5f,0.5f,0.5f
; 11    - light color


vs.1.1

//def c10, 0.5f,0.5f,0.5f,0.5f

dcl_position0 v0
dcl_normal0   v3
dcl_texcoord0 v7
dcl_texcoord1 v8
dcl_texcoord2 v9

m4x4 oPos, v0, c0
;mov  oT0.xy, v7.xy   ; Base Texture
mov  oT1.xy, v7.xy   ; Normal Texture

; transform light by basis vectors to put it
; into texture space
;add r8,c8,-v0
dp3 r2.x, v8.xyz, c12			// light direction
dp3 r2.y, v9.xyz, c12
dp3 r2.z, v3.xyz, c12

;dp3	 r11.x, r8, r8	   ; magnitude^2
;rsq	 r11.y, r11.x	   ; 1/mag
;mul	 r8.xyz, r8, r11.y ; normalize

//dp3 	r7.x, v3, c0
//dp3 	r7.y, v3, c1
//dp3 	r7.z, v3, c2

//dp3	 r11.x, v3, v3	   ; magnitude^2
//rsq	 r11.y, r11.x	   ; 1/mag
//mul	 r7.xyz, v3, r11.y ; normalize

//dp3 r1.x, v3, c12    // perform lighting N dot L calculation in world space    
//max r1, r1.x, c10.x     ; if dot < 0 then dot = 0
//mul oD0,r1.rrrr,c11	// *subsurface color

mov oD0,c11

//add oD0,r1,c28
//mov oD0,c10

dp3	r11.x, r2, r2	   ; magnitude^2
rsq	r11.y, r11.x	   ; 1/mag
mul	r4.xyz, r2, r11.y ; normalize
mov	oT2.xyz, r4.xyz   ; Tangent Space Light vector

m4x4 oT0, v0, c4



