From 300d5daa2b98789081143c16fa760d9a827367e2 Mon Sep 17 00:00:00 2001 From: Fahad Hasan Pathik Date: Thu, 25 Apr 2019 21:08:03 +0600 Subject: [PATCH] Crop Inverse feature added --- effects/shaders/crop.frag | 19 ++++++++++++++----- effects/shaders/crop.xml | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/effects/shaders/crop.frag b/effects/shaders/crop.frag index 7fed98944..0cfbeeba8 100644 --- a/effects/shaders/crop.frag +++ b/effects/shaders/crop.frag @@ -5,6 +5,7 @@ uniform float top; uniform float right; uniform float bottom; uniform float feather; +uniform bool invert; uniform mediump float amount_val; uniform sampler2D myTexture; @@ -25,10 +26,18 @@ void main(void) { if (bottom > 0.0) alpha = alpha * clamp((((1.0-vTexCoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom } - gl_FragColor = vec4( - textureColor.r*alpha, - textureColor.g*alpha, - textureColor.b*alpha, + if (invert) + {gl_FragColor = vec4( + textureColor.r*(1.0 - alpha), + textureColor.g*(1.0 - alpha), + textureColor.b*(1.0 - alpha), + 1.0 - alpha + );} + else{ + gl_FragColor = vec4( + textureColor.r*(alpha), + textureColor.g*(alpha), + textureColor.b*(alpha), alpha - ); + );} } \ No newline at end of file diff --git a/effects/shaders/crop.xml b/effects/shaders/crop.xml index caa8a578c..be819a988 100644 --- a/effects/shaders/crop.xml +++ b/effects/shaders/crop.xml @@ -16,4 +16,7 @@ + + + \ No newline at end of file