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.0 KiB

  1. // STATIC: "MODEL" "0..1"
  2. // DYNAMIC: "SKINNING" "0..1"
  3. #include "common_vs_fxc.h"
  4. static const bool g_bSkinning = SKINNING ? true : false;
  5. static const bool g_bModel = MODEL ? true : false;
  6. struct VS_INPUT
  7. {
  8. float4 vPos : POSITION;
  9. float4 vBoneWeights : BLENDWEIGHT;
  10. float4 vBoneIndices : BLENDINDICES;
  11. float4 vTexCoord : TEXCOORD0;
  12. };
  13. struct VS_OUTPUT
  14. {
  15. float4 vProjPos : POSITION;
  16. float2 vTexCoord1 : TEXCOORD0;
  17. float2 vTexCoord2 : TEXCOORD1; //just a copy of vTexCoord1, ps11 compatibility issue
  18. float vFog : FOG;
  19. };
  20. VS_OUTPUT main( const VS_INPUT v )
  21. {
  22. VS_OUTPUT o = ( VS_OUTPUT )0;
  23. float3 worldPos;
  24. if( MODEL == 1 )
  25. {
  26. SkinPosition(
  27. g_bSkinning,
  28. v.vPos,
  29. v.vBoneWeights, v.vBoneIndices,
  30. worldPos );
  31. }
  32. else
  33. {
  34. worldPos = mul( v.vPos.xyz, cModel[0] );
  35. }
  36. o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  37. o.vTexCoord1 = v.vTexCoord.xy;
  38. o.vTexCoord2 = v.vTexCoord.xy;
  39. o.vFog = CalcFog( worldPos, o.vProjPos.xyz, FOGTYPE_RANGE );
  40. return o;
  41. }