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.

40 lines
1020 B

  1. #include "common_vs_fxc.h"
  2. const float4 cLightmapTexCoordTransform[2] : register( SHADER_SPECIFIC_CONST_0 );
  3. struct VS_INPUT
  4. {
  5. float3 vPos : POSITION;
  6. float2 vBaseTexCoord : TEXCOORD0;
  7. float2 vLightmapTexCoord : TEXCOORD1;
  8. };
  9. struct VS_OUTPUT
  10. {
  11. float4 projPos : POSITION;
  12. float2 baseTexCoord : TEXCOORD0;
  13. };
  14. VS_OUTPUT main( const VS_INPUT v )
  15. {
  16. VS_OUTPUT o = ( VS_OUTPUT )0;
  17. float4 projPos;
  18. float3 worldPos;
  19. worldPos = mul4x3( float4( v.vPos, 1 ), cModel[0] );
  20. projPos = mul( float4( worldPos, 1 ), cViewProj );
  21. o.projPos = projPos;
  22. o.baseTexCoord.x = dot( v.vLightmapTexCoord, cLightmapTexCoordTransform[0].xy ) + cLightmapTexCoordTransform[0].w;
  23. o.baseTexCoord.y = dot( v.vLightmapTexCoord, cLightmapTexCoordTransform[1].xy ) + cLightmapTexCoordTransform[1].w;
  24. #ifdef _PS3
  25. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  26. o.projPos.y = -o.projPos.y;
  27. o.projPos.z = 2.0f * o.projPos.z - o.projPos.w;
  28. #endif // _PS3
  29. return o;
  30. }