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.

54 lines
1.1 KiB

  1. // DYNAMIC: "COMPRESSED_VERTS" "0..1"
  2. // DYNAMIC: "DOWATERFOG" "0..1"
  3. // DYNAMIC: "SKINNING" "0..1"
  4. #include "common_vs_fxc.h"
  5. static const int g_FogType = DOWATERFOG;
  6. static const bool g_bSkinning = SKINNING ? true : false;
  7. struct VS_INPUT
  8. {
  9. float4 vPos : POSITION;
  10. float4 vBoneWeights : BLENDWEIGHT;
  11. float4 vBoneIndices : BLENDINDICES;
  12. float4 vNormal : NORMAL;
  13. };
  14. struct VS_OUTPUT
  15. {
  16. float4 vProjPos : POSITION;
  17. float4 vDiffuse : COLOR0;
  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 vObjNormal;
  27. DecompressVertex_Normal( v.vNormal, vObjNormal );
  28. float3 worldPos, worldNormal;
  29. SkinPositionAndNormal( g_bSkinning, v.vPos, vObjNormal, v.vBoneWeights, v.vBoneIndices, worldPos, worldNormal );
  30. o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  31. o.fogFactorW = CalcFog( worldPos, o.vProjPos, g_FogType );
  32. #if !defined( _X360 )
  33. o.fog = o.fogFactorW;
  34. #endif
  35. // stick the normal in the color channel
  36. o.vDiffuse.rgb = worldNormal;
  37. o.vDiffuse.a = 1.0f;
  38. return o;
  39. }