#include "/lib/voxy_main.glsl"

layout(location = 0) out vec4 outColor;

void voxy_emitFragment(VoxyFragmentParameters parameters) {
    vec3 playerPosition = voxyPlayerPosition();
    vec3 normal = voxyFaceNormal(parameters.face);
    vec3 albedo = max(
        parameters.sampledColour.rgb * parameters.tinting.rgb,
        vec3(0.0)
    );

    vec3 color = voxyApplyLighting(albedo, normal, parameters.lightMap);
    color = voxyApplyAtmosphere(color, playerPosition, normal, parameters.lightMap);
    outColor = vec4(color, 1.0);
}
