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.

39 lines
1.4 KiB

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. //paired with vertexlit_and_unlit_generic_vs##
  3. #include "common_fog_ps_fxc.h"
  4. // DYNAMIC: "WRITE_DEPTH_TO_DESTALPHA" "0..1" [ps20b] [PC]
  5. // DYNAMIC: "WRITE_DEPTH_TO_DESTALPHA" "0..1" [ps30] [PC]
  6. // DYNAMIC: "WRITE_DEPTH_TO_DESTALPHA" "0..0" [ps20b] [CONSOLE]
  7. #if defined( SHADER_MODEL_PS_2_0 )
  8. #define WRITE_DEPTH_TO_DESTALPHA 0
  9. #endif
  10. #include "common_ps_fxc.h"
  11. #include "shader_constant_register_map.h"
  12. sampler BaseTextureSampler : register( s0 );
  13. const float4 g_WhiteGrayMix : register( c0 );
  14. const float4 g_FogParams : register( PSREG_FOG_PARAMS );
  15. const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
  16. struct PS_INPUT
  17. {
  18. float2 vTexCoord0 : TEXCOORD0;
  19. float4 vColor : COLOR0;
  20. float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
  21. };
  22. float4_color_return_type main( PS_INPUT i ) : COLOR
  23. {
  24. float4 textureColor = tex2D( BaseTextureSampler, i.vTexCoord0 );
  25. float4 resultColor = saturate( textureColor * i.vColor );
  26. resultColor.rgb = lerp( g_WhiteGrayMix.rgb, resultColor.rgb, resultColor.a );
  27. float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.xyz, i.worldPos_projPosZ.xyz, i.worldPos_projPosZ.w );
  28. return FinalOutput( resultColor, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_NONE, (WRITE_DEPTH_TO_DESTALPHA != 0), i.worldPos_projPosZ.w );
  29. }