Mindustry/core/assets/shaders/water.fragment

18 lines
426 B
Plaintext
Raw Normal View History

2018-03-14 09:34:52 +07:00
#ifdef GL_ES
2019-01-30 10:26:02 +07:00
precision mediump float;
2018-03-14 09:34:52 +07:00
#endif
varying vec4 v_color;
2019-01-30 10:26:02 +07:00
varying vec2 v_texCoords;
2018-03-14 09:34:52 +07:00
2019-01-30 10:26:02 +07:00
uniform sampler2D u_texture;
uniform float u_time;
2018-03-14 09:34:52 +07:00
2019-01-30 10:26:02 +07:00
float round(float f, float v){
return float(int(f / v)) * v;
2018-03-14 09:34:52 +07:00
}
2019-01-30 10:26:02 +07:00
void main(){
vec2 r = v_texCoords.xy;
vec4 c = v_color * texture2D(u_texture, v_texCoords.xy);
gl_FragColor = c * vec4(vec3(round(1.0 + sin((r.x + r.y) * 404.0 + u_time / 20.0) / 10.0, 0.05)), 1.0);
}