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.

56 lines
1.5 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.x, $vTexCoord2.x
  33. mov $offset.y, $cZero
  34. dp4 oT0.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_0
  35. dp4 oT0.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_1
  36. add oT1.xy, $offset, $vTexCoord1
  37. mad oT2.xy, $offset, $cTwo, $vTexCoord1
  38. ; make a 3
  39. alloc $three
  40. add $three, $cOne, $cTwo
  41. mad oT3.xy, $offset, $three, $vTexCoord1
  42. free $three
  43. mov oD0, $vColor
  44. &FreeRegister( \$offset );