[Bf-blender-cvs] [65b806d5f35] temp-image-buffer-rasterizer: Fix glitches around mid vertex.

Jeroen Bakker noreply at git.blender.org
Mon Feb 21 09:53:26 CET 2022


Commit: 65b806d5f352b25cbf64924cf8a52336e7abb404
Author: Jeroen Bakker
Date:   Mon Feb 21 08:09:23 2022 +0100
Branches: temp-image-buffer-rasterizer
https://developer.blender.org/rB65b806d5f352b25cbf64924cf8a52336e7abb404

Fix glitches around mid vertex.

===================================================================

M	source/blender/imbuf/IMB_rasterizer.hh

===================================================================

diff --git a/source/blender/imbuf/IMB_rasterizer.hh b/source/blender/imbuf/IMB_rasterizer.hh
index 05752284f29..42e9a3dd18c 100644
--- a/source/blender/imbuf/IMB_rasterizer.hh
+++ b/source/blender/imbuf/IMB_rasterizer.hh
@@ -342,7 +342,9 @@ class Rasterizer {
     std::array<VertexOutputType *, 3> sorted_vertices = order_triangle_vertices(vertex_out);
 
     const int min_v = clamping_method.scanline_for(sorted_vertices[0]->coord[1]);
-    const int mid_v = clamping_method.scanline_for(sorted_vertices[1]->coord[1]);
+    const int mid_v =
+        clamping_method.scanline_for(sorted_vertices[1]->coord[1]) -
+        (clamping_method.distance_to_scanline_anchor(sorted_vertices[1]->coord[1]) == 0.5 ? 0 : 1);
     const int max_v = clamping_method.scanline_for(sorted_vertices[2]->coord[1]) - 1;
 
     /* left and right branch. */
@@ -389,7 +391,7 @@ class Rasterizer {
       right += right_add;
     }
 
-    if (min_v == mid_v) {
+    if (min_v >= mid_v) {
       if (sorted_vertices[0]->coord[0] > sorted_vertices[1]->coord[0]) {
         left = *sorted_vertices[1];
       }



More information about the Bf-blender-cvs mailing list