blob: c0ac9ed32577324db9404075e899a5b28b3b6ae2 [file] [log] [blame]
Skyler Greyc6be0862022-08-26 06:52:47 +01001#extension GL_OES_standard_derivatives : enable
2
3precision highp float;
4
5uniform float time;
6uniform vec2 mouse;
7uniform vec2 resolution;
8
9vec3 white = vec3(1, 1, 1);
10vec3 amaranth_pink = vec3(0.945, 0.612, 0.733);
11vec3 maya_blue = vec3(0.298, 0.624, 0.886);
12
13vec3 color_for_position (vec2 position) {
14 vec3 color = white;
15
16 if (sin(position.x + time / 30.0) / 2.0 - position.y + 0.4 < 0.0) {
17 color = amaranth_pink;
18 } else if (sin(position.x / 5.0 + time / 21.0 + 20.0) / 2.0 - position.y + 0.5 < 0.0) {
19 color = maya_blue;
20 }
21
22 return color;
23}
24
25void main( void ) {
26 vec2 position = ( gl_FragCoord.xy / resolution.xy );
27
28 float r = 0.0;
29 float g = 0.0;
30 float b = 0.0;
31
32 float sampleSqrt = 3.0;
33
34 for (float x = 0.0; x < sampleSqrt; x++) {
35 for (float y = 0.0; y < sampleSqrt; y++) {
36 vec3 color = color_for_position(
37 vec2(
38 (x / (resolution.x * sampleSqrt)) + position.x,
39 (y / (resolution.y * sampleSqrt)) + position.y
40 )
41 );
42 r += color.r;
43 g += color.g;
44 b += color.b;
45 }
46 }
47
48 r /= sampleSqrt * sampleSqrt * 0.75;
49 g /= sampleSqrt * sampleSqrt * 0.75;
50 b /= sampleSqrt * sampleSqrt * 0.75;
51
52 gl_FragColor = vec4(vec3(r, g, b), 1.0);
53}