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;
#endif
#define step 3.0
uniform sampler2D u_texture;
uniform float u_time;
@ -15,19 +17,22 @@ uniform vec2 u_texsize;
varying vec4 v_color;
varying vec2 v_texCoord;
#define SPACE 1.3
#define RADIUS 2.0
bool id(vec4 v){
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 ++){
for(float cy = -RADIUS; cy <= RADIUS; cy ++){
if(cx*cx + cy*cy <= RADIUS * RADIUS && texture2D(u_texture, v_texCoord.xy + vec2(cx, cy) * v * SPACE).a <= 0.001){
return true;
}
}
}
return false;
bool cont(vec2 T, vec2 v){
vec4 base = texture2D(u_texture, T);
return base.a > 0.1 &&
(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));
}
void main() {