SDF & MONOSPACE FONT RENDERING

This commit is contained in:
2026-09-05 11:56:13 +02:00
parent b29e298d55
commit 322ce785b9
14 changed files with 268 additions and 161 deletions
+5 -1
View File
@@ -6,13 +6,17 @@ layout(location = 1) in vec4 oColor;
uniform sampler2D tex;
layout(push_constant) uniform PushData {
int alfa;
int is_sdf;
} push;
out vec4 FragColor;
void main() {
vec4 tc = texture(tex, oUV);
if (push.alfa != 0) {
if(push.is_sdf != 0) {
float alpha = smoothstep(0.45, 0.55, tc.a);
FragColor = vec4(oColor.rgb, alpha * oColor.a);
} else if (push.alfa != 0) {
FragColor = vec4(oColor.rgb, tc.a * oColor.a);
} else {
FragColor = tc * oColor;