home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 April / Chip_2003-04_cd1.bin / sharewar / hardinfo / download / HARDiNFO.msi / _5CC773416CB2C53EF4E7EDFFA72CD337 / _02E103AD8F7D4A5AB3CDBF3321150734 < prev    next >
Text File  |  2000-10-02  |  2KB  |  66 lines

  1. vs.1.0
  2. ;------------------------------------------------------------------------------
  3. ; Constants specified by the app
  4. ;    c0      = ( 0, 0, 0, 0 )
  5. ;    c1      = ( 1, 0.5, 2, 4 )
  6. ;    c4-c7   = world-view-projection matrix
  7. ;    c8-c11  = world-view matrix
  8. ;    c12-c15 = view matrix
  9. ;    c20     = light direction
  10. ;    c21     = material diffuse color * light diffuse color
  11. ;    c22     = material ambient color
  12. ;    c28     = projection matrix
  13. ;
  14. ; Vertex components (as specified in the vertex DECL)
  15. ;    v0    = Position
  16. ;    v3    = Normal
  17. ;    v6    = Texcoords
  18. ;------------------------------------------------------------------------------
  19.  
  20.  
  21. ;------------------------------------------------------------------------------
  22. ; Vertex transformation
  23. ;------------------------------------------------------------------------------
  24.  
  25. ; Transform to view space (world matrix is identity)
  26. m4x4 r9, v0, c12
  27.  
  28. ; Transform to projection space
  29. m4x4 r10, r9, c28
  30.  
  31. ; Store output position
  32. mov oPos, r10
  33.  
  34.  
  35. ;------------------------------------------------------------------------------
  36. ; Lighting calculation
  37. ;------------------------------------------------------------------------------
  38.  
  39. dp3 r1.x, v3, c20    ; r1 = normal dot light
  40. max r1, r1.x, c0.x     ; if dot < 0 then dot = 0
  41. mul r0, r1.x, c21    ; Multiply with diffuse
  42. add r0, r0, c22      ; Add in ambient
  43. min oD0, r0, c1.x    ; clamp if > 1
  44.  
  45.  
  46. ;------------------------------------------------------------------------------
  47. ; Texture coordinates
  48. ;------------------------------------------------------------------------------
  49.  
  50. ; Gen tex coords from vertex xz position
  51. mul r0.xy, c24.x, r9.xz
  52. add oT0.xy, r0.xy, c24.zw
  53.  
  54. ;------------------------------------------------------------------------------
  55. ; Fog calculation
  56. ;------------------------------------------------------------------------------
  57.  
  58. ; compute fog factor f = (fog_end - dist)*(1/(fog_end-fog_start))
  59. add r0.x, -r9.z, c23.y
  60. mul r0.x, r0.x, c23.z
  61. max r0.x, r0.x, c0.x       ; clamp fog to > 0.0
  62. min oFog.x, r0.x, c1.x     ; clamp fog to < 1.0
  63.  
  64.  
  65.  
  66.