[Bf-blender-cvs] [4d21182f869] temp-lineart-contained: Cleanup LineartLine -> LineartEdge

Sebastian Parborg noreply at git.blender.org
Wed Mar 17 14:28:41 CET 2021


Commit: 4d21182f869de681aac4efc67ceeb95b368e238b
Author: Sebastian Parborg
Date:   Wed Mar 17 14:28:12 2021 +0100
Branches: temp-lineart-contained
https://developer.blender.org/rB4d21182f869de681aac4efc67ceeb95b368e238b

Cleanup LineartLine -> LineartEdge

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M	source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
M	source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_util.c
M	source/blender/makesdna/DNA_gpencil_modifier_defaults.h
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 7fed771dabe..2e03e07ea0f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -102,7 +102,7 @@ static void generate_strokes_actual(
       lmd->level_start,
       lmd->use_multiple_levels ? lmd->level_end : lmd->level_start,
       lmd->target_material ? BKE_gpencil_object_material_index_get(ob, lmd->target_material) : 0,
-      lmd->line_types,
+      lmd->edge_types,
       lmd->transparency_flags,
       lmd->transparency_mask,
       lmd->thickness,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 0c170deacbb..83f9ffeb11c 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -46,7 +46,7 @@ typedef struct LineartStaticMemPool {
 } LineartStaticMemPool;
 
 typedef struct LineartTriangleAdjacent {
-  struct LineartLine *rl[3];
+  struct LineartEdge *e[3];
 } LineartTriangleAdjacent;
 
 typedef struct LineartTriangle {
@@ -71,9 +71,9 @@ typedef struct LineartTriangleThread {
    * also re-used to store triangle-triangle pair for intersection testing stage.
    * Do not directly use LineartTriangleThread.
    * The size of LineartTriangle is dynamically allocated to contain set thread number of
-   * "testing" field. Worker threads will test lines against the "base" triangle.
-   * At least one thread is present, thus we always have at least testing[0]. */
-  struct LineartLine *testing[1];
+   * "testing_e" field. Worker threads will test lines against the "base" triangle.
+   * At least one thread is present, thus we always have at least testing_e[0]. */
+  struct LineartEdge *testing_e[1];
 } LineartTriangleThread;
 
 typedef enum eLineArtElementNodeFlag {
@@ -135,13 +135,13 @@ typedef enum eLineArtVertFlags {
   LRT_VERT_EDGE_USED = (1 << 1),
 } eLineArtVertFlags;
 
-typedef struct LineartLine {
+typedef struct LineartEdge {
   /* We only need link node kind of list here. */
-  struct LineartLine *next;
-  struct LineartVert *l, *r;
+  struct LineartEdge *next;
+  struct LineartVert *v1, *v2;
   /* 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;
+  int v1_obindex, v2_obindex;
   struct LineartTriangle *tl, *tr;
   ListBase segments;
   char min_occ;
@@ -154,7 +154,7 @@ typedef struct LineartLine {
    * another bit in flags to be able to show the difference.
    */
   struct Object *object_ref;
-} LineartLine;
+} LineartEdge;
 
 typedef struct LineartLineChain {
   struct LineartLineChain *next, *prev;
@@ -232,29 +232,29 @@ typedef struct LineartRenderBuffer {
 
   unsigned int contour_count;
   unsigned int contour_processed;
-  LineartLine *contour_managed;
+  LineartEdge *contour_managed;
   /* Now changed to linknodes. */
-  LineartLine *contours;
+  LineartEdge *contours;
 
   unsigned int intersection_count;
   unsigned int intersection_processed;
-  LineartLine *intersection_managed;
-  LineartLine *intersection_lines;
+  LineartEdge *intersection_managed;
+  LineartEdge *intersection_lines;
 
   unsigned int crease_count;
   unsigned int crease_processed;
-  LineartLine *crease_managed;
-  LineartLine *crease_lines;
+  LineartEdge *crease_managed;
+  LineartEdge *crease_lines;
 
   unsigned int material_line_count;
   unsigned int material_processed;
-  LineartLine *material_managed;
-  LineartLine *material_lines;
+  LineartEdge *material_managed;
+  LineartEdge *material_lines;
 
   unsigned int edge_mark_count;
   unsigned int edge_mark_processed;
-  LineartLine *edge_mark_managed;
-  LineartLine *edge_marks;
+  LineartEdge *edge_mark_managed;
+  LineartEdge *edge_marks;
 
   ListBase chains;
 
@@ -307,30 +307,30 @@ typedef enum eLineartTriangleFlags {
   LRT_TRIANGLE_NO_INTERSECTION = (1 << 4),
 } eLineartTriangleFlags;
 
-/** Controls how many lines a worker thread is processing at one request.
+/** Controls how many edges a worker thread is processing at one request.
  * There's no significant performance impact on choosing different values.
  * Don't make it too small so that the worker thread won't request too many times. */
-#define LRT_THREAD_LINE_COUNT 1000
+#define LRT_THREAD_EDGE_COUNT 1000
 
 typedef struct LineartRenderTaskInfo {
   struct LineartRenderBuffer *rb;
 
   int thread_id;
 
-  LineartLine *contour;
-  LineartLine *contour_end;
+  LineartEdge *contour;
+  LineartEdge *contour_end;
 
-  LineartLine *intersection;
-  LineartLine *intersection_end;
+  LineartEdge *intersection;
+  LineartEdge *intersection_end;
 
-  LineartLine *crease;
-  LineartLine *crease_end;
+  LineartEdge *crease;
+  LineartEdge *crease_end;
 
-  LineartLine *material;
-  LineartLine *material_end;
+  LineartEdge *material;
+  LineartEdge *material_end;
 
-  LineartLine *edge_mark;
-  LineartLine *edge_mark_end;
+  LineartEdge *edge_mark;
+  LineartEdge *edge_mark_end;
 
 } LineartRenderTaskInfo;
 
@@ -535,7 +535,7 @@ void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb,
                                   int level_start,
                                   int level_end,
                                   int mat_nr,
-                                  short line_types,
+                                  short edge_types,
                                   unsigned char transparency_flags,
                                   unsigned char transparency_mask,
                                   short thickness,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 10a028d94cc..9e60090c4eb 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -44,39 +44,39 @@
 
 #include <math.h>
 
-#define LRT_OTHER_RV(rl, rv) ((rv) == (rl)->l ? (rl)->r : ((rv) == (rl)->r ? (rl)->l : NULL))
+#define LRT_OTHER_RV(e, rv) ((rv) == (e)->v1 ? (e)->v2 : ((rv) == (e)->v2 ? (e)->v1 : NULL))
 
 /* Get a connected line, only for lines who has the exact given vert, or (in the case of
  * intersection lines) who has a vert that has the exact same position. */
-static LineartLine *lineart_line_get_connected(LineartBoundingArea *ba,
+static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
                                                LineartVert *rv,
                                                LineartVert **new_rv,
                                                int match_flag)
 {
   LISTBASE_FOREACH (LinkData *, lip, &ba->linked_lines) {
-    LineartLine *nrl = lip->data;
+    LineartEdge *n_e = lip->data;
 
-    if ((!(nrl->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (nrl->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
+    if ((!(n_e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (n_e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
       continue;
     }
 
-    if (match_flag && ((nrl->flags & LRT_EDGE_FLAG_ALL_TYPE) & match_flag) == 0) {
+    if (match_flag && ((n_e->flags & LRT_EDGE_FLAG_ALL_TYPE) & match_flag) == 0) {
       continue;
     }
 
-    *new_rv = LRT_OTHER_RV(nrl, rv);
+    *new_rv = LRT_OTHER_RV(n_e, rv);
     if (*new_rv) {
-      return nrl;
+      return n_e;
     }
 
-    if (nrl->flags & LRT_EDGE_FLAG_INTERSECTION) {
-      if (rv->fbcoord[0] == nrl->l->fbcoord[0] && rv->fbcoord[1] == nrl->l->fbcoord[1]) {
-        *new_rv = LRT_OTHER_RV(nrl, nrl->l);
-        return nrl;
+    if (n_e->flags & LRT_EDGE_FLAG_INTERSECTION) {
+      if (rv->fbcoord[0] == n_e->v1->fbcoord[0] && rv->fbcoord[1] == n_e->v1->fbcoord[1]) {
+        *new_rv = LRT_OTHER_RV(n_e, n_e->v1);
+        return n_e;
       }
-      if (rv->fbcoord[0] == nrl->r->fbcoord[0] && rv->fbcoord[1] == nrl->r->fbcoord[1]) {
-        *new_rv = LRT_OTHER_RV(nrl, nrl->r);
-        return nrl;
+      if (rv->fbcoord[0] == n_e->v2->fbcoord[0] && rv->fbcoord[1] == n_e->v2->fbcoord[1]) {
+        *new_rv = LRT_OTHER_RV(n_e, n_e->v2);
+        return n_e;
       }
     }
   }
@@ -198,216 +198,216 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
 
   LRT_ITER_ALL_LINES_BEGIN
   {
-    if ((!(rl->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (rl->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
+    if ((!(e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
       LRT_ITER_ALL_LINES_NEXT
       continue;
     }
 
-    rl->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
+    e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
 
     rlc = lineart_chain_create(rb);
 
     /* One chain can only have one object_ref,
      * so we assign it based on the first segment we found. */
-    rlc->object_ref = rl->object_ref;
+    rlc->object_ref = e->object_ref;
 
-    LineartLine *new_rl = rl;
+    LineartEdge *new_e = e;
     LineartVert *new_rv;
     float N[3] = {0};
 
-    if (rl->tl) {
-      N[0] += rl->tl->gn[0];
-      N[1] += rl->tl->gn[1];
-      N[2] += rl->tl->gn[2];
+    if (e->tl) {
+      N[0] += e->tl->gn[0];
+      N[1] += e->tl->gn[1];
+      N[2] += e->tl->gn[2];
     }
-    if (rl->tr) {
-      N[0] += rl->tr->gn[0];
-      N[1] += rl->tr->gn[1];
-      N[2] += rl->tr->gn[2];
+    if (e->tr) {
+      N[0] += e->tr->gn[0];
+      N[1] += e->tr->gn[1];
+      N[2] += e->tr->gn[2];
     }
-    if (rl->tl || rl->tr) {
+    if (e->tl || e->tr) {
       normalize_v3(N);
     }
 
     /*  Step 1: grow left. */
-    ba = MOD_lineart_get_bounding_area(rb, rl->l->fbcoord[0], rl->l->fbcoord[1]);
-    new_rv = rl->l;
-    rls = rl->segments.first;
+    ba = MOD_lineart_get_bounding_area(rb, e->v1->fbcoord[0], e->v1->fbcoord[1]);
+    new_rv = e->v1;
+    rls = e->segments.first;
     VERT_COORD_TO_FLOAT(new_rv);
     lineart_chain_prepend_point(rb,
                                 rlc,
                                 use_fbcoord,
                                 use_gpos,
                                 N,
-                          

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list