Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.0 KiB

  1. vs.1.1
  2. # DYNAMIC: "DOWATERFOG" "0..1"
  3. # DYNAMIC: "SKINNING" "0..1"
  4. ;------------------------------------------------------------------------------
  5. ; Constants specified by the app
  6. ; c0 = (0, 1, 2, 0.5)
  7. ; c1 = (1/2.2, 0, 0, 0)
  8. ; c2 = camera position *in world space*
  9. ; c4-c7 = modelViewProj matrix (transpose)
  10. ; c8-c11 = ViewProj matrix (transpose)
  11. ; c12-c15 = model->view matrix (transpose)
  12. ; c16 = [fogStart, fogEnd, fogRange, undefined]
  13. ;
  14. ; Vertex components (as specified in the vertex DECL)
  15. ; $vPos = Position
  16. ; $vTexCoord0.xy = TexCoord0
  17. ;------------------------------------------------------------------------------
  18. #include "macros.vsh"
  19. ; Vertex components
  20. ; $vPos = Position
  21. ; $vNormal = normal
  22. ; $vTexCoord0.xy = TexCoord0
  23. ; $vTangentS = S axis of Texture space
  24. ; $vTangentT = T axis of Texture space
  25. ;------------------------------------------------------------------------------
  26. ; Transform the position from world to view space
  27. ;------------------------------------------------------------------------------
  28. ; Transform position from object to world space
  29. alloc $worldPos
  30. &SkinPosition( $worldPos );
  31. ; Project to view space
  32. alloc $projPos
  33. dp4 $projPos.x, $worldPos, $cViewProj0
  34. dp4 $projPos.y, $worldPos, $cViewProj1
  35. dp4 $projPos.z, $worldPos, $cViewProj2
  36. dp4 $projPos.w, $worldPos, $cViewProj3
  37. mov oPos, $projPos
  38. &CalcFog( $worldPos, $projPos );
  39. alloc $newProjPos
  40. mov oPos, $projPos
  41. ; special case perspective correct texture projection so that the texture fits exactly on the screen
  42. mul $projPos.y, $projPos.y, $SHADER_SPECIFIC_CONST_4.w
  43. add $projPos.xy, $projPos.xy, $projPos.w
  44. mul $projPos.xy, $projPos.xy, $cHalf
  45. mov oT0.xy, $projPos.xy
  46. mov oT0.z, $cZero
  47. mov oT0.w, $projPos.w
  48. free $projPos
  49. free $worldPos
  50. free $newProjPos
  51. ; alpha map
  52. alloc $bumpTexCoord
  53. dp4 $bumpTexCoord.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_1
  54. dp4 $bumpTexCoord.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_2
  55. mov oT1.xy, $bumpTexCoord
  56. free $bumpTexCoord