[Bf-blender-cvs] [aecceb7b1e4] lanpr-under-gp: LineArt: Line iterator fixed

YimingWu noreply at git.blender.org
Wed Oct 21 15:21:13 CEST 2020


Commit: aecceb7b1e45e7222008d9eee78fe422ea03d9ef
Author: YimingWu
Date:   Wed Oct 21 19:28:36 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBaecceb7b1e45e7222008d9eee78fe422ea03d9ef

LineArt: Line iterator fixed

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

M	source/blender/editors/lineart/lineart_chain.c
M	source/blender/editors/lineart/lineart_cpu.c
M	source/blender/editors/lineart/lineart_intern.h

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

diff --git a/source/blender/editors/lineart/lineart_chain.c b/source/blender/editors/lineart/lineart_chain.c
index 52956c65329..f40ce97728f 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -206,7 +206,8 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
   int last_occlusion;
   unsigned char last_transparency;
 
-  LRT_ITER_ALL_LINES_BEGIN{
+  LRT_ITER_ALL_LINES_BEGIN
+  {
 
     if ((!(rl->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (rl->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
       continue;
@@ -489,15 +490,8 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
     else {
       rlc->type = (rl->flags & LRT_EDGE_FLAG_ALL_TYPE);
     }
-    if(!next_rl){
-      if(current_list == rb->contours){current_list = rb->crease_lines;}
-      else if(current_list == rb->crease_lines){current_list = rb->material_lines;}
-      else if(current_list == rb->material_lines){current_list = rb->edge_marks;}
-      else if(current_list == rb->edge_marks){current_list = rb->intersection_lines;}
-      else {current_list=NULL;}
-      next_rl = current_list;
-    }
-  }LRT_ITER_ALL_LINES_END
+  }
+  LRT_ITER_ALL_LINES_END
 }
 
 static LineartBoundingArea *lineart_bounding_area_get_rlci_recursive(
@@ -736,13 +730,14 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
     next_cre = cre->next;
     if (cre->rlc->object_ref != rlc->object_ref) {
       if (!rb->fuzzy_everything) {
-        if(rb->fuzzy_intersections){
+        if (rb->fuzzy_intersections) {
           /* If none of those are intersection lines... */
           if ((!(cre->rlc->type & LRT_EDGE_FLAG_INTERSECTION)) &&
               (!(rlc->type & LRT_EDGE_FLAG_INTERSECTION))) {
             continue; /* We don't want to chain along different objects at the moment. */
           }
-        }else {
+        }
+        else {
           continue;
         }
       }
@@ -779,21 +774,31 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
       }
     }
   }
-  float adjacent_new_len=dist; /* We want a closer point anyway. So using modified dist is fine. */
-  LineartChainRegisterEntry* adjacent_closest;
-
-#define LRT_TEST_ADJACENT_AREAS(dist_to, list)\
-  if(dist_to<dist && dist_to>0){\
-    LISTBASE_FOREACH(LinkData* ,ld,list){\
-      LineartBoundingArea* sba = (LineartBoundingArea*)ld->data;\
-      adjacent_closest = lineart_chain_get_closest_cre(rb,sba,rlc,rlci,occlusion,transparency_mask,dist,do_geometry_space,&adjacent_new_len, ba);\
-      if(adjacent_new_len < dist){\
-        dist=  adjacent_new_len;\
-        closest_cre = adjacent_closest;\
-      }\
-    }\
+  float adjacent_new_len =
+      dist; /* We want a closer point anyway. So using modified dist is fine. */
+  LineartChainRegisterEntry *adjacent_closest;
+
+#define LRT_TEST_ADJACENT_AREAS(dist_to, list) \
+  if (dist_to < dist && dist_to > 0) { \
+    LISTBASE_FOREACH (LinkData *, ld, list) { \
+      LineartBoundingArea *sba = (LineartBoundingArea *)ld->data; \
+      adjacent_closest = lineart_chain_get_closest_cre(rb, \
+                                                       sba, \
+                                                       rlc, \
+                                                       rlci, \
+                                                       occlusion, \
+                                                       transparency_mask, \
+                                                       dist, \
+                                                       do_geometry_space, \
+                                                       &adjacent_new_len, \
+                                                       ba); \
+      if (adjacent_new_len < dist) { \
+        dist = adjacent_new_len; \
+        closest_cre = adjacent_closest; \
+      } \
+    } \
   }
-  if(!do_geometry_space && !caller_ba){
+  if (!do_geometry_space && !caller_ba) {
     LRT_TEST_ADJACENT_AREAS(rlci->pos[0] - ba->l, &ba->lp);
     LRT_TEST_ADJACENT_AREAS(ba->r - rlci->pos[0], &ba->rp);
     LRT_TEST_ADJACENT_AREAS(ba->u - rlci->pos[1], &ba->up);
@@ -843,10 +848,26 @@ void ED_lineart_chain_connect(LineartRenderBuffer *rb, const int do_geometry_spa
     rlci_r = rlc->chain.last;
     while ((ba_l = lineart_bounding_area_get_end_point(rb, rlci_l)) &&
            (ba_r = lineart_bounding_area_get_end_point(rb, rlci_r))) {
-      closest_cre_l = lineart_chain_get_closest_cre(
-          rb, ba_l, rlc, rlci_l, occlusion, transparency_mask, dist, do_geometry_space, &dist_l, NULL);
-      closest_cre_r = lineart_chain_get_closest_cre(
-          rb, ba_r, rlc, rlci_r, occlusion, transparency_mask, dist, do_geometry_space, &dist_r, NULL);
+      closest_cre_l = lineart_chain_get_closest_cre(rb,
+                                                    ba_l,
+                                                    rlc,
+                                                    rlci_l,
+                                                    occlusion,
+                                                    transparency_mask,
+                                                    dist,
+                                                    do_geometry_space,
+                                                    &dist_l,
+                                                    NULL);
+      closest_cre_r = lineart_chain_get_closest_cre(rb,
+                                                    ba_r,
+                                                    rlc,
+                                                    rlci_r,
+                                                    occlusion,
+                                                    transparency_mask,
+                                                    dist,
+                                                    do_geometry_space,
+                                                    &dist_r,
+                                                    NULL);
       if (closest_cre_l && closest_cre_r) {
         if (dist_l < dist_r) {
           closest_cre = closest_cre_l;
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 234f71c4372..eb758a5df72 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -305,19 +305,19 @@ static int lineart_occlusion_make_task_info(LineartRenderBuffer *rb, LineartRend
 
   BLI_spin_lock(&rb->lock_task);
 
-#define LRT_ASSIGN_OCCLUSION_TASK(name)\
-  if (rb->name##_managed) {\
-    data = rb->name##_managed;\
-    rti->name = (void *)data;\
-    for (i = 0; i < LRT_THREAD_LINE_COUNT && data; i++) {\
-      data = data->next;\
-    }\
-    rti->name##_end = data;\
-    rb->name##_managed = data;\
-    res = 1;\
-  }\
-  else {\
-    rti->name = NULL;\
+#define LRT_ASSIGN_OCCLUSION_TASK(name) \
+  if (rb->name##_managed) { \
+    data = rb->name##_managed; \
+    rti->name = (void *)data; \
+    for (i = 0; i < LRT_THREAD_LINE_COUNT && data; i++) { \
+      data = data->next; \
+    } \
+    rti->name##_end = data; \
+    rb->name##_managed = data; \
+    res = 1; \
+  } \
+  else { \
+    rti->name = NULL; \
   }
 
   LRT_ASSIGN_OCCLUSION_TASK(contour);
@@ -388,8 +388,7 @@ static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartR
 
   while (lineart_occlusion_make_task_info(rb, rti)) {
 
-    for (lip = (void *)rti->contour; lip && lip != rti->contour_end;
-         lip = lip->next) {
+    for (lip = (void *)rti->contour; lip && lip != rti->contour_end; lip = lip->next) {
       lineart_occlusion_single_line(rb, lip, rti->thread_id);
     }
 
@@ -398,8 +397,7 @@ static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartR
       return;
     }
 
-    for (lip = (void *)rti->crease; lip && lip != rti->crease_end;
-         lip = lip->next) {
+    for (lip = (void *)rti->crease; lip && lip != rti->crease_end; lip = lip->next) {
       lineart_occlusion_single_line(rb, lip, rti->thread_id);
     }
 
@@ -407,8 +405,7 @@ static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartR
       return;
     }
 
-    for (lip = (void *)rti->intersection; lip && lip != rti->intersection_end;
-         lip = lip->next) {
+    for (lip = (void *)rti->intersection; lip && lip != rti->intersection_end; lip = lip->next) {
       lineart_occlusion_single_line(rb, lip, rti->thread_id);
     }
 
@@ -416,16 +413,14 @@ static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartR
       return;
     }
 
-    for (lip = (void *)rti->material; lip && lip != rti->material_end;
-         lip = lip->next) {
+    for (lip = (void *)rti->material; lip && lip != rti->material_end; lip = lip->next) {
       lineart_occlusion_single_line(rb, lip, rti->thread_id);
     }
     if (ED_lineart_calculation_flag_check(LRT_RENDER_CANCELING)) {
       return;
     }
 
-    for (lip = (void *)rti->edge_mark; lip && lip != rti->edge_mark_end;
-         lip = lip->next) {
+    for (lip = (void *)rti->edge_mark; lip && lip != rti->edge_mark_end; lip = lip->next) {
       lineart_occlusion_single_line(rb, lip, rti->thread_id);
     }
 
@@ -671,24 +666,42 @@ static void lineart_triangle_set_cull_flag(LineartRenderTriangle *rt, unsigned c
   rt->flags |= intersection_only;
 }
 
-static void lineart_triangle_cull_single(LineartRenderBuffer *rb, LineartRenderTriangle* rt, int in0, int in1, int in2,
-                                         double* cam_pos, double* view_dir, bool allow_boundaries, double(*vp)[4], LineartRenderLine* given_line, Object* ob,
-                                         int* r_v_count, int* r_l_count, int* r_t_count,
-                                         LineartRenderElementLinkNode* veln,
-                                         LineartRenderElementLinkNode* leln,
-                                         LineartRenderElementLinkNode* teln){
+static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
+                                         LineartRenderTriangle *rt,
+                                         int in0,
+                                         int in1,
+                       

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list