Mercurial > games > semicongine
diff tests/test_text.nim @ 1400:20602878744e
did: finished basic implementation of new glyph-rendering system
author | sam <sam@basx.dev> |
---|---|
date | Mon, 16 Dec 2024 00:27:40 +0700 |
parents | dde74be11b49 |
children | 4ecb004ee7f8 |
line wrap: on
line diff
--- a/tests/test_text.nim Sun Dec 15 00:21:12 2024 +0700 +++ b/tests/test_text.nim Mon Dec 16 00:27:40 2024 +0700 @@ -18,24 +18,24 @@ const MAX_GLYPHS = 200 proc test_01_static_label_new(time: float32) = - # var font = loadFont("Overhaul.ttf", lineHeightPixels = 160) - var font = loadFont[MAX_GLYPHS]("DejaVuSans.ttf", lineHeightPixels = 160) + var font = loadFont[MAX_GLYPHS]("Overhaul.ttf", lineHeightPixels = 200) var renderdata = initRenderData() var pipeline = createPipeline[GlyphShader[MAX_GLYPHS]](renderPass = vulkan.swapchain.renderPass) - var glyphs = initGlyphs(1000) + var glyphs = font.initGlyphs(1000, baseScale = 0.3) assignBuffers(renderdata, glyphs) assignBuffers(renderdata, font.descriptorSet) uploadImages(renderdata, font.descriptorSet) initDescriptorSet(renderdata, pipeline.layout(0), font.descriptorSet) - glyphs.set(font[], "semicongine".toRunes(), vec3()) - - glyphs.updateAllGPUBuffers(flush = true) - var start = getMonoTime() while ((getMonoTime() - start).inMilliseconds().int / 1000) < time: + let t = getMonoTime() + glyphs.reset() + glyphs.add("semicongine".toRunes()) + glyphs.updateAllGPUBuffers(flush = true) + withNextFrame(framebuffer, commandbuffer): bindDescriptorSet(commandbuffer, font.descriptorSet, 0, pipeline) withRenderPass( @@ -49,7 +49,7 @@ withPipeline(commandbuffer, pipeline): renderGlyphs(commandbuffer, pipeline, glyphs) - # cleanup + # cleanup checkVkResult vkDeviceWaitIdle(vulkan.device) destroyPipeline(pipeline) destroyRenderData(renderdata)