[Bf-blender-cvs] [c151c54a586] temp-lineart-contained: LineArt: Alternating triangle adding direction

YimingWu noreply at git.blender.org
Fri Apr 22 10:42:54 CEST 2022


Commit: c151c54a586ed8f51a050de73cb6fcd190e54ec6
Author: YimingWu
Date:   Fri Apr 22 16:00:45 2022 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBc151c54a586ed8f51a050de73cb6fcd190e54ec6

LineArt: Alternating triangle adding direction

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

M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index d0f5086a822..dd3d5f3f5d8 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -4715,6 +4715,7 @@ static void lineart_add_triangles_worker(TaskPool *__restrict UNUSED(pool), Line
     int x1, x2, y1, y2;
     int r, co;
     LineartRenderBuffer *rb = th->rb;
+    int _dir_control = 0;
 
     for (i = 0; i < lim; i++) {
       if ((tri->flags & LRT_CULL_USED) || (tri->flags & LRT_CULL_DISCARD)) {
@@ -4722,17 +4723,26 @@ static void lineart_add_triangles_worker(TaskPool *__restrict UNUSED(pool), Line
         continue;
       }
       if (lineart_get_triangle_bounding_areas(rb, tri, &y1, &y2, &x1, &x2)) {
+        _dir_control++;
         for (co = x1; co <= x2; co++) {
           for (r = y1; r <= y2; r++) {
-            lineart_bounding_area_link_triangle(rb,
-                                                &rb->initial_bounding_areas[r * LRT_BA_ROWS + co],
-                                                tri,
-                                                0,
-                                                1,
-                                                0,
-                                                (!(tri->flags & LRT_TRIANGLE_NO_INTERSECTION)),
-                                                true,
-                                                th);
+            int col = co, row = r;
+            if (_dir_control % 2) {
+              col = x2 - (co - x1);
+            }
+            if ((_dir_control / 2) % 2) {
+              row = y2 - (r - y1);
+            }
+            lineart_bounding_area_link_triangle(
+                rb,
+                &rb->initial_bounding_areas[row * LRT_BA_ROWS + col],
+                tri,
+                0,
+                1,
+                0,
+                (!(tri->flags & LRT_TRIANGLE_NO_INTERSECTION)),
+                true,
+                th);
           }
         }
       } /* Else throw away. */



More information about the Bf-blender-cvs mailing list