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.

45 lines
971 B

  1. // DYNAMIC: "DOWATERFOG" "0..1"
  2. #include "common_vs_fxc.h"
  3. static const int g_FogType = DOWATERFOG;
  4. struct VS_INPUT
  5. {
  6. float4 vPos : POSITION;
  7. float4 vTexCoord0 : TEXCOORD0;
  8. };
  9. struct VS_OUTPUT
  10. {
  11. float4 projPos : POSITION; // Projection-space position
  12. #if !defined( _X360 )
  13. float fog : FOG;
  14. #endif
  15. HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
  16. float4 worldPos_projPosZ : TEXCOORD1; // Necessary for water fog dest alpha
  17. float4 fogFactorW : COLOR1;
  18. };
  19. VS_OUTPUT main( const VS_INPUT v )
  20. {
  21. VS_OUTPUT o = ( VS_OUTPUT )0;
  22. float4 projPos;
  23. float3 worldPos;
  24. projPos = mul( float4( v.vPos.xyz, 1 ), cModelViewProj );
  25. o.projPos = projPos;
  26. worldPos = mul( float4( v.vPos.xyz, 1 ), cModel[0] );
  27. o.fogFactorW.w = CalcFog( worldPos, projPos, g_FogType );
  28. #if !defined( _X360 )
  29. o.fog = o.fogFactorW.w;
  30. #endif
  31. o.worldPos_projPosZ = float4( worldPos, projPos.z );
  32. o.baseTexCoord.xy = v.vTexCoord0;
  33. return o;
  34. }