diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-04-07 17:06:08 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-04-07 17:07:35 -0400 |
commit | cd5bd61bfd9e41f9c6112d98ceae9b340b4b60ef (patch) | |
tree | df7f0b15b019da6c2e12528076bc388e2439d9ea /chickadee/graphics/sprite.scm | |
parent | 37a466f7089b88f5554eafbe9b4bcee7290868c7 (diff) |
graphics: Fix texture data being upside down.
Diffstat (limited to 'chickadee/graphics/sprite.scm')
-rw-r--r-- | chickadee/graphics/sprite.scm | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/chickadee/graphics/sprite.scm b/chickadee/graphics/sprite.scm index 8ab12f9..3a30d49 100644 --- a/chickadee/graphics/sprite.scm +++ b/chickadee/graphics/sprite.scm @@ -122,13 +122,11 @@ void main (void) { (t1 (rect-y texcoords)) (s2 (+ (rect-x texcoords) (rect-width texcoords))) (t2 (+ (rect-y texcoords) (rect-height texcoords)))) - ;; Texture origin is at the top-left, so we need to flip the Y - ;; coordinate relative to the vertices. (sprite-vertex-append! geometry - (x1 y1 s1 t2) - (x2 y1 s2 t2) - (x2 y2 s2 t1) - (x1 y2 s1 t1)) + (x1 y1 s1 t1) + (x2 y1 s2 t1) + (x2 y2 s2 t2) + (x1 y2 s1 t2)) (geometry-index-append! geometry 0 3 2 0 2 1))) (with-graphics-state ((g:blend-mode blend-mode) (g:texture-0 texture)) @@ -299,10 +297,10 @@ texture may be specified via the TEXTURE-REGION argument." (b (color-b tint)) (a (color-a tint))) (batched-sprite-append! geometry - (x1 y1 s1 t2 r g b a) - (x2 y2 s2 t2 r g b a) - (x3 y3 s2 t1 r g b a) - (x4 y4 s1 t1 r g b a)) + (x1 y1 s1 t1 r g b a) + (x2 y2 s2 t1 r g b a) + (x3 y3 s2 t2 r g b a) + (x4 y4 s1 t2 r g b a)) (geometry-index-append! geometry vertex-offset (+ vertex-offset 3) |