# HG changeset patch # User sam # Date 1721627510 -25200 # Node ID a0ed1a918fda76b8a3b7dadaf6da51dbc364cb16 # Parent 42eeb59f3a43cd578478e232b841c8a42bb4f8c3 fix: letters sometimes overlapping other letters quad diff -r 42eeb59f3a43 -r a0ed1a918fda semiconginev2/text.nim --- 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); }""" diff -r 42eeb59f3a43 -r a0ed1a918fda tests/test_text.nim --- 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()