1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-23 06:18:00 +03:00
Mindustry/core/assets/shaders/build.fragment
2018-11-15 10:01:03 -05:00

47 lines
884 B
Plaintext

#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D u_texture;
uniform float u_time;
uniform float u_progress;
uniform vec4 u_color;
uniform vec2 u_uv;
uniform vec2 u_uv2;
uniform vec2 u_texsize;
varying vec4 v_color;
varying vec2 v_texCoord;
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
bool id(vec4 v){
return v.a > 0.1;
}
void main() {
vec2 coords = (v_texCoord.xy - u_uv) / (u_uv2 - u_uv);
vec2 t = v_texCoord.xy;
vec4 c = texture2D(u_texture, v_texCoord.xy);
if(1.0-abs(coords.x - 0.5)*2.0 < 1.0-u_progress){
c = vec4(0.0);
}
if(c.a > 0.01){
float f = abs(sin(coords.x*2.0 + u_time));
if(f > 0.9 )
f = 1.0;
else
f = 0.0;
c = mix(c, u_color, f * u_color.a);
}
gl_FragColor = c * v_color;
}