comparison semiconginev2/text.nim @ 1241:a0ed1a918fda

fix: letters sometimes overlapping other letters quad
author sam <sam@basx.dev>
date Mon, 22 Jul 2024 12:51:50 +0700
parents 176383220123
children
comparison
equal deleted inserted replaced
1240:42eeb59f3a43 1241:a0ed1a918fda
40 vertexCode = """void main() { 40 vertexCode = """void main() {
41 gl_Position = vec4(position * vec3(1, textbox.aspectratio, 1) * textbox.scale + textbox.position, 1.0); 41 gl_Position = vec4(position * vec3(1, textbox.aspectratio, 1) * textbox.scale + textbox.position, 1.0);
42 fragmentUv = uv; 42 fragmentUv = uv;
43 } """ 43 } """
44 fragmentCode = """void main() { 44 fragmentCode = """void main() {
45 color = vec4(textbox.color.rgb, textbox.color.a * texture(fontAtlas, fragmentUv).r); 45 float v = texture(fontAtlas, fragmentUv).r;
46 if(v == 0) {
47 discard;
48 }
49 color = vec4(textbox.color.rgb, textbox.color.a * v);
46 }""" 50 }"""
47 51
48 52
49 include ./text/font 53 include ./text/font
50 include ./text/textbox 54 include ./text/textbox