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.

63 lines
1.8 KiB

  1. #include "macros.vsh"
  2. sub UnlitTwoTexture
  3. {
  4. local( $vertexcolor ) = shift;
  5. local( $worldPos, $projPos );
  6. ;------------------------------------------------------------------------------
  7. ; Vertex blending
  8. ;------------------------------------------------------------------------------
  9. &AllocateRegister( \$worldPos );
  10. &SkinPosition( $worldPos );
  11. ;------------------------------------------------------------------------------
  12. ; Transform the position from world to proj space
  13. ;------------------------------------------------------------------------------
  14. &AllocateRegister( \$projPos );
  15. dp4 $projPos.x, $worldPos, $cViewProj0
  16. dp4 $projPos.y, $worldPos, $cViewProj1
  17. dp4 $projPos.z, $worldPos, $cViewProj2
  18. dp4 $projPos.w, $worldPos, $cViewProj3
  19. mov oPos, $projPos
  20. ;------------------------------------------------------------------------------
  21. ; Fog
  22. ;------------------------------------------------------------------------------
  23. &CalcFog( $worldPos, $projPos );
  24. &FreeRegister( \$projPos );
  25. &FreeRegister( \$worldPos );
  26. ;------------------------------------------------------------------------------
  27. ; Texture coordinates (use world-space normal for envmap, tex transform for mask)
  28. ;------------------------------------------------------------------------------
  29. dp4 oT0.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_0
  30. dp4 oT0.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_1
  31. if ( $g_x360 )
  32. {
  33. ; must write xyzw to match read in pixelshader
  34. mov oT0.zw, $cZero
  35. }
  36. dp4 oT1.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_2
  37. dp4 oT1.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_3
  38. if ( $g_x360 )
  39. {
  40. ; must write xyzw to match read in pixelshader
  41. mov oT1.zw, $cZero
  42. }
  43. if( $vertexcolor )
  44. {
  45. ; Modulation color
  46. mul oD0, $vColor, $cModulationColor
  47. }
  48. else
  49. {
  50. ; Modulation color
  51. mov oD0, $cModulationColor
  52. }
  53. }