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.

64 lines
1.7 KiB

  1. // DYNAMIC: "DOWATERFOG" "0..1"
  2. #include "common_vs_fxc.h"
  3. static const int g_FogType = DOWATERFOG;
  4. const float4 cBaseTexCoordTransform[2] : register( SHADER_SPECIFIC_CONST_0 );
  5. const float4 cBaseTexCoordTransform2[2] : register( SHADER_SPECIFIC_CONST_2 );
  6. const float4 cMacrosTexCoordTransform[2] : register( SHADER_SPECIFIC_CONST_4 );
  7. struct VS_INPUT
  8. {
  9. // This is all of the stuff that we ever use.
  10. float4 vPos : POSITION;
  11. float4 vColor : COLOR0;
  12. float4 vTexCoord0 : TEXCOORD0;
  13. float4 vTexCoord1 : TEXCOORD1;
  14. };
  15. struct VS_OUTPUT
  16. {
  17. float4 projPos : POSITION;
  18. #if !defined( _X360 )
  19. float fog : FOG;
  20. #endif
  21. float2 baseCoord : TEXCOORD0;
  22. float2 baseCoord2 : TEXCOORD1;
  23. float2 lightmapCoord : TEXCOORD2;
  24. float2 macrosCoord : TEXCOORD3;
  25. float4 color : COLOR0;
  26. float4 fogFactorW : COLOR1;
  27. };
  28. VS_OUTPUT main( const VS_INPUT v )
  29. {
  30. VS_OUTPUT o = ( VS_OUTPUT )0;
  31. float3 worldNormal, worldPos;
  32. float2 texCoord;
  33. worldPos = mul( v.vPos, cModel[0] );
  34. float4 vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  35. o.projPos = projPos;
  36. vProjPos.z = dot( float4( worldPos, 1 ), cViewProjZ );
  37. o.fogFactorW = CalcFog( worldPos, vProjPos, g_FogType );
  38. #if !defined( _X360 )
  39. o.fog = o.fogFactorW;
  40. #endif
  41. o.color = v.vColor;
  42. o.baseCoord.x = dot( v.vTexCoord0, cBaseTexCoordTransform[0] );
  43. o.baseCoord.y = dot( v.vTexCoord0, cBaseTexCoordTransform[1] );
  44. o.baseCoord2.x = dot( v.vTexCoord0, cBaseTexCoordTransform2[0] );
  45. o.baseCoord2.y = dot( v.vTexCoord0, cBaseTexCoordTransform2[1] );
  46. o.lightmapCoord = v.vTexCoord1;
  47. o.macrosCoord.x = dot( v.vTexCoord0, cMacrosTexCoordTransform[0] );
  48. o.macrosCoord.y = dot( v.vTexCoord0, cMacrosTexCoordTransform[1] );
  49. return o;
  50. }