Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float calcRoundedCorners() {
- if (radius <= 0.0) {
- return 1.0;
- }
- vec2 pixelPos = pass_textureCoords * vec2(uiWidth, uiHeight);
- vec2 minCorner = vec2(radius, radius);
- vec2 maxCorner = vec2(uiWidth - radius, uiHeight - radius);
- vec2 cornerPoint = clamp(pixelPos, minCorner, maxCorner);
- float lowerBound = square(radius - cornerSmoothFactor);
- float upperBound = square(radius + cornerSmoothFactor);
- return smoothstep(upperBound, lowerBound, distanceSquared(pixelPos, cornerPoint));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement