some rendering and effect fixes

This commit is contained in:
itsmattkc
2019-03-28 19:38:40 +11:00
parent 45ce93d601
commit 7f06330815
5 changed files with 33 additions and 31 deletions
+20 -6
View File
@@ -7,18 +7,32 @@ uniform float feather;
uniform mediump float amount_val;
vec4 process(vec4 col) {
float alpha = col.a;
float alpha = 1.0;
if (feather == 0.0) {
if (v_texcoord.x < (left*0.01) || v_texcoord.y < (top*0.01) || v_texcoord.x > (1.0-(right*0.01)) || v_texcoord.y > (1.0-(bottom*0.01))) {
alpha = 0.0;
}
} else {
float f = pow(2.0, 10.0-(feather*0.1));
if (left > 0.0) alpha = alpha * clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left
if (top > 0.0) alpha = alpha * clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top
if (right > 0.0) alpha = alpha * clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right
if (bottom > 0.0) alpha = alpha * clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
if (left > 0.0) {
alpha = clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left
}
if (top > 0.0) {
alpha = clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top
}
if (right > 0.0) {
alpha = clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right
}
if (bottom > 0.0) {
alpha = clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
}
}
return vec4(col.rgb*alpha, alpha);
return col * alpha;
}
+5 -14
View File
@@ -1,23 +1,14 @@
#version 110
uniform bool horiz;
uniform bool vert;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
vec4 process(vec4 col) {
float x = v_texcoord.x;
float y = v_texcoord.y;
void main(void) {
float x = vTexCoord.x;
float y = vTexCoord.y;
if (!horiz && !vert) return col;
if (horiz) x = 1.0 - x;
if (vert) y = 1.0 - y;
vec4 textureColor = texture2D(myTexture, vec2(x, y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
return texture2D(texture, vec2(x, y));
}
-6
View File
@@ -1,11 +1,5 @@
#define M_PI 3.1415926535897932384626433832795
<<<<<<< HEAD
=======
uniform sampler2D image;
//uniform float radius;
>>>>>>> master
uniform float sigma;
uniform vec2 resolution;
uniform bool horiz_blur;