descriptor update

This commit is contained in:
Jorijn van der Graaf 2025-05-07 23:49:31 +02:00
commit abc1d7da9f
8 changed files with 254 additions and 127 deletions

View file

@ -27,4 +27,52 @@ 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;
}
*/