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.

40 lines
1.3 KiB

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