#version 330 core

// Post-fx node: bright-pass (bloom source) whose threshold drops on the kick, so more of the frame
// feeds the bloom on each beat. uKick is a beat-reactive built-in from PostProcessGraph / BeatClock.
in vec2 ex_Uv;
out vec4 fragColor;

uniform sampler2D iChannel0;

uniform float uKick;     // low-band energy [0,1]
uniform float threshHi;  // bright-pass threshold at rest
uniform float threshLo;  // bright-pass threshold at full kick

void main() {
	vec3 c = texture(iChannel0, ex_Uv).rgb;
	float luma = dot(c, vec3(0.299, 0.587, 0.114));
	float th = mix(threshHi, threshLo, clamp(uKick, 0.0, 1.0));
	float t = smoothstep(th, th + 0.25, luma);
	fragColor = vec4(c * t, 1.0);
}
