X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=luma_mix_effect.frag;h=e721a885892a17ea9ff303570169292d978aa830;hp=bf0833eec8d0c834c3b9048f32b3edd359ff8255;hb=e90eb349c71419e874f34f1ab122f57bebeacda7;hpb=b757191bc6d258887445d88cdfe5b18666295660 diff --git a/luma_mix_effect.frag b/luma_mix_effect.frag index bf0833e..e721a88 100644 --- a/luma_mix_effect.frag +++ b/luma_mix_effect.frag @@ -1,4 +1,6 @@ -uniform float PREFIX(progress_mul_w_plus_one); +// Implicit uniforms: +// uniform float PREFIX(progress_mul_w_plus_one); +// uniform bool PREFIX(inverse); vec4 FUNCNAME(vec2 tc) { vec4 first = INPUT1(tc); @@ -36,8 +38,11 @@ vec4 FUNCNAME(vec2 tc) { // So clearly, it should move (w+1) units to the right, and apart from that // just stay a simple mapping. float w = PREFIX(transition_width); - float luma = INPUT3(tc).x * w; - float m = clamp((luma - w) + PREFIX(progress_mul_w_plus_one), 0.0, 1.0); + float luma = INPUT3(tc).x; + if (PREFIX(inverse)) { + luma = 1.0 - luma; + } + float m = clamp((luma * w - w) + PREFIX(progress_mul_w_plus_one), 0.0, 1.0); return mix(first, second, m); }