Hardware skinning
[dormin.git] / skin.vp
blobc88982ae25a8c3cbddf89a938d468e2891623e28
1 !!ARBvp1.0
3 PARAM c4 = {4, 0, 20, 1};
4 PARAM mvp[4] = { state.matrix.mvp };
5 PARAM anim[] = { program.local[0..121] };
7 ATTRIB position = vertex.attrib[0];
8 ATTRIB normal   = vertex.attrib[2];
9 ATTRIB color    = vertex.attrib[3];
10 ATTRIB weights  = vertex.attrib[6];
11 ATTRIB texcoord = vertex.attrib[8];
13 TEMP v, v2, v1, r0, r1, r2, t0, w;
14 ADDRESS a0;
16 #######################################################################
17 FRC w, weights;
18 FLR t0, weights;
20 ARL a0.x, t0.x;
22 MUL r0, anim[a0.x+0], w.x;
23 MUL r1, anim[a0.x+1], w.x;
24 MUL r2, anim[a0.x+2], w.x;
25 SUB v1.xyz, position, anim[a0.x+3];
27 DPH v.x, v1, r0;
28 DPH v.y, v1, r1;
29 DPH v.z, v1, r2;
31 ##############################
32 ARL a0.x, t0.y;
34 MUL r0, anim[a0.x+0], w.y;
35 MUL r1, anim[a0.x+1], w.y;
36 MUL r2, anim[a0.x+2], w.y;
37 SUB v1.xyz, position, anim[a0.x+3];
39 DPH v2.x, v1, r0;
40 DPH v2.y, v1, r1;
41 DPH v2.z, v1, r2;
43 MAD v.xyz, anim[a0.x+3].w, v2, v;
45 ##############################
46 ARL a0.x, t0.z;
48 MUL r0, anim[a0.x+0], w.z;
49 MUL r1, anim[a0.x+1], w.z;
50 MUL r2, anim[a0.x+2], w.z;
51 SUB v1.xyz, position, anim[a0.x+3];
53 DPH v2.x, v1, r0;
54 DPH v2.y, v1, r1;
55 DPH v2.z, v1, r2;
57 MAD v.xyz, anim[a0.x+3].w, v2, v;
59 MOV v.w, c4.w;
60 ######################################################################
61 #MOV v, position;
62 DP4 result.position.x, mvp[0], v;
63 DP4 result.position.y, mvp[1], v;
64 DP4 result.position.z, mvp[2], v;
65 DP4 result.position.w, mvp[3], v;
67 MOV result.color, color;
68 MOV result.texcoord, texcoord;
70 END
72 # Local Variables:
73 # mode: python
74 # End: