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.

55 lines
1.6 KiB

  1. vs.1.1
  2. # DYNAMIC: "DOWATERFOG" "0..1"
  3. #include "macros.vsh"
  4. ;------------------------------------------------------------------------------
  5. ; Vertex blending
  6. ;------------------------------------------------------------------------------
  7. &AllocateRegister( \$projPos );
  8. ; Transform position from object to projection space
  9. dp4 $projPos.x, $vPos, $cModelViewProj0
  10. dp4 $projPos.y, $vPos, $cModelViewProj1
  11. dp4 $projPos.z, $vPos, $cModelViewProj2
  12. dp4 $projPos.w, $vPos, $cModelViewProj3
  13. mov oPos, $projPos
  14. ;------------------------------------------------------------------------------
  15. ; Fog
  16. ;------------------------------------------------------------------------------
  17. alloc $worldPos
  18. if( $DOWATERFOG == 1 )
  19. {
  20. ; Get the worldpos z component only since that's all we need for height fog
  21. dp4 $worldPos.z, $vPos, $cModel2
  22. }
  23. &CalcFog( $worldPos, $projPos );
  24. free $worldPos
  25. &FreeRegister( \$projPos );
  26. ;------------------------------------------------------------------------------
  27. ; Texture coordinates
  28. ;------------------------------------------------------------------------------
  29. ; Compute the texture coordinates given the offset between
  30. ; each bumped lightmap
  31. &AllocateRegister( \$offset );
  32. mov $offset.xy, $vTexCoord2
  33. dp4 oT0.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_0
  34. dp4 oT0.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_1
  35. add oT1.xy, $offset, $vTexCoord1
  36. mad oT2.xy, $offset, $cTwo, $vTexCoord1
  37. alloc $three
  38. add $three, $cOne, $cTwo
  39. mad oT3.xy, $offset, $three, $vTexCoord1
  40. free $three
  41. dp4 oT4.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_2
  42. dp4 oT4.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_3
  43. &FreeRegister( \$offset );