











































































































































































































;------------------------------------------------------------------------------
; Defines
;------------------------------------------------------------------------------









;------------------------------------------------------------------------------
; Vertex transformation
;------------------------------------------------------------------------------

; Transform to projection space
m4x4	oPos, v0, c6



;------------------------------------------------------------------------------
; Lighting calculation
;------------------------------------------------------------------------------

; Compute the normalized vertex to eye vector
add		r7, c10, -v0
dp3 r4.w, r7, r7 rsq r7.w, r4.w mul r7.xyz, r7, r7.w

; Dot with vertex normal and take absolute value
dp3		r5.x, v1, r7
max		r5.x, r5.x, -r5.x
sub     r5.x, c1, r5.x
mad     r5.x, r5.x, c11.x, c11.y

; Modulate with constant diffuse
mul		oD0, r5.x, c2
;mov oD0, c2

; Calculate fog factor
add r7, c51, -v0 dp3 r4.x, r7, r7 rsq r4.x, r4.x rcp r4.x, r4.x mad r4.x, r4.x, c4.x, c4.y dp4 r4.y, v0, c52 mad r4.y, r4.y, c4.z, c4.w min oFog, r4.x, r4.y

;------------------------------------------------------------------------------
; Texture coordinates
;------------------------------------------------------------------------------

dp3 r0.x, v1, c14
dp3 r0.y, v1, c15
;mad     oT0.xy, r0, c11.zz, c11.ww

mov oT0.xy, c11.zz

; Copy base tex coords
;mov		oT0.xy, v3
