; ;constants set by app: ;C0-c3 = transposed world-view-perspective matrix. ;c4.x = weight for first stream ;c4.y = weight for second stream (possibly) ;c5.xyz = light1 direction (in object space) (normalized) ;c6.xyx = light1 colour ;c7.xyz = light2 direction ;c8.xyz = light2 colour ;c9.xyz = ambient colour vs.1.0 ;vertex components ;v0 = position1 ;v1 = position2 ;v2 = normal1 ;v3 = normal2 ;v6 = single texture coordinate ;position mul r0, v0, c4.x ;lerp between the 2 vertex streams mad r0, v1, c4.y, r0 ;lrp r0, c4.x, v0, v1 ;try to get this working again!! dp4 oPos.x, r0, c0 ;0 ;transform interpolated vertex position to HCLIP space dp4 oPos.y, r0, c1 ;1 dp4 oPos.z, r0, c2 ;2 dp4 oPos.w, r0, c3 ;3 ;lighting mov r0, c9 ;store ambient colour (used later) mul r2, v2, c4.x ;lerp between the 2 normals mad r2, v3, c4.y, r2 ;lrp r2, c4.x, v2, v3 ;r2 = interpolated normal ;first light and ambient dp3 r1, r2, -c5 ;dot product interpolated normal with the negated light1 direction (result in all channels) lit r1, r1 ;use lit to clamp to [0..1] (actually clamps r1.x into r1.y) mad r0.xyz, r1.yyyy, c6, r0 ;intensity1 * LightColour1 + Ambient ;second light dp3 r1, r2, -c7 ;dot product interpolated normal with the negated light2 direction (result in all channels) lit r1, r1 ;use lit to clamp to [0..1] (actually clamps r1.x into r1.y) mad oD0.xyz, r1.yyyy, c8, r0 ;DiffuseOut = intensity2 * LightColour2 + (First light and ambient) ;texture coordinates mov oT0, v6 ;coordindex0 mov oT1, v6 ;coordindex1