;------------------------------------------- ; Matrix components ; c0-c3 l2w * camera * projection ; c4-c67 16 bone matricies ; c76 Light 1 direction (in local space) ; c77 Light 1 color RGBA ;Vertex components-------------------------- ; v0 vertex position ; v1 s,t,q ; v2 rgba or nx ; v3 bone index 1-4 ; v4 bone weights ; #pragma screenspace xvs.1.1 ;load the offset of bone matricies mov a0.x, v3.z mul r0, VERTEX_POS, c[BONED_GEO_SCALE_CPP] ;Vertex and normal multiplied by blend weight 1 ;multiply vertex by the matrix dp4 r3.x, r0, c[a0.x + MATRIX_OFFSET1] dp4 r3.y, r0, c[a0.x + MATRIX_OFFSET2] dp4 r3.z, r0, c[a0.x + MATRIX_OFFSET3] mov r3.w, ONE.x ;multiply vertex by the weight mul r4,r3,v4.z ;multiply VERTEX_NORMALS by the matrix dp3 r7.x, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET1] dp3 r7.y, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET2] dp3 r7.z, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET3] mov r7.w, ONE.x ;multiply NORMAL by the weight mul r9,r7,v4.z ;Vertex and normal multiplied by blend weight 2 ;load the offset of bone matricies mov a0.x, v3.y ;multiply vertex by matrix 2 dp4 r3.x, r0, c[a0.x + MATRIX_OFFSET1] dp4 r3.y, r0, c[a0.x + MATRIX_OFFSET2] dp4 r3.z, r0, c[a0.x + MATRIX_OFFSET3] mov r3.w, ONE.x ;multiply vertex by its weight mad r4,r3,v4.y,r4 ;multiply NORMAL by matrix 2 dp3 r7.x, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET1] dp3 r7.y, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET2] dp3 r7.z, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET3] mov r7.w, ONE.x ;multiply Normal by its weight mad r9,r7,v4.y,r9 ;Vertex and normal multiplied by blend weight 3 ;load the offset of bone matricies mov a0.x, v3.x ;multiply vertex by bone matrix 1 dp4 r3.x, r0, c[a0.x + MATRIX_OFFSET1] dp4 r3.y, r0, c[a0.x + MATRIX_OFFSET2] dp4 r3.z, r0, c[a0.x + MATRIX_OFFSET3] mov r3.w, ONE.x ;multiply vertex by its weight mad r4,r3,v4.x,r4 ;multiply NORMAL by bone matrix 1 dp3 r7.x, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET1] dp3 r7.y, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET2] dp3 r7.z, VERTEX_NORMALS, c[a0.x + MATRIX_OFFSET3] mov r7.w, ONE.x ;multiply NORMAL by its weight mad r9,r7,v4.x,r9 ;place vertex in the clipping space mul r1, r4.x, OUTPUT_MATRIX1 mad r2, r4.y, OUTPUT_MATRIX2, r1 mad r3, r4.z, OUTPUT_MATRIX3, r2 mad oPos,r4.w, OUTPUT_MATRIX4, r3 ; Copy transformed position for lighting later on mov r10, r4