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.

62 lines
1.6 KiB

  1. #include "common_fog_vs_fxc.h"
  2. #include "common_vs_fxc.h"
  3. static const int g_FogType = DOWATERFOG;
  4. const float4 cBaseTexCoordTransform[2] : register( SHADER_SPECIFIC_CONST_0 );
  5. const float4 cBaseTexCoordTransform2[2] : register( SHADER_SPECIFIC_CONST_2 );
  6. const float4 cMacrosTexCoordTransform[2] : register( SHADER_SPECIFIC_CONST_4 );
  7. struct VS_INPUT
  8. {
  9. // This is all of the stuff that we ever use.
  10. float4 vPos : POSITION;
  11. float4 vColor : COLOR0;
  12. float4 vTexCoord0 : TEXCOORD0;
  13. float4 vTexCoord1 : TEXCOORD1;
  14. };
  15. struct VS_OUTPUT
  16. {
  17. float4 projPos : POSITION;
  18. #if !defined( _X360 )
  19. float fog : FOG;
  20. #endif
  21. float2 baseCoord : TEXCOORD0;
  22. float2 baseCoord2 : TEXCOORD1;
  23. float2 lightmapCoord : TEXCOORD2;
  24. float2 macrosCoord : TEXCOORD3;
  25. float4 color : COLOR0;
  26. };
  27. VS_OUTPUT main( const VS_INPUT v )
  28. {
  29. VS_OUTPUT o = ( VS_OUTPUT )0;
  30. float3 worldNormal, worldPos;
  31. float2 texCoord;
  32. worldPos = mul( v.vPos, cModel[0] );
  33. float4 projPos = mul( float4( worldPos, 1 ), cViewProj );
  34. o.projPos = projPos;
  35. o.fogFactorsYZW = CalcFog( worldPos, projPos, g_FogType );
  36. #if !defined( _X360 )
  37. o.fog = o.fogFactorsYZW;
  38. #endif
  39. o.color = v.vColor;
  40. o.baseCoord.x = dot( v.vTexCoord0, cBaseTexCoordTransform[0] );
  41. o.baseCoord.y = dot( v.vTexCoord0, cBaseTexCoordTransform[1] );
  42. o.baseCoord2.x = dot( v.vTexCoord0, cBaseTexCoordTransform2[0] );
  43. o.baseCoord2.y = dot( v.vTexCoord0, cBaseTexCoordTransform2[1] );
  44. o.lightmapCoord = v.vTexCoord1;
  45. o.macrosCoord.x = dot( v.vTexCoord0, cMacrosTexCoordTransform[0] );
  46. o.macrosCoord.y = dot( v.vTexCoord0, cMacrosTexCoordTransform[1] );
  47. return o;
  48. }