2020-02-03 10:52:39 -08:00
|
|
|
#version 330
|
|
|
|
|
2024-08-01 07:17:26 -05:00
|
|
|
// Value between -1 and 1
|
|
|
|
in float scaled_signed_dist_to_curve;
|
|
|
|
in float scaled_anti_alias_width;
|
2023-01-09 16:46:38 -08:00
|
|
|
in vec4 color;
|
2020-02-03 10:52:39 -08:00
|
|
|
|
|
|
|
out vec4 frag_color;
|
|
|
|
|
|
|
|
void main() {
|
2023-01-20 13:22:18 -08:00
|
|
|
frag_color = color;
|
2023-01-08 23:33:39 -05:00
|
|
|
|
2023-01-18 13:07:18 -08:00
|
|
|
// sdf for the region around the curve we wish to color.
|
2024-08-01 07:17:26 -05:00
|
|
|
float signed_dist_to_region = abs(scaled_signed_dist_to_curve) - 1.0;
|
|
|
|
frag_color.a *= smoothstep(
|
|
|
|
scaled_anti_alias_width,
|
|
|
|
-scaled_anti_alias_width,
|
|
|
|
signed_dist_to_region
|
|
|
|
);
|
2020-02-03 10:52:39 -08:00
|
|
|
}
|