#include "core.fsh"
#define DISL_DISABLE_SHADOW
#include "commonInput.fsh"
#include "light.fsh"

layout(location = 0) out vec4 fragColor;
in float depth_f;
uniform vec4 depthCol;
//uniform float depthColMix;
//uniform float alphaFactor;
uniform vec4 compansateColor;
// warn: 修改隧道路和普通路着色器请确保两者连接效果一致
void main()
{
    float factor = (clamp(depth_f, 1.0, 4.0) - 1.0) / 3.0;
    vec4 albedo = getBaseCol();
//    vec4 tunnelCol = mix(albedo, depthCol, depthColMix);
    albedo = mix(albedo, depthCol, factor);
//    albedo.a = albedo.a * (1.0 - factor * alphaFactor);
    vec3 lightIntensity = CalLightIntensity(getNormal(), 1.0);
    albedo.rgb = albedo.rgb * lightIntensity;
    albedo.rgb = mix(albedo.rgb, compansateColor.rgb, compansateColor.a * (1.0 - factor));
    fragColor = albedo;
}
