summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-04-13 10:59:20 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-04-13 10:59:20 -0400
commit9805b1c02e50ce59ae1321ca9e368a6873a246ec (patch)
treee654bf9f8eaf49a2f23fe3b9028cb0a69932385e
parent9ee21dc696680be5ca2760eeba172a222eeaeef2 (diff)
graphics: tile-map: Hack to prevent one situation that causes artifacts.
-rw-r--r--chickadee/graphics/tile-map.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/chickadee/graphics/tile-map.scm b/chickadee/graphics/tile-map.scm
index 1453407..083d61e 100644
--- a/chickadee/graphics/tile-map.scm
+++ b/chickadee/graphics/tile-map.scm
@@ -912,6 +912,15 @@ argument may be used to specify a list of layers to draw, instead."
(vec2-copy! camera *position*)
(vec2-mult! *position* -1.0)
(vec2-add! *position* position)
+ ;; XXX: Round position to nearest pixel to maybe avoid texture
+ ;; artifacts caused by texels not aligning perfectly with the
+ ;; viewport pixels. Of course, if the projection matrix isn't pixel
+ ;; perfect, or if the map is scaled, or if there is rotation, then
+ ;; this issue can happen anyway. Sigh... much to learn about how to
+ ;; improve this.
+ (set-vec2! *position*
+ (round (vec2-x *position*))
+ (round (vec2-y *position*)))
(matrix4-2d-transform! *matrix*
#:origin origin
#:position *position*