diff --git a/effects/colorsel.frag b/effects/colorsel.frag index 801c96b73..05ddff90d 100644 --- a/effects/colorsel.frag +++ b/effects/colorsel.frag @@ -10,6 +10,7 @@ varying vec2 vTexCoord; uniform float loc; uniform float hic; uniform int compo; +uniform bool invert; float rgb2luma(vec3 c) { return (max(max(c.r,c.g), c.b) + min(min(c.r,c.g), c.b))/2.0; @@ -63,27 +64,27 @@ void main(void) { switch(compo) { case 0 : - toCheck = rgb2luma(color); + toCheck = rgb2luma(color)*100.0; break; case 4 : - toCheck = color.r; + toCheck = color.r*100.0; break; case 5 : - toCheck = color.g; + toCheck = color.g*100.0; break; case 6 : - toCheck = color.b; + toCheck = color.b*100.0; break; case 1 : - toCheck = rgb2hsv(color).z; + toCheck = rgb2hsv(color).z*100.0; break; case 2 : - toCheck = rgb2hsv(color).x/360.0; + toCheck = rgb2hsv(color).x/3.6; break; case 3 : - toCheck = rgb2hsv(color).y; + toCheck = rgb2hsv(color).y*100.0; break; } - tc.a = isNotIncreasingSequence(loc, toCheck, hic) ? 0.0 : tc.a; + tc.a = isNotIncreasingSequence(loc, toCheck, hic) ? (invert ? tc.a : 0.0) : (invert ? 0.0 : tc.a); gl_FragColor = tc; } diff --git a/effects/colorsel.xml b/effects/colorsel.xml index 2a486afd2..00a4c865a 100644 --- a/effects/colorsel.xml +++ b/effects/colorsel.xml @@ -12,10 +12,13 @@ - + - + + + + diff --git a/effects/lumakey.frag b/effects/lumakey.frag index 3ded5dac5..d8092c4cb 100644 --- a/effects/lumakey.frag +++ b/effects/lumakey.frag @@ -7,6 +7,7 @@ varying vec2 vTexCoord; uniform float loc; uniform float hic; +uniform bool invert; void main(void) { vec4 texture_color = texture2D(tex,vTexCoord); @@ -15,12 +16,12 @@ void main(void) { luma /= 2.0; - if (luma > hic) { - texture_color.a = 1.0; - } else if (luma < loc) { - texture_color.a = 0.0; + if (luma > hic/100.0) { + texture_color.a = (invert ? 0.0 : 1.0); + } else if (luma < loc/100.0) { + texture_color.a = (invert ? 1.0 : 0.0); } else { - texture_color.a = luma; + texture_color.a = (invert ? 1.0-luma : luma); } gl_FragColor = texture_color; diff --git a/effects/lumakey.xml b/effects/lumakey.xml index 03b933877..0c3175c2e 100644 --- a/effects/lumakey.xml +++ b/effects/lumakey.xml @@ -1,10 +1,13 @@ - + - + + + + - \ No newline at end of file +