Team Fortress 2 Source Code as on 22/4/2020
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.

47 lines
1.4 KiB

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