[Bf-blender-cvs] [e5310101fa2] lanpr-under-gp: LineArt: Vertex weight transfer index error now fixed.

YimingWu noreply at git.blender.org
Sat Nov 7 13:20:58 CET 2020


Commit: e5310101fa24953e7830828f21a55c7a2a33a547
Author: YimingWu
Date:   Sat Nov 7 20:20:44 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBe5310101fa24953e7830828f21a55c7a2a33a547

LineArt: Vertex weight transfer index error now fixed.

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

M	source/blender/editors/include/ED_lineart.h
M	source/blender/editors/lineart/lineart_chain.c
M	source/blender/editors/lineart/lineart_cpu.c

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

diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index cac00973eed..41f3badb236 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -140,6 +140,9 @@ typedef struct LineartRenderLine {
   /* We only need link node kind of list here. */
   struct LineartRenderLine *next;
   struct LineartRenderVert *l, *r;
+  /* Local vertex index for two ends, not puting in RenderVert because all verts are loaded, so as
+   * long as fewer than half of the mesh edges are becoming a feature line, we save more memory. */
+  int l_obindex, r_obindex;
   struct LineartRenderTriangle *tl, *tr;
   ListBase segments;
   char min_occ;
diff --git a/source/blender/editors/lineart/lineart_chain.c b/source/blender/editors/lineart/lineart_chain.c
index ac2e2e901e3..db9c87189f8 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -244,7 +244,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                              rl->flags,
                              rls->occlusion,
                              rls->transparency_mask,
-                             new_rv->index);
+                             rl->l_obindex);
     while (ba && (new_rl = lineart_line_get_connected(ba, new_rv, &new_rv, rl->flags))) {
       new_rl->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
 
@@ -279,7 +279,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                    new_rl->flags,
                                    rls->occlusion,
                                    rls->transparency_mask,
-                                   new_rv->index);
+                                   new_rl->l_obindex);
           last_occlusion = rls->occlusion;
           last_transparency = rls->transparency_mask;
         }
@@ -304,7 +304,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                    new_rl->flags,
                                    last_occlusion,
                                    last_transparency,
-                                   new_rv->index);
+                                   new_rl->r_obindex);
           last_occlusion = rls->occlusion;
           last_transparency = rls->transparency_mask;
         }
@@ -317,7 +317,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                  new_rl->flags,
                                  last_occlusion,
                                  last_transparency,
-                                 new_rv->index);
+                                 new_rl->r_obindex);
       }
       ba = ED_lineart_get_point_bounding_area_deep(rb, new_rv->fbcoord[0], new_rv->fbcoord[1]);
     }
@@ -356,7 +356,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                  rl->flags,
                                  rls->occlusion,
                                  rls->transparency_mask,
-                                 rl->l->index);
+                                 rl->l_obindex);
       last_occlusion = rls->occlusion;
     }
     VERT_COORD_TO_FLOAT(rl->r)
@@ -368,7 +368,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                rl->flags,
                                last_occlusion,
                                last_transparency,
-                               rl->r->index);
+                               rl->r_obindex);
 
     /*  step 3: grow right. */
     ba = ED_lineart_get_point_bounding_area_deep(rb, rl->r->fbcoord[0], rl->r->fbcoord[1]);
@@ -419,7 +419,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                      new_rl->flags,
                                      last_occlusion,
                                      last_transparency,
-                                     new_rv->index);
+                                     new_rl->l_obindex);
         }
       }
       else if (new_rv == new_rl->r) {
@@ -443,7 +443,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                      new_rl->flags,
                                      rls->occlusion,
                                      rls->transparency_mask,
-                                     new_rv->index);
+                                     new_rl->r_obindex);
           last_occlusion = rls->occlusion;
           last_transparency = rls->transparency_mask;
         }
@@ -456,7 +456,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
                                    new_rl->flags,
                                    last_occlusion,
                                    last_transparency,
-                                   new_rv->index);
+                                   new_rl->r_obindex);
       }
       ba = ED_lineart_get_point_bounding_area_deep(rb, new_rv->fbcoord[0], new_rv->fbcoord[1]);
     }
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 84668ca15f9..8debc1cc32d 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -698,6 +698,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
   int v_count = *r_v_count;
   int l_count = *r_l_count;
   int t_count = *r_t_count;
+  int l_obi, r_obi;
   char new_flag = 0;
 
   LineartRenderLine *new_rl, *rl, *old_rl;
@@ -721,8 +722,12 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
 
 #define INCREASE_RL \
   l_count++; \
+  l_obi = rl->l_obindex; \
+  r_obi = rl->r_obindex; \
   new_rl = &((LineartRenderLine *)leln->pointer)[l_count]; \
   rl = new_rl; \
+  rl->l_obindex = l_obi; \
+  rl->r_obindex = r_obi; \
   rls = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartRenderLineSegment)); \
   BLI_addtail(&rl->segments, rls);
 
@@ -1641,6 +1646,8 @@ static void lineart_geometry_object_load(Depsgraph *dg,
 
       rl->l = &orv[BM_elem_index_get(e->v1)];
       rl->r = &orv[BM_elem_index_get(e->v2)];
+      rl->l_obindex = rl->l->index - global_i;
+      rl->r_obindex = rl->r->index - global_i;
       if (e->l) {
         int findex = BM_elem_index_get(e->l->f);
         rl->tl = lineart_triangle_from_index(rb, ort, findex);



More information about the Bf-blender-cvs mailing list