GLES2: Content shader stuff (possibly unfinished)

This commit is contained in:
20kdc
2020-08-28 00:04:44 +01:00
parent acfb452aa7
commit d809968635
7 changed files with 60 additions and 60 deletions

View File

@@ -1,25 +1,25 @@
light_mode unshaded;
const float PI = 3.14159265;
const highp float PI = 3.14159265;
uniform float progress = 0.0;
uniform highp float progress;
void fragment() {
vec4 col = texture(TEXTURE, UV);
vec2 center = vec2(0.5,0.5);
vec2 delta = UV.xy - center;
highp vec4 col = texture2D(TEXTURE, UV);
highp vec2 center = vec2(0.5,0.5);
highp vec2 delta = UV.xy - center;
float angle = atan(delta.x, -delta.y) + PI;
highp float angle = atan(delta.x, -delta.y) + PI;
float dist = length(delta);
float dist_fwidth = fwidth(dist) * 0.67;
highp float dist = length(delta);
highp float dist_fwidth = fwidth(dist) * 0.67;
float dist_alpha = smoothstep(0.1-dist_fwidth, 0.1, abs(dist-0.35));
highp float dist_alpha = smoothstep(0.1-dist_fwidth, 0.1, abs(dist-0.35));
float angle_delta = (progress * PI * 2) - angle;
float arc_length = angle_delta * dist;
highp float angle_delta = (progress * PI * 2.0) - angle;
highp float arc_length = angle_delta * dist;
float angle_alpha = progress > 0 ? smoothstep(dist_fwidth, 0.0, arc_length) : 0.0;
highp float angle_alpha = progress > 0 ? smoothstep(dist_fwidth, 0.0, arc_length) : 0.0;
COLOR = vec4(col.xyz, 1-max(dist_alpha, angle_alpha));
}
}