/* Crafter®.Graphics Copyright (C) 2025 Catcrafts® Catcrafts.net This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #version 450 layout(location = 0) in vec2 fragUV; layout(location = 0) out vec4 outColor; layout(set = 1, binding = 0) uniform sampler2D texSampler; void main() { outColor = texture(texSampler, fragUV); } /* float getFilledAlpha(vec2 uv, vec2 center, float radius, float fillAmount) { vec2 dir = uv - center; float dist = length(dir); // If outside the circle, return 0 if (dist > radius) return 0.0; // Normalize direction vector and compute angle float angle = atan(dir.y, dir.x); // atan returns from -PI to PI if (angle < 0.0) angle += 2.0 * 3.14159265359; // Convert to 0 to 2PI float filledAngle = fillAmount * 2.0 * 3.14159265359; // If the point is within the filled angle, return 1 if (angle <= filledAngle) return 1.0; return 0.0; } */ /* float getFilledAlphaAA(vec2 uv, vec2 center, float radius, float fillAmount, float edgeSoftness) { vec2 dir = uv - center; float dist = length(dir); // If completely outside the circle, return 0 if (dist > radius + edgeSoftness) return 0.0; // Normalize direction vector and compute angle float angle = atan(dir.y, dir.x); // -PI to PI if (angle < 0.0) angle += 2.0 * 3.14159265359; // Convert to 0 to 2PI float filledAngle = fillAmount * 2.0 * 3.14159265359; // Calculate smooth edge for radius float radiusAlpha = 1.0 - smoothstep(radius, radius + edgeSoftness, dist); // Calculate smooth edge for angle float angleAlpha = smoothstep(filledAngle - 0.02, filledAngle + 0.02, angle); // 0.02 rad ~ edge softness return radiusAlpha * angleAlpha; } */