Learning_GTK4_tree/gsk/vulkan/resources/rounded-rect.frag.glsl

18 lines
359 B
Plaintext
Raw Normal View History

2023-12-12 11:36:42 +01:00
#ifndef _ROUNDED_RECT_FRAG_
#define _ROUNDED_RECT_FRAG_
#include "rounded-rect.glsl"
float
rounded_rect_coverage (RoundedRect r, vec2 p)
{
vec2 fw = abs (fwidth (p));
float distance_scale = max (fw.x, fw.y);
float distance = rounded_rect_distance (r, p) / distance_scale;
float coverage = 0.5 - distance;
return clamp (coverage, 0, 1);
}
#endif