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.

30 lines
932 B

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. #include "common_fog_ps_fxc.h"
  3. #include "common_ps_fxc.h"
  4. #include "shader_constant_register_map.h"
  5. sampler EnvmapSampler : register( s0 );
  6. const float4 g_FogParams : register( PSREG_FOG_PARAMS );
  7. const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
  8. struct PS_INPUT
  9. {
  10. float3 eyeToVertVector : TEXCOORD0;
  11. float4 vertexColor : COLOR;
  12. float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
  13. };
  14. float4 main( PS_INPUT i ) : COLOR
  15. {
  16. float4 color;
  17. color.xyz = ( float3 )( ENV_MAP_SCALE * texCUBE( EnvmapSampler, i.eyeToVertVector ) );
  18. color.a = 1.0f;
  19. color *= i.vertexColor;
  20. float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.xyz, i.worldPos_projPosZ.xyz, i.worldPos_projPosZ.w );
  21. return FinalOutput( color, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_LINEAR );
  22. }