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
This commit is contained in:
Gered 2023-04-02 15:03:17 -04:00
parent 2280578904
commit 49a8b23568

View file

@ -57,7 +57,7 @@ pub fn per_pixel_triangle_2d<PixelType: Pixel>(
for pixel in row_pixels.iter_mut() { for pixel in row_pixels.iter_mut() {
// note that for a counter-clockwise vertex winding order with the direction of Y+ going down instead // 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 // 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); pixel_fn(pixel, w0, w1, w2);
} }