summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorNaveen Michaud-Agrawal <naveen.michaudagrawal@gmail.com>2023-11-11 03:25:50 +0000
committerNaveen Michaud-Agrawal <naveen.michaudagrawal@gmail.com>2023-11-11 03:25:50 +0000
commitdf8bd6ea627b3bf0f8919d9621b5cea325f32afa (patch)
treef99079a64b4e285d7287f5999588565b087810bb /virtual-programs
parentREADME: fix circle example (diff)
downloadfolk-df8bd6ea627b3bf0f8919d9621b5cea325f32afa.tar.gz
folk-df8bd6ea627b3bf0f8919d9621b5cea325f32afa.zip
Support non-uniform image scaling
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/display/image.folk5
1 files changed, 4 insertions, 1 deletions
diff --git a/virtual-programs/display/image.folk b/virtual-programs/display/image.folk
index 7415b260..de0408af 100644
--- a/virtual-programs/display/image.folk
+++ b/virtual-programs/display/image.folk
@@ -3,7 +3,7 @@ On process "display" {
set rotate $::rotate
# TODO: Do this with a wish, instead of hard-coding the global dict.
dict set ::pipelines "image" [Gpu::pipeline {sampler2D image vec2 imageSize
- vec2 pos float radians float scale
+ vec2 pos float radians vec2 scale
fn rotate} {
vec2 a = pos + scale * (rotate(-imageSize/2, -radians));
vec2 b = pos + scale * (rotate(vec2(imageSize.x, -imageSize.y)/2, -radians));
@@ -108,6 +108,9 @@ On process "display" {
set im [dict get $options image]
set radians [dict get $options radians]
set scale [dict_getdef $options scale 1.0]
+ if {[llength $scale] == 1} {
+ set scale [list $scale $scale]
+ }
set gim [ImageCache::getOrInsert $im]