Mindustry/core/assets/shaders/menu.fragment

33 lines
797 B
Plaintext

#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D u_texture;
uniform vec2 u_resolution;
uniform int u_time;
uniform vec2 u_uv;
uniform vec2 u_uv2;
uniform float u_scl;
varying vec4 v_color;
varying vec2 v_texCoord;
void main() {
ivec2 coords = ivec2((gl_FragCoord.xy - u_resolution/2.0)/u_scl);
int roundx = 8;
int roundy = roundx;
float roundm = 0.2;
coords.x = (coords.x / roundx) * roundx;
coords.y = (coords.y / roundy) * roundy;
float d = (abs(float(coords.x)) - abs(float(coords.y)));
float m = abs(sin(-float(u_time)/50.0 + d/120.0));
m = float(int(m / roundm)) * roundm + roundm;
gl_FragColor.rgb = mix(v_color.rgb, vec3(0.0), m);
gl_FragColor.a = mod(abs(float(coords.x)) + abs(float(coords.y)), 110.0) < 35.0 ? 1.0 : 0.0;
}