killed old zoom so that framebuffer would render without hack

This commit is contained in:
minjaesong
2017-07-04 20:11:54 +09:00
parent fbe02ab19c
commit 2ac7efeaac
5 changed files with 106 additions and 34 deletions

View File

@@ -1,19 +1,73 @@
precision highp float;
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
uniform vec3 iResolution;
uniform sampler2D iChannel0;
uniform bool flip;
uniform vec2 direction;
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
//uniform mat4 u_projTrans;
#pragma glslify: blur = require('13')
varying vec4 vertexWorldPos;
uniform vec4 backColor;
uniform float width;
uniform float height;
void main() {
vec2 uv = vec2(gl_FragCoord.xy / iResolution.xy);
if (flip) {
uv.y = 1.0 - uv.y;
}
vec2 tex;
vec4 color2=vec4(0.0,0.0,0.0,0);
float stepx=(1.0/width)*4.0;
float stepy=(1.0/height)*4.0;
vec4 color;
tex.x=v_texCoords.x+stepx;
tex.y=v_texCoords.y+stepy;
color=v_color * texture2D(u_texture, tex);
color2.r+=color.r;
color2.g+=color.g;
color2.b+=color.b;
color2.a+=color.a;
tex.x=v_texCoords.x-stepx;
tex.y=v_texCoords.y+stepy;
color=v_color * texture2D(u_texture, tex);
color2.r+=color.r;
color2.g+=color.g;
color2.b+=color.b;
color2.a+=color.a;
tex.x=v_texCoords.x-stepx;
tex.y=v_texCoords.y-stepy;
color=v_color * texture2D(u_texture, tex);
color2.r+=color.r;
color2.g+=color.g;
color2.b+=color.b;
color2.a+=color.a;
tex.x=v_texCoords.x+stepx;
tex.y=v_texCoords.y-stepy;
color=v_color * texture2D(u_texture, tex);
color2.r+=color.r;
color2.g+=color.g;
color2.b+=color.b;
color2.a+=color.a;
tex.x=v_texCoords.x;
tex.y=v_texCoords.y;
color=v_color * texture2D(u_texture, tex);
color2.r+=color.r;
color2.g+=color.g;
color2.b+=color.b;
color2.a+=color.a;
color2.r/=5.0;
color2.g/=5.0;
color2.b/=5.0;
color2.a/=5.0;
gl_FragColor = color2;
gl_FragColor = blur(iChannel0, uv, iResolution.xy, direction);
}