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.

57 lines
1.6 KiB

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