summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-09-18 17:28:43 +0000
committerOmar Rizwan <omar@omar.website>2023-09-18 17:28:43 +0000
commit317eac5efea896aa1f214f72ba81ce43f84bb58f (patch)
treeaf7627042065e129e471893bbed8a9478c54e51d /virtual-programs
parentdisplay: Start using planeBounds to position characters properly (diff)
downloadfolk-317eac5efea896aa1f214f72ba81ce43f84bb58f.tar.gz
folk-317eac5efea896aa1f214f72ba81ce43f84bb58f.zip
display: Fix text orientation, remove dupe code from Gpu
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/display.folk16
1 files changed, 9 insertions, 7 deletions
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
}]