style: shader style fixes

This commit is contained in:
Will McKinnon 2022-11-11 21:28:32 -05:00
parent 1a9f17054d
commit 6ef904a960
3 changed files with 3 additions and 3 deletions

View file

@ -20,7 +20,7 @@ void main() {
vec2 center = gl_FragCoord.xy - position - half_size; vec2 center = gl_FragCoord.xy - position - half_size;
float distance = roundedBoxSDF(center, half_size - half_thickness, radius + half_thickness); float distance = roundedBoxSDF(center, half_size - half_thickness, radius + half_thickness);
float smoothedAlphaOuter = 1.0 - smoothstep(-1.0, 1.0, distance - half_thickness); float smoothedAlphaOuter = 1.0 - smoothstep(-1.0, 1.0, distance - half_thickness);
// Create an inner circle that isn't as anti-aliased as the outer ring // Create an inner circle that isn't as anti-aliased as the outer ring
float smoothedAlphaInner = 1.0 - smoothstep(-1.0, 0.5, distance + half_thickness); float smoothedAlphaInner = 1.0 - smoothstep(-1.0, 0.5, distance + half_thickness);
gl_FragColor = mix(vec4(0), v_color, smoothedAlphaOuter - smoothedAlphaInner); gl_FragColor = mix(vec4(0), v_color, smoothedAlphaOuter - smoothedAlphaInner);

View file

@ -8,7 +8,7 @@ uniform float radius;
void main() { void main() {
vec2 q = abs(gl_FragCoord.xy - position - size) - size + radius; vec2 q = abs(gl_FragCoord.xy - position - size) - size + radius;
float distance = min(max(q.x,q.y),0.0) + length(max(q,0.0)) - radius; float distance = min(max(q.x,q.y),0.0) + length(max(q,0.0)) - radius;
float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, distance); float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, distance);
gl_FragColor = mix(vec4(0), v_color, smoothedAlpha); gl_FragColor = mix(vec4(0), v_color, smoothedAlpha);
} }

View file

@ -8,7 +8,7 @@ uniform float radius;
void main() { void main() {
vec2 q = abs(gl_FragCoord.xy - position - vec2(0, size.y)) - size + radius; vec2 q = abs(gl_FragCoord.xy - position - vec2(0, size.y)) - size + radius;
float distance = min(max(q.x,q.y),0.0) + length(max(q,0.0)) - radius; float distance = min(max(q.x,q.y),0.0) + length(max(q,0.0)) - radius;
float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, distance); float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, distance);
gl_FragColor = mix(vec4(0), v_color, smoothedAlpha); gl_FragColor = mix(vec4(0), v_color, smoothedAlpha);
} }