@shader_type spatial;
@render_mode unshaded;

@uniform sampler2D albedo_texture;
@uniform vec3 light_color = vec3(1.0, 1.0, 1.0);
@uniform float outline_width = 0.05;
@uniform vec3 outline_color = vec3(0.0, 0.0, 0.0);

void fragment() {
    // Fake directional light
    vec3 light_dir = normalize(vec3(0.5, 1.0, -0.5));
    vec3 norm = normalize(NORMAL);
    float intensity = dot(norm, light_dir);

    // Cel shading - Quantized lighting steps
    float shade = step(0.1, intensity) * 0.3 +
                  step(0.3, intensity) * 0.4 +
                  step(0.6, intensity) * 0.3;

    // Sample texture and apply shading
    vec4 tex_color = texture(albedo_texture, UV);
    vec3 final_color = tex_color.rgb * shade * light_color;

    ALBEDO = final_color;
}
