cooldown.swsl 801 B

1234567891011121314151617181920212223242526272829
  1. light_mode unshaded;
  2. const highp float PI = 3.14159265;
  3. uniform highp float progress;
  4. void fragment() {
  5. highp vec4 col = zTexture(UV);
  6. highp vec2 center = vec2(0.5,0.5);
  7. highp vec2 delta = UV.xy - center;
  8. highp float angle = atan(delta.x, -delta.y) + PI;
  9. highp float dist = length(delta);
  10. #ifdef HAS_DFDX
  11. highp float dist_fwidth = fwidth(dist) * 0.67;
  12. #else
  13. highp float dist_fwidth = 0.05;
  14. #endif
  15. highp float dist_alpha = smoothstep(0.1-dist_fwidth, 0.1, abs(dist-0.35));
  16. highp float angle_delta = (progress * PI * 2.0) - angle;
  17. highp float arc_length = angle_delta * dist;
  18. highp float angle_alpha = (progress > 0.0) ? smoothstep(dist_fwidth, 0.0, arc_length) : 0.0;
  19. COLOR = vec4(col.xyz, 1.0 - max(dist_alpha, angle_alpha));
  20. }