Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 300 es
- #ifndef REDUCER
- #define _GLF_ZERO(X, Y) (Y)
- #define _GLF_ONE(X, Y) (Y)
- #define _GLF_FALSE(X, Y) (Y)
- #define _GLF_TRUE(X, Y) (Y)
- #define _GLF_IDENTITY(X, Y) (Y)
- #define _GLF_DEAD(X) (X)
- #define _GLF_FUZZED(X) (X)
- #define _GLF_WRAPPED_LOOP(X) X
- #define _GLF_WRAPPED_IF_TRUE(X) X
- #define _GLF_WRAPPED_IF_FALSE(X) X
- #define _GLF_SWITCH(X) X
- #endif
- // END OF GENERATED HEADER
- precision highp float;
- uniform vec2 injectionSwitch;
- layout(location = 0) out vec4 _GLF_color;
- uniform vec2 resolution;
- vec3 pickColor(int i)
- {
- return vec3(float(i) / 50.0, float(i) / 120.0, float(i) / 140.0);
- }
- vec3 mand(float xCoord, float yCoord)
- {
- float height = vec2(256.0, 256.0).y;
- float width = (256.0);
- float c_re = 0.8 * (xCoord - ((256.0)) / 2.0) * 4.0 / width - 0.4;
- float c_im = 0.8 * (yCoord - height / 2.0) * 4.0 / width;
- float x = 0.0, y = 0.0;
- if(_GLF_DEAD(false))
- return vec3(1.0);
- int iteration = 0;
- if(_GLF_DEAD(false))
- return vec3(1.0);
- if(_GLF_DEAD(false))
- return vec3(1.0);
- if(_GLF_DEAD(false))
- return vec3(1.0);
- if(_GLF_DEAD(false))
- {
- }
- if(_GLF_DEAD(false))
- discard;
- for(
- int k = 0;
- k < 1000;
- k ++
- )
- {
- if(x * x + y * y > 4.0)
- {
- break;
- }
- float x_new = x * x - y * y + c_re;
- y = 2.0 * x * y + c_im;
- x = x_new;
- iteration ++;
- }
- if(iteration < 1000)
- {
- return pickColor(iteration);
- }
- else
- {
- return vec3(0.0);
- }
- }
- void main()
- {
- vec3 data[16];
- for(
- int i = 0;
- i < 4;
- i ++
- )
- {
- for(
- int j = 0;
- j < 4;
- j ++
- )
- {
- data[4 * j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
- }
- }
- vec3 sum = vec3(0.0);
- for(
- int i = 0;
- i < 16;
- i ++
- )
- {
- sum += data[i];
- }
- sum /= vec3(16.0);
- for(
- int _injected_loop_counter = int(0.0);
- _GLF_WRAPPED_LOOP(_injected_loop_counter != int(_GLF_ONE(1.0, injectionSwitch.y)));
- _injected_loop_counter ++
- )
- {
- if(_GLF_DEAD(_GLF_FALSE(false, (gl_FragCoord.y < 0.0))))
- return;
- }
- do
- {
- _GLF_color = vec4(sum, 1.0);
- if(_GLF_DEAD(_GLF_FALSE(false, (gl_FragCoord.x < 0.0))))
- discard;
- }
- while(_GLF_WRAPPED_LOOP(_GLF_FALSE(false, (gl_FragCoord.y < length(0.0)))));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement