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.

58 lines
1.2 KiB

  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. float2 vTexCoord0 : TEXCOORD0;
  8. float2 vTexCoord1 : TEXCOORD1;
  9. float2 vTexCoord2 : TEXCOORD2;
  10. };
  11. struct VS_OUTPUT
  12. {
  13. float4 vProjPos : POSITION;
  14. float2 vTexCoord0 : TEXCOORD0;
  15. float2 vTexCoord1 : TEXCOORD1;
  16. float2 vTexCoord2 : TEXCOORD2;
  17. float2 vTexCoord3 : TEXCOORD3;
  18. float4 fogFactorW : COLOR1;
  19. #if !defined( _X360 )
  20. float fog : FOG;
  21. #endif
  22. };
  23. VS_OUTPUT main( const VS_INPUT v )
  24. {
  25. VS_OUTPUT o = ( VS_OUTPUT )0;
  26. float3 worldPos;
  27. worldPos = mul( v.vPos, cModel[0] );
  28. o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  29. o.fogFactorW = CalcFog( worldPos, o.vProjPos, g_FogType );
  30. #if !defined( _X360 )
  31. o.fog = o.fogFactorW;
  32. #endif
  33. // Compute the texture coordinates given the offset between each bumped lightmap
  34. float2 bumpOffset;
  35. bumpOffset = v.vTexCoord2;
  36. o.vTexCoord0 = v.vTexCoord0; // bumpmap texcoords
  37. o.vTexCoord1 = bumpOffset + v.vTexCoord1; // first lightmap texcoord
  38. o.vTexCoord2 = (bumpOffset * 2.0) + v.vTexCoord1; // second lightmap texcoord
  39. o.vTexCoord3 = (bumpOffset * 3.0) + v.vTexCoord1; // third lightmpa texcoord
  40. return o;
  41. }