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

in float weight_f;
in float alpha_f;
uniform lowp vec4 Cd1;
uniform lowp vec4 Cd2;

layout(location = 0) out vec4 fragColor;

void main()
{
    // hight/low level transition
    vec4 albedo = mix(Cd1, Cd2, smoothstep(0.0, 1.0, weight_f));
    albedo = mix(Cd_f, albedo, alpha_f);
    albedo.a *= alpha_f;
    
    vec3 lightIntensity = CalLightIntensity(getNormal(), 1.0);
    fragColor = vec4(albedo.rgb * lightIntensity, albedo.a);
}
