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.

57 lines
1.1 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. float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
  20. };
  21. VS_OUTPUT main( const VS_INPUT v )
  22. {
  23. VS_OUTPUT o = ( VS_OUTPUT )0;
  24. float3 worldPos;
  25. if( MODEL == 1 )
  26. {
  27. SkinPosition(
  28. g_bSkinning,
  29. v.vPos,
  30. v.vBoneWeights, v.vBoneIndices,
  31. worldPos );
  32. }
  33. else
  34. {
  35. worldPos = mul( v.vPos.xyz, cModel[0] );
  36. }
  37. o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  38. o.worldPos_projPosZ = float4( worldPos.xyz, o.vProjPos.z );
  39. o.vTexCoord1 = v.vTexCoord.xy;
  40. o.vTexCoord2 = v.vTexCoord.xy;
  41. o.vFog = CalcFog( worldPos, o.vProjPos.xyz, FOGTYPE_RANGE );
  42. return o;
  43. }