home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 March / Gamestar_71_2005-03_dvd.iso / Dema / LegacyDemo / legacy / legacy.exe / 1033 / RCDATA / 156 < prev    next >
Text File  |  2005-01-17  |  2KB  |  95 lines

  1.  
  2. vs.1.1
  3.  
  4. ;------------------------------------------------------------------------------
  5. ; v0 = position
  6. ; v1 = blend weights
  7. ; v2 = blend indices
  8. ; v3 = normal
  9. ; v4 = texture coordinates
  10. ;------------------------------------------------------------------------------
  11.  
  12. ;------------------------------------------------------------------------------
  13. ; r0.w = Last blend weight
  14. ; r1 = Blend indices
  15. ; r2 = Temp position
  16. ; r3 = Temp normal
  17. ; r4 = Blended position in camera space
  18. ; r5 = Blended normal in camera space
  19. ;------------------------------------------------------------------------------
  20.  
  21. ;------------------------------------------------------------------------------
  22. ; Constants specified by the app;
  23. ;
  24. ; c9-c95 = world-view matrix palette
  25. ; c8      = diffuse * light.diffuse
  26. ; c7      = ambient color
  27. ; c2-c5   = projection matrix
  28. ; c1      = light direction
  29. ; c0      = {1, power, 0, 1020.01};
  30. ;------------------------------------------------------------------------------
  31.  
  32. ;------------------------------------------------------------------------------
  33. ; oPos      = Output position
  34. ; oD0      = Diffuse
  35. ; oD1      = Specular
  36. ; oT0      = texture coordinates
  37. ;------------------------------------------------------------------------------
  38.  
  39. // Compensate for lack of UBYTE4 on Geforce3
  40. mul r1,v2.zyxw,c0.wwww
  41. //mul r1,v2,c0.wwww
  42.  
  43.  
  44. //first compute the last blending weight
  45. dp3 r0.w,v1.xyz,c0.xxz; 
  46. add r0.w,-r0.w,c0.x
  47.  
  48. //Set 1
  49. mov a0.x,r1.x
  50. m4x3 r4,v0,c[a0.x + 9];
  51. m3x3 r5,v3,c[a0.x + 9]; 
  52.  
  53. //blend them
  54. mul r4,r4,v1.xxxx
  55. mul r5,r5,v1.xxxx
  56.  
  57. //Set 2
  58. mov a0.x,r1.y
  59. m4x3 r2,v0,c[a0.x + 9];
  60. m3x3 r3,v3,c[a0.x + 9];
  61.  
  62. //add them in
  63. mad r4,r2,v1.yyyy,r4;
  64. mad r5,r3,v1.yyyy,r5;
  65.         
  66. //Set 3
  67. mov a0.x,r1.z
  68. m4x3 r2,v0,c[a0.x + 9];
  69. m3x3 r3,v3,c[a0.x + 9];
  70.  
  71. //add them in
  72. mad r4,r2,r0.wwww,r4;
  73. mad r5,r3,r0.wwww,r5;
  74.  
  75. //compute position
  76. mov r4.w,c0.x
  77. m4x4 oPos,r4,c2
  78.  
  79. // normalize normals
  80. dp3 r5.w, r5, r5;
  81. rsq r5.w, r5.w;
  82. mul r5, r5, r5.w;
  83.  
  84. ; Do the lighting calculation
  85. dp3 r1.x, r5, c1      ; normal dot light
  86. lit r1, r1
  87. mul r0, r1.y, c8      ; Multiply with diffuse
  88. add r0, r0, c7        ; Add in ambient
  89. min oD0, r0, c0.x     ; clamp if > 1
  90. mov oD1, c0.zzzz     ; output specular
  91.  
  92. ; Copy texture coordinate
  93. mov oT0, v4
  94.  
  95.