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.

50 lines
1011 B

  1. // DYNAMIC: "DOWATERFOG" "0..1"
  2. // DYNAMIC: "SKINNING" "0..1"
  3. #include "common_vs_fxc.h"
  4. static const int g_FogType = DOWATERFOG;
  5. static const bool g_bSkinning = SKINNING ? true : false;
  6. struct VS_INPUT
  7. {
  8. float4 vPos : POSITION;
  9. float4 vBoneWeights : BLENDWEIGHT;
  10. float4 vBoneIndices : BLENDINDICES;
  11. float3 vNormal : NORMAL;
  12. };
  13. struct VS_OUTPUT
  14. {
  15. float4 vProjPos : POSITION;
  16. float4 vDiffuse : COLOR0;
  17. float4 fogFactorW : COLOR1;
  18. #if !defined( _X360 )
  19. float fog : FOG;
  20. #endif
  21. };
  22. VS_OUTPUT main( const VS_INPUT v )
  23. {
  24. VS_OUTPUT o = ( VS_OUTPUT )0;
  25. float3 worldPos, worldNormal;
  26. SkinPositionAndNormal( g_bSkinning, v.vPos, v.vNormal, v.vBoneWeights, v.vBoneIndices, worldPos, worldNormal );
  27. o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  28. o.fogFactorW = CalcFog( worldPos, o.vProjPos, g_FogType );
  29. #if !defined( _X360 )
  30. o.fog = o.fogFactorW;
  31. #endif
  32. // stick the normal in the color channel
  33. o.vDiffuse.rgb = worldNormal;
  34. o.vDiffuse.a = 1.0f;
  35. return o;
  36. }