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.

45 lines
1.3 KiB

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. // STATIC: "MACROS" "0..1"
  3. #define HDRTYPE HDR_TYPE_NONE
  4. #include "common_ps_fxc.h"
  5. sampler BaseSampler : register( s0 );
  6. // NOTE: LightmapSampler is at the same place as the lightmap sampler in lightmappedgeneric so that we have
  7. // generally the same texture state here.
  8. sampler LightmapSampler: register( s1 );
  9. sampler BaseSampler2: register( s2 );
  10. sampler LightmapAlphaSampler: register( s3 );
  11. sampler MacrosSampler: register( s4 );
  12. struct PS_INPUT
  13. {
  14. float2 baseCoord : TEXCOORD0;
  15. float2 baseCoord2 : TEXCOORD1;
  16. float2 lightmapCoord : TEXCOORD2_centroid;
  17. float2 macrosCoord : TEXCOORD3;
  18. };
  19. float4 main( PS_INPUT i ) : COLOR
  20. {
  21. bool bMacros = MACROS ? true : false;
  22. float4 base = tex2D( BaseSampler, i.baseCoord );
  23. float4 base2 = tex2D( BaseSampler2, i.baseCoord2 );
  24. float4 lightmap = tex2D( LightmapSampler, i.lightmapCoord );
  25. float blendFactor = lightmap.a;
  26. float4 color = 2.0f * lightmap * lerp( base2, base, blendFactor );
  27. if( bMacros )
  28. {
  29. float4 macros = tex2D( MacrosSampler, i.macrosCoord );
  30. // Not sure what to do with macro alpha
  31. color.rgb *= 2.0f * lerp( macros.a, macros.b, blendFactor );
  32. }
  33. return FinalOutput( color, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
  34. }