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.

51 lines
2.1 KiB

  1. //========= Copyright � 1996-2006, Valve Corporation, All rights reserved. ============//
  2. // Includes =======================================================================================
  3. // STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
  4. // STATIC: "CONVERT_TO_SRGB" "0..1" [ps30][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
  5. // STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
  6. #include "common_vertexlitgeneric_dx9.h"
  7. // Texture Samplers ===============================================================================
  8. sampler g_tBaseSampler : register( s0 );
  9. sampler g_tFlowSampler : register( s1 );
  10. sampler g_tSelfIllumSampler : register( s2 );
  11. // Shaders Constants and Globals ==================================================================
  12. const float4 g_vPackedConst0 : register( c0 );
  13. #define g_flBlendStrength g_vPackedConst0.x
  14. #define g_flTime g_vPackedConst0.y
  15. const float2 g_vEmissiveScrollVector : register( c1 );
  16. const float3 g_cSelfIllumTint : register( c2 );
  17. // Interpolated values ============================================================================
  18. struct PS_INPUT
  19. {
  20. float2 vTexCoord0 : TEXCOORD0;
  21. };
  22. // Main ===========================================================================================
  23. //float4 main( PS_INPUT i ) : COLOR // Non-HDR for debugging
  24. float4 main( PS_INPUT i ) : COLOR
  25. {
  26. // Color texture
  27. float4 cBaseColor = tex2D( g_tBaseSampler, i.vTexCoord0.xy );
  28. // Fetch from dudv map and then fetch from emissive texture with new uv's & scroll
  29. float4 vFlowValue = tex2D( g_tFlowSampler, i.vTexCoord0.xy );
  30. float2 vEmissiveTexCoord = vFlowValue.xy + ( g_vEmissiveScrollVector.xy * g_flTime );
  31. float4 cEmissiveColor = tex2D( g_tSelfIllumSampler, vEmissiveTexCoord.xy );
  32. //===============//
  33. // Combine terms //
  34. //===============//
  35. float4 result;
  36. result.rgb = cBaseColor.rgb * cEmissiveColor.rgb * g_cSelfIllumTint.rgb;
  37. result.rgb *= g_flBlendStrength;
  38. // Set alpha to 0.0f so it doesn't change dest alpha (I should probably disable dest alpha writes)
  39. result.a = 0.0f;
  40. return FinalOutput( result, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_LINEAR );
  41. }