#import bevy_pbr::forward_io::VertexOutput

struct ActorIconOverlayMaterial {
    brightness: f32,
}

@group(#{MATERIAL_BIND_GROUP}) @binding(0)
var icon_texture: texture_2d<f32>;

@group(#{MATERIAL_BIND_GROUP}) @binding(1)
var icon_sampler: sampler;

@group(#{MATERIAL_BIND_GROUP}) @binding(2)
var<uniform> material: ActorIconOverlayMaterial;

@fragment
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
    let texel = textureSample(icon_texture, icon_sampler, in.uv);
    if texel.a < 0.01 {
        discard;
    }

    return vec4(texel.rgb * material.brightness, texel.a);
}
