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.

37 lines
1.1 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. // DYNAMIC: "PIXELFOGTYPE" "0..1"
  7. // STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
  8. // STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
  9. #include "common_ps_fxc.h"
  10. #include "shader_constant_register_map.h"
  11. sampler EnvmapSampler : 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. float3 eyeToVertVector : TEXCOORD0;
  17. float4 vertexColor : COLOR;
  18. float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
  19. };
  20. float4 main( PS_INPUT i ) : COLOR
  21. {
  22. HALF4 color;
  23. color.xyz = ENV_MAP_SCALE * texCUBE( EnvmapSampler, i.eyeToVertVector );
  24. color.a = 1.0f;
  25. color *= i.vertexColor;
  26. float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.z, i.worldPos_projPosZ.z, i.worldPos_projPosZ.w );
  27. return FinalOutput( color, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_LINEAR );
  28. }