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.

54 lines
1.5 KiB

  1. #include "common_fog_vs_fxc.h"
  2. #include "common_vs_fxc.h"
  3. static const int g_FogType = DOWATERFOG;
  4. struct VS_INPUT
  5. {
  6. float4 vPos : POSITION;
  7. float4 vTexCoord0 : TEXCOORD0;
  8. float4 colorAlpha : COLOR; // Used only for vertex alpha currently.
  9. };
  10. struct VS_OUTPUT
  11. {
  12. float4 projPos : POSITION; // Projection-space position
  13. #if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
  14. float fog : FOG;
  15. #endif
  16. float2 baseTexCoord : TEXCOORD0; // Base texture coordinate
  17. float4 worldPos_projPosZ : TEXCOORD1; // Necessary for water fog dest alpha
  18. float flAlpha : TEXCOORD2;
  19. };
  20. VS_OUTPUT main( const VS_INPUT v )
  21. {
  22. VS_OUTPUT o = ( VS_OUTPUT )0;
  23. float4 projPos;
  24. float3 worldPos;
  25. // Need to use SkinPosition() to guarantee consistency with other shaders on X360.
  26. // The function uses [isolate] properly and simply does a mul4x3 if skinning is set to 'false'.
  27. SkinPosition( false, float4( v.vPos.xyz, 1 ), 0, 0, worldPos );
  28. projPos = mul( float4( worldPos, 1 ), cViewProj );
  29. #ifdef _PS3
  30. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  31. projPos.y = -projPos.y;
  32. projPos.z = 2.0f * projPos.z - projPos.w;
  33. #endif // _PS3
  34. o.projPos = projPos;
  35. #if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
  36. o.fog = CalcFixedFunctionFog( worldPos, g_FogType );
  37. #endif
  38. o.worldPos_projPosZ = float4( worldPos, projPos.z );
  39. o.baseTexCoord.xy = v.vTexCoord0.xy;
  40. o.flAlpha = v.colorAlpha.a;
  41. return o;
  42. }