From 49a8b23568a42207387f5cfc17c443f712ea453f Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 2 Apr 2023 15:03:17 -0400 Subject: [PATCH] should be testing with '<=' so that we also draw edge pixels '< 0' gives us pixels inside the triangle. '== 0' gives us pixels on the edges of the triangle --- ggdt/src/graphics/bitmap/triangles.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggdt/src/graphics/bitmap/triangles.rs b/ggdt/src/graphics/bitmap/triangles.rs index 6fdafe9..da7e7b0 100644 --- a/ggdt/src/graphics/bitmap/triangles.rs +++ b/ggdt/src/graphics/bitmap/triangles.rs @@ -57,7 +57,7 @@ pub fn per_pixel_triangle_2d( for pixel in row_pixels.iter_mut() { // note that for a counter-clockwise vertex winding order with the direction of Y+ going down instead // of up, we need to test for *negative* area when checking if we're inside the triangle - if w0 < 0.0 && w1 < 0.0 && w2 < 0.0 { + if w0 <= 0.0 && w1 <= 0.0 && w2 <= 0.0 { pixel_fn(pixel, w0, w1, w2); }