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.

48 lines
1.9 KiB

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