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.

82 lines
2.2 KiB

  1. vs.1.1
  2. # DYNAMIC: "DOWATERFOG" "0..1"
  3. # DYNAMIC: "SKINNING" "0..1"
  4. #include "macros.vsh"
  5. ;------------------------------------------------------------------------------
  6. ; Vertex blending
  7. ;------------------------------------------------------------------------------
  8. $cView0 = $SHADER_SPECIFIC_CONST_0;
  9. $cView1 = $SHADER_SPECIFIC_CONST_1;
  10. $cView2 = $SHADER_SPECIFIC_CONST_2;
  11. &AllocateRegister( \$worldPos );
  12. &AllocateRegister( \$worldNormal );
  13. &SkinPositionAndNormal( $worldPos, $worldNormal );
  14. ;------------------------------------------------------------------------------
  15. ; Transform the position from world to view space
  16. ;------------------------------------------------------------------------------
  17. &AllocateRegister( \$projPos );
  18. dp4 $projPos.x, $worldPos, $cViewProj0
  19. dp4 $projPos.y, $worldPos, $cViewProj1
  20. dp4 $projPos.z, $worldPos, $cViewProj2
  21. dp4 $projPos.w, $worldPos, $cViewProj3
  22. mov oPos, $projPos
  23. ;------------------------------------------------------------------------------
  24. ; Fog
  25. ;------------------------------------------------------------------------------
  26. &CalcFog( $worldPos, $projPos );
  27. &FreeRegister( \$projPos );
  28. &AllocateRegister( \$viewNormal );
  29. ; Transform the normal from object to view space
  30. dp3 $viewNormal.x, $worldNormal, $cView0
  31. dp3 $viewNormal.y, $worldNormal, $cView1
  32. dp3 $viewNormal.z, $worldNormal, $cView2
  33. &FreeRegister( \$worldNormal );
  34. ; normalize normal (do we need to do this?)
  35. &Normalize( $viewNormal );
  36. &AllocateRegister( \$viewPos );
  37. ; Transform position from object to view space
  38. dp4 $viewPos.x, $worldPos, $cView0
  39. dp4 $viewPos.y, $worldPos, $cView1
  40. dp4 $viewPos.z, $worldPos, $cView2
  41. &FreeRegister( \$worldPos );
  42. &AllocateRegister( \$vertToEye );
  43. ; vector from point to eye in view space
  44. mov $vertToEye.xyz, -$viewPos
  45. &FreeRegister( \$viewPos );
  46. ; normalize
  47. &Normalize( $vertToEye );
  48. dp3 $viewNormal.x, $vertToEye, $viewNormal
  49. add $viewNormal.x, $viewNormal.x, $SHADER_SPECIFIC_CONST_5 ; FIXME
  50. &FreeRegister( \$vertToEye );
  51. ;------------------------------------------------------------------------------
  52. ; Texture coordinates
  53. ;------------------------------------------------------------------------------
  54. mov oT0, $viewNormal
  55. mov oT1, $vTexCoord0
  56. &FreeRegister( \$viewNormal );