From 9805b1c02e50ce59ae1321ca9e368a6873a246ec Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 13 Apr 2021 10:59:20 -0400 Subject: graphics: tile-map: Hack to prevent one situation that causes artifacts. --- chickadee/graphics/tile-map.scm | 9 +++++++++ 1 file changed, 9 insertions(+) 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* -- cgit v1.2.3