mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 06:06:50 +00:00
38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. =======
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================
|
|
|
|
// DYNAMIC: "PIXELFOGTYPE" "0..1"
|
|
|
|
// STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
|
|
// STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
|
|
|
|
#include "common_ps_fxc.h"
|
|
#include "shader_constant_register_map.h"
|
|
|
|
sampler EnvmapSampler : register( s0 );
|
|
|
|
const float4 g_FogParams : register( PSREG_FOG_PARAMS );
|
|
const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
|
|
|
|
struct PS_INPUT
|
|
{
|
|
float3 eyeToVertVector : TEXCOORD0;
|
|
float4 vertexColor : COLOR;
|
|
|
|
float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
|
|
};
|
|
|
|
float4 main( PS_INPUT i ) : COLOR
|
|
{
|
|
HALF4 color;
|
|
color.xyz = ENV_MAP_SCALE * texCUBE( EnvmapSampler, i.eyeToVertVector );
|
|
color.a = 1.0f;
|
|
color *= i.vertexColor;
|
|
|
|
float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.z, i.worldPos_projPosZ.z, i.worldPos_projPosZ.w );
|
|
return FinalOutput( color, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_LINEAR );
|
|
}
|