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
1.0 KiB

  1. // DYNAMIC: "COMPRESSED_VERTS" "0..1"
  2. // DYNAMIC: "SKINNING" "0..1"
  3. #include "common_vs_fxc.h"
  4. static const bool g_bSkinning = SKINNING ? true : false;
  5. const float2 cDepthFactor : register( SHADER_SPECIFIC_CONST_0 );
  6. struct VS_INPUT
  7. {
  8. float4 vPos : POSITION;
  9. float4 vBoneWeights : BLENDWEIGHT;
  10. float4 vBoneIndices : BLENDINDICES;
  11. };
  12. struct VS_OUTPUT
  13. {
  14. float4 projPos : POSITION;
  15. float2 zValue : TEXCOORD0;
  16. };
  17. VS_OUTPUT main( const VS_INPUT v )
  18. {
  19. VS_OUTPUT o = ( VS_OUTPUT )0;
  20. float3 worldPos;
  21. SkinPosition( g_bSkinning, v.vPos, v.vBoneWeights, v.vBoneIndices, worldPos );
  22. float4 projPos = mul( float4( worldPos, 1 ), cViewProj );
  23. o.projPos = projPos;
  24. o.zValue.x = (o.projPos.z - cDepthFactor.y) / cDepthFactor.x;
  25. o.zValue.y = (o.projPos.w - cDepthFactor.y) / cDepthFactor.x;
  26. #ifdef _PS3
  27. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  28. o.projPos.y = -o.projPos.y;
  29. o.projPos.z = 2.0f * o.projPos.z - o.projPos.w;
  30. #endif // _PS3
  31. return o;
  32. }