precision highp float;

varying vec3 vNormal;
varying vec4 vMVPos;

uniform vec3 uFogColor;

void main() {

    vec3 normal = normalize(vNormal);
    float lighting = dot(normal, normalize(vec3(-0.3, 0.8, 0.6)));

    vec3 color =  vec3(0.95, 0.5, 0.2) + lighting * 0.1;

    float dist = length(vMVPos);
    
    float fog = smoothstep(15.0, 17.0, dist);

    color = mix(color, uFogColor, fog);

    gl_FragColor.rgb = color;
    gl_FragColor.a = 1.0;

}
