From 317eac5efea896aa1f214f72ba81ce43f84bb58f Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Mon, 18 Sep 2023 13:28:43 -0400 Subject: display: Fix text orientation, remove dupe code from Gpu --- virtual-programs/display.folk | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'virtual-programs') diff --git a/virtual-programs/display.folk b/virtual-programs/display.folk index 1991650a..08d617c3 100644 --- a/virtual-programs/display.folk +++ b/virtual-programs/display.folk @@ -115,7 +115,6 @@ On process { if( max( abs(glyphUv.x-0.5), abs(glyphUv.y-0.5))>=0.5 ) { return vec4(0, 0, 0, 0); } - vec3 msd = glyphMsd(samplers[atlas], atlasGlyphBounds/atlasSize.xyxy, glyphUv).rgb; float sd = median(msd.r, msd.g, msd.b); float screenPxDistance = 4.5*(sd - 0.5); @@ -163,12 +162,14 @@ On process { lassign $glyphInfo advance planeBounds atlasBounds if {$char ne " "} { lassign [lmap v $planeBounds {* $v $em}] left bottom right top + set quad [list \ + [list [+ $x $left] [- $y $top]] \ + [list [+ $x $right] [- $y $top]] \ + [list [+ $x $right] [- $y $bottom]] \ + [list [+ $x $left] [- $y $bottom]]] + stroke $quad 10 red Gpu::draw $glyph $fontAtlas $fontAtlasSize \ - $atlasBounds \ - [list [+ $x $left] [- $y $top]] \ - [list [+ $x $right] [- $y $top]] \ - [list [+ $x $right] [+ $y $bottom]] \ - [list [+ $x $left] [+ $y $bottom]] + $atlasBounds {*}$quad } set x [+ $x [* $advance $em]] } on error e { puts stderr $e } @@ -221,7 +222,8 @@ On process { set displayCommands [lmap sublist [lsort -command lcomp $displayList] {lindex $sublist 1}] set renderTime [baretime { Display::start - Display::text 100 100 1.0 "Hello, world!" 0 + Display::text 100 100 1.0 "Hello, pworld!" 0 + Display::stroke {{100 100} {400 100}} 4 red foreach command $displayCommands { {*}$command } Display::end }] -- cgit v1.2.3