Build shader swap

This commit is contained in:
Anuken 2019-02-26 16:02:06 -05:00
parent 4eba89603e
commit 8f4258b119

View File

@ -3,6 +3,8 @@ precision mediump float;
precision mediump int; precision mediump int;
#endif #endif
#define step 3.0
uniform sampler2D u_texture; uniform sampler2D u_texture;
uniform float u_time; uniform float u_time;
@ -15,19 +17,22 @@ uniform vec2 u_texsize;
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_texCoord; varying vec2 v_texCoord;
#define SPACE 1.3 bool id(vec4 v){
#define RADIUS 2.0 return v.a > 0.1;
}
bool cont(vec2 t, vec2 v){ bool id(vec2 coords, vec4 base){
vec4 target = texture2D(u_texture, coords);
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
}
for(float cx = -RADIUS; cx <= RADIUS; cx ++){ bool cont(vec2 T, vec2 v){
for(float cy = -RADIUS; cy <= RADIUS; cy ++){ vec4 base = texture2D(u_texture, T);
if(cx*cx + cy*cy <= RADIUS * RADIUS && texture2D(u_texture, v_texCoord.xy + vec2(cx, cy) * v * SPACE).a <= 0.001){ return base.a > 0.1 &&
return true; (id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
} id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base) ||
} id(T + vec2(step, step) * v, base) || id(T + vec2(-step, -step) * v, base) ||
} id(T + vec2(step, -step) * v, base) || id(T + vec2(-step, step) * v, base));
return false;
} }
void main() { void main() {