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,23 +1,23 @@
uniform float percentagedistanceshow = 0.05;
uniform float gradientfalloffwidth = 3.0;
uniform highp float percentagedistanceshow = 0.05;
uniform highp float gradientfalloffwidth = 3.0;
vec4 circle(in vec2 uv, in vec2 pos, float rad, in vec3 color) {
float d = length(pos - uv) - rad;
float t = clamp(d, 0.0, 1.0);
highp vec4 circle(in highp vec2 uv, in highp vec2 pos, highp float rad, in highp vec3 color) {
highp float d = length(pos - uv) - rad;
highp float t = clamp(d, 0.0, 1.0);
return vec4(color, t);
}
void fragment() {
vec2 uv = FRAGCOORD.xy;
vec2 res_xy = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y);
vec2 center = res_xy*0.5;
float radius = percentagedistanceshow * res_xy.y;
highp vec2 uv = FRAGCOORD.xy;
highp vec2 res_xy = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y);
highp vec2 center = res_xy*0.5;
highp float radius = percentagedistanceshow * res_xy.y;
vec4 grad = vec4(0.8 - length( uv - center )/res_xy.y * gradientfalloffwidth);
highp vec4 grad = vec4(0.8 - length( uv - center )/res_xy.y * gradientfalloffwidth);
vec4 layer1 = vec4(vec3(255.0),0.0);
highp vec4 layer1 = vec4(vec3(255.0),0.0);
vec4 layer2 = circle(uv, center, radius, grad.rgb);
highp vec4 layer2 = circle(uv, center, radius, grad.rgb);
COLOR = mix(layer1, layer2, layer2.a);
}