Mercurial > games > semicongine
changeset 1418:5bbcd40eb145
did: fix overlapping glyph-quads (again)
author | sam <sam@basx.dev> |
---|---|
date | Wed, 01 Jan 2025 17:52:51 +0700 |
parents | 23b4d8c84501 |
children | b411735768fd |
files | semicongine/text.nim |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/text.nim Wed Jan 01 16:38:27 2025 +0700 +++ b/semicongine/text.nim Wed Jan 01 17:52:51 2025 +0700 @@ -54,7 +54,8 @@ glyphquads.pos[glyphIndex][i_y[vertexI]] * scale, 0 ); - gl_Position = vec4(vertexPos + position, 1.0); + // the epsilon-offset is necessary, as otherwise characters with the same Z might overlap, despite transparency + gl_Position = vec4(vertexPos + position - vec3(0, 0, clamp(0, 1, gl_InstanceIndex * epsilon)), 1.0); vec2 uv = vec2(glyphquads.uv[glyphIndex][i_x[vertexI]], glyphquads.uv[glyphIndex][i_y[vertexI]]); fragmentUv = uv; fragmentColor = color;