summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-10-09 23:02:02 +0000
committerOmar Rizwan <omar@omar.website>2023-10-09 23:02:02 +0000
commitce6a82e7db7447e90650df00ccd185e9b258f1ae (patch)
tree8231483f2905e35c57092e34d906b08ca28db738 /virtual-programs
parentdict getdef -> dict_getdef. Much, much faster (diff)
downloadfolk-ce6a82e7db7447e90650df00ccd185e9b258f1ae.tar.gz
folk-ce6a82e7db7447e90650df00ccd185e9b258f1ae.zip
text: Draw with wish; stops the blinking bug.
(because now, the text draws every frame, instead of just when it happens to change.)
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/display/text.folk9
1 files changed, 5 insertions, 4 deletions
diff --git a/virtual-programs/display/text.folk b/virtual-programs/display/text.folk
index 1c8f6c45..992e77b1 100644
--- a/virtual-programs/display/text.folk
+++ b/virtual-programs/display/text.folk
@@ -38,7 +38,8 @@ On process "display" {
set median [Gpu::fn {float r float g float b} float {
return max(min(r, g), min(max(r, g), b));
}]
- set glyph [Gpu::pipeline \
+ # TODO: Do this with a wish, instead of hard-coding the global dict.
+ dict set ::pipelines "glyph" [Gpu::pipeline \
{sampler2D atlas vec2 atlasSize
vec4 atlasGlyphBounds
vec4 planeGlyphBounds
@@ -74,7 +75,7 @@ On process "display" {
float screenPxDistance = 4.5*(sd - 0.5);
float opacity = clamp(screenPxDistance + 0.5, 0.0, 1.0);
return mix(vec4(0, 0, 0, 0), vec4(1, 1, 1, 1), opacity);
- }]
+ }]
fn textExtent {text scale} {
set em [* $scale 25.0]
@@ -139,8 +140,8 @@ On process "display" {
}
lassign $glyphInfo advance planeBounds atlasBounds
if {$char ne " "} {
- lappend ::displayList \
- [list Gpu::draw $glyph $fontAtlas $fontAtlasSize \
+ Wish the GPU draws pipeline "glyph" with arguments \
+ [list $fontAtlas $fontAtlasSize \
$atlasBounds $planeBounds [list $x $y] $radians $em]
}
lassign [vec2 add [list $x $y] \