Mercurial > games > semicongine
changeset 1241:a0ed1a918fda
fix: letters sometimes overlapping other letters quad
author | sam <sam@basx.dev> |
---|---|
date | Mon, 22 Jul 2024 12:51:50 +0700 |
parents | 42eeb59f3a43 |
children | e8b3dc80e48e |
files | semiconginev2/text.nim tests/test_text.nim |
diffstat | 2 files changed, 17 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/semiconginev2/text.nim Mon Jul 22 12:42:35 2024 +0700 +++ b/semiconginev2/text.nim Mon Jul 22 12:51:50 2024 +0700 @@ -42,7 +42,11 @@ fragmentUv = uv; } """ fragmentCode = """void main() { - color = vec4(textbox.color.rgb, textbox.color.a * texture(fontAtlas, fragmentUv).r); + float v = texture(fontAtlas, fragmentUv).r; + if(v == 0) { + discard; + } + color = vec4(textbox.color.rgb, textbox.color.a * v); }"""
--- a/tests/test_text.nim Mon Jul 22 12:42:35 2024 +0700 +++ b/tests/test_text.nim Mon Jul 22 12:51:50 2024 +0700 @@ -195,20 +195,21 @@ DestroyRenderData(renderdata) when isMainModule: - var time = 1000'f32 + var time = 1'f32 InitVulkan() - var renderpass = CreateDirectPresentationRenderPass(depthBuffer = true) - SetupSwapchain(renderpass = renderpass) + for depthBuffer in [true, false]: + var renderpass = CreateDirectPresentationRenderPass(depthBuffer = depthBuffer) + SetupSwapchain(renderpass = renderpass) - # tests a simple triangle with minimalistic shader and vertex format - # test_01_static_label(time, swapchain) - # test_02_multiple_animated(time) - # test_03_layouting(time) - test_04_lots_of_texts(time) + # tests a simple triangle with minimalistic shader and vertex format + test_01_static_label(time) + test_02_multiple_animated(time) + test_03_layouting(time) + test_04_lots_of_texts(time) - - checkVkResult vkDeviceWaitIdle(vulkan.device) - vkDestroyRenderPass(vulkan.device, renderpass.vk, nil) + checkVkResult vkDeviceWaitIdle(vulkan.device) + vkDestroyRenderPass(vulkan.device, renderpass.vk, nil) + ClearSwapchain() DestroyVulkan()