Advertisement
Guest User

Untitled

a guest
Jun 11th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 300 es
  2.  
  3. #ifndef REDUCER
  4. #define _GLF_ZERO(X, Y)          (Y)
  5. #define _GLF_ONE(X, Y)           (Y)
  6. #define _GLF_FALSE(X, Y)         (Y)
  7. #define _GLF_TRUE(X, Y)          (Y)
  8. #define _GLF_IDENTITY(X, Y)      (Y)
  9. #define _GLF_DEAD(X)             (X)
  10. #define _GLF_FUZZED(X)           (X)
  11. #define _GLF_WRAPPED_LOOP(X)     X
  12. #define _GLF_WRAPPED_IF_TRUE(X)  X
  13. #define _GLF_WRAPPED_IF_FALSE(X) X
  14. #define _GLF_SWITCH(X)           X
  15. #endif
  16.  
  17. // END OF GENERATED HEADER
  18. precision highp float;
  19.  
  20. uniform vec2 injectionSwitch;
  21.  
  22. layout(location = 0) out vec4 _GLF_color;
  23.  
  24. uniform vec2 resolution;
  25.  
  26. vec3 pickColor(int i)
  27. {
  28.  return vec3(float(i) / 50.0, float(i) / 120.0, float(i) / 140.0);
  29. }
  30. vec3 mand(float xCoord, float yCoord)
  31. {
  32.  float height = vec2(256.0, 256.0).y;
  33.  float width = (256.0);
  34.  float c_re = 0.8 * (xCoord - ((256.0)) / 2.0) * 4.0 / width - 0.4;
  35.  float c_im = 0.8 * (yCoord - height / 2.0) * 4.0 / width;
  36.  float x = 0.0, y = 0.0;
  37.  if(_GLF_DEAD(false))
  38.   return vec3(1.0);
  39.  int iteration = 0;
  40.  if(_GLF_DEAD(false))
  41.   return vec3(1.0);
  42.  if(_GLF_DEAD(false))
  43.   return vec3(1.0);
  44.  if(_GLF_DEAD(false))
  45.   return vec3(1.0);
  46.  if(_GLF_DEAD(false))
  47.   {
  48.   }
  49.  if(_GLF_DEAD(false))
  50.   discard;
  51.  for(
  52.      int k = 0;
  53.      k < 1000;
  54.      k ++
  55.  )
  56.   {
  57.    if(x * x + y * y > 4.0)
  58.     {
  59.      break;
  60.     }
  61.    float x_new = x * x - y * y + c_re;
  62.    y = 2.0 * x * y + c_im;
  63.    x = x_new;
  64.    iteration ++;
  65.   }
  66.  if(iteration < 1000)
  67.   {
  68.    return pickColor(iteration);
  69.   }
  70.  else
  71.   {
  72.    return vec3(0.0);
  73.   }
  74. }
  75. void main()
  76. {
  77.  vec3 data[16];
  78.  for(
  79.      int i = 0;
  80.      i < 4;
  81.      i ++
  82.  )
  83.   {
  84.    for(
  85.        int j = 0;
  86.        j < 4;
  87.        j ++
  88.    )
  89.     {
  90.      data[4 * j + i] = mand(gl_FragCoord.x + float(i - 1), gl_FragCoord.y + float(j - 1));
  91.     }
  92.   }
  93.  vec3 sum = vec3(0.0);
  94.  for(
  95.      int i = 0;
  96.      i < 16;
  97.      i ++
  98.  )
  99.   {
  100.    sum += data[i];
  101.   }
  102.  sum /= vec3(16.0);
  103.  for(
  104.      int _injected_loop_counter = int(0.0);
  105.      _GLF_WRAPPED_LOOP(_injected_loop_counter != int(_GLF_ONE(1.0, injectionSwitch.y)));
  106.      _injected_loop_counter ++
  107.  )
  108.   {
  109.    if(_GLF_DEAD(_GLF_FALSE(false, (gl_FragCoord.y < 0.0))))
  110.     return;
  111.   }
  112.  do
  113.   {
  114.    _GLF_color = vec4(sum, 1.0);
  115.    if(_GLF_DEAD(_GLF_FALSE(false, (gl_FragCoord.x < 0.0))))
  116.     discard;
  117.   }
  118.  while(_GLF_WRAPPED_LOOP(_GLF_FALSE(false, (gl_FragCoord.y < length(0.0)))));
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement