



















































































































	
	
	







































































































;------------------------------------------------------------------------------
; Vertex transformation
;------------------------------------------------------------------------------

; Transform to projection space
m4x4	r0, v0, c6

; Add in the appropriate billboard vectors
; (These are already transformed into projection space)

mad     r7, v13.x, c10, r0
mad     r7, v13.y, c14, r7
mov	oPos, r7


;------------------------------------------------------------------------------
; Lighting calculation
;------------------------------------------------------------------------------

; Combine vertex color and material color
; c17 - x = threshold in screen space z
;               y = 1/znorm
;               z = 1/threshold


; create a vertex position in the center of the screen (?)
max	r7.xyz, v13.xyz, -v13.xyz
mul r7.xyz, r7.xyz, c10

; convert to screenspace extent
mul r7.xyz, r7, c49
rcc r7.w, r7.w
mul r7.xyz, r7, r7.w

mov	r5, r7
slt	r4, r5, c17.x
sge	r5, r5, c17.x
mul r5.w, r5.x, c17.z
sub r6.w, c17.w, r7.x
mad	r4.w, r5.w, r6.w, r4.x
mov r4.xyz, c1
mul r5, r4, v2












mul		oD0, r5, 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
;------------------------------------------------------------------------------

; Copy base tex coords
mov		oT0.xy, v3
