fix up the border shader

This commit is contained in:
vaxerski 2022-11-26 13:51:30 +00:00
parent f45ec24977
commit 1c9a0be8c4

View file

@ -31,19 +31,19 @@ void main() {
float dist = length(pixCoord);
if (dist > radius || dist < radius - thick - 1.0)
if (dist > radius + 1.0 || dist < radius - thick - 1.0)
discard;
if (primitiveMultisample == 1 && (dist > radius - 1.0 || dist < radius - thick + 1.0)) {
float distances = 0.0;
float len = length(pixCoord + vec2(0.25, 0.25));
distances += float(len < radius && len > radius - thick);
distances += float(len < radius + 0.5 && len > radius - thick);
len = length(pixCoord + vec2(0.75, 0.25));
distances += float(len < radius && len > radius - thick);
distances += float(len < radius + 0.5 && len > radius - thick);
len = length(pixCoord + vec2(0.25, 0.75));
distances += float(len < radius && len > radius - thick);
distances += float(len < radius + 0.5 && len > radius - thick);
len = length(pixCoord + vec2(0.75, 0.75));
distances += float(len < radius && len > radius - thick);
distances += float(len < radius + 0.5 && len > radius - thick);
if (distances == 0.0)
discard;
@ -51,7 +51,8 @@ void main() {
distances /= 4.0;
pixColor = pixColor * distances;
}
} else if (dist > radius || dist < radius - thick)
discard;
done = true;
}