Counter Strike : Global Offensive Source Code
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.

46 lines
939 B

  1. // DYNAMIC: "SKINNING" "0..1"
  2. // DYNAMIC: "COMPRESSED_VERTS" "0..1"
  3. #include "common_fog_vs_fxc.h"
  4. #include "common_vs_fxc.h"
  5. struct VS_INPUT
  6. {
  7. float4 vPos : POSITION;
  8. #if (SKINNING == 1)
  9. float4 vBoneWeights : BLENDWEIGHT;
  10. float4 vBoneIndices : BLENDINDICES;
  11. #endif
  12. };
  13. struct VS_OUTPUT
  14. {
  15. float4 vProjPos : POSITION;
  16. };
  17. VS_OUTPUT main( const VS_INPUT v )
  18. {
  19. VS_OUTPUT o = ( VS_OUTPUT )0;
  20. # if (SKINNING == 1)
  21. {
  22. float3 vWorldPos;
  23. SkinPosition( true, v.vPos, v.vBoneWeights, v.vBoneIndices, vWorldPos );
  24. o.vProjPos = mul( float4( vWorldPos, 1 ), cViewProj );
  25. }
  26. # else
  27. {
  28. float3 worldPos;
  29. worldPos = mul4x3( v.vPos, cModel[0] );
  30. o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  31. }
  32. # endif
  33. #ifdef _PS3
  34. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  35. o.vProjPos.y = -o.vProjPos.y;
  36. o.vProjPos.z = 2.0f * o.vProjPos.z - o.vProjPos.w;
  37. #endif // _PS3
  38. return o;
  39. }