Mindustry/core/assets/shaders/unitbuild.frag

31 lines
616 B
GLSL
Raw Normal View History

2018-03-26 03:47:01 +07:00
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;
2020-06-15 05:41:42 +07:00
varying vec2 v_texCoords;
2018-03-26 03:47:01 +07:00
2020-10-28 01:54:48 +07:00
void main(){
2022-01-17 10:53:58 +07:00
vec2 coords = (v_texCoords - u_uv) / (u_uv2 - u_uv);
2019-02-22 02:08:42 +07:00
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
2018-03-26 03:47:01 +07:00
2022-01-17 10:53:58 +07:00
vec4 c = texture2D(u_texture, v_texCoords);
2020-05-24 06:14:48 +07:00
float alpha = c.a;
2018-03-26 03:47:01 +07:00
2019-06-15 08:06:58 +07:00
c.a *= u_progress;
2018-11-15 22:01:03 +07:00
if(c.a > 0.01){
2022-01-17 10:53:58 +07:00
float f = step(abs(sin(coords.x*2.0 + u_time)), 0.9);
2018-03-26 10:49:40 +07:00
c = mix(c, u_color, f * u_color.a);
2018-03-26 03:47:01 +07:00
}
2020-05-24 06:14:48 +07:00
c.a *= alpha;
2018-03-26 03:47:01 +07:00
gl_FragColor = c * v_color;
}