vs.1.1

;c0-c3 position
;c4-c7 view projection
;c8    vectpos
;c9    vect
;c10   light

dcl_position v0
dcl_normal v3
dcl_color v5
dcl_texcoord v7

;Transform position into space
m4x4 r0,v0,c0
m3x3 r1.xyz,v3,c0
mov r1.w,c9.z

; Compute normalized view vector
add r2,c8,-r0
dp3 r3,r2,r2
rsq r3,r3
mul r2,r2,r3

;Compute space reflection vector
dp3 r3,r1,r2
mul r1,r1,r3
add r1,r1,r1
add r3,r1,-r2

;sphere-map
add r3.z,r3.z,c9.y
dp3 r4,r3,r3
rsq r5,r4
mul r5,r5,c9.y

;Project position
m4x4 oPos,r0,c4

; Lighting
;dp3 r7.x, v3, c10
;mul r8, r7.x, c13
;mov oD0, r8

;Textures coordinates
mov oT1,v7
mad oT0.xy,r3.xy,r5.xy,c9.y


