[Bf-blender-cvs] [ea48e3bdf3a] temp-lineart-contained: LineArt: Cleaning up naming convensions.

YimingWu noreply at git.blender.org
Tue May 25 14:09:25 CEST 2021


Commit: ea48e3bdf3a628e44879788cd4a6a5c1a62ee4e9
Author: YimingWu
Date:   Tue May 25 19:38:02 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBea48e3bdf3a628e44879788cd4a6a5c1a62ee4e9

LineArt: Cleaning up naming convensions.

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

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

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 51664d70432..77bde8ed485 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -164,8 +164,8 @@ typedef struct LineartEdge {
   struct Object *object_ref;
 } LineartEdge;
 
-typedef struct LineartLineChain {
-  struct LineartLineChain *next, *prev;
+typedef struct LineartEdgeChain {
+  struct LineartEdgeChain *next, *prev;
   ListBase chain;
 
   /** Calculated before draw command. */
@@ -181,10 +181,10 @@ typedef struct LineartLineChain {
   unsigned char intersection_mask;
 
   struct Object *object_ref;
-} LineartLineChain;
+} LineartEdgeChain;
 
-typedef struct LineartLineChainItem {
-  struct LineartLineChainItem *next, *prev;
+typedef struct LineartEdgeChainItem {
+  struct LineartEdgeChainItem *next, *prev;
   /** Need z value for fading */
   float pos[3];
   /** For restoring position to 3d space */
@@ -194,12 +194,12 @@ typedef struct LineartLineChainItem {
   char occlusion;
   unsigned char transparency_mask;
   size_t index;
-} LineartLineChainItem;
+} LineartEdgeChainItem;
 
 typedef struct LineartChainRegisterEntry {
   struct LineartChainRegisterEntry *next, *prev;
-  LineartLineChain *rlc;
-  LineartLineChainItem *rlci;
+  LineartEdgeChain *ec;
+  LineartEdgeChainItem *eci;
   char picked;
 
   /* left/right mark.
@@ -617,7 +617,7 @@ void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshol
 void MOD_lineart_smooth_chains(LineartRenderBuffer *rb, float tolerance);
 void MOD_lineart_chain_offset_towards_camera(LineartRenderBuffer *rb, float dist);
 
-int MOD_lineart_chain_count(const LineartLineChain *rlc);
+int MOD_lineart_chain_count(const LineartEdgeChain *ec);
 void MOD_lineart_chain_clear_picked_flag(LineartCache *lc);
 
 bool MOD_lineart_compute_feature_lines(struct Depsgraph *depsgraph,
@@ -656,6 +656,6 @@ void MOD_lineart_gpencil_generate(LineartCache *cache,
                                   const char *vgname,
                                   int modifier_flags);
 
-float MOD_lineart_chain_compute_length(LineartLineChain *rlc);
+float MOD_lineart_chain_compute_length(LineartEdgeChain *ec);
 
 void ED_operatortypes_lineart(void);
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index e3f76be6713..1f7353d0e35 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -31,12 +31,12 @@
 
 #include <math.h>
 
-#define LRT_OTHER_RV(e, rv) ((rv) == (e)->v1 ? (e)->v2 : ((rv) == (e)->v2 ? (e)->v1 : NULL))
+#define LRT_OTHER_RV(e, vt) ((vt) == (e)->v1 ? (e)->v2 : ((vt) == (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 LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
-                                               LineartVert *rv,
+                                               LineartVert *vt,
                                                LineartVert **new_rv,
                                                int match_flag,
                                                unsigned char match_isec_mask)
@@ -56,17 +56,17 @@ static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
       continue;
     }
 
-    *new_rv = LRT_OTHER_RV(n_e, rv);
+    *new_rv = LRT_OTHER_RV(n_e, vt);
     if (*new_rv) {
       return n_e;
     }
 
     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]) {
+      if (vt->fbcoord[0] == n_e->v1->fbcoord[0] && vt->fbcoord[1] == n_e->v1->fbcoord[1]) {
         *new_rv = LRT_OTHER_RV(n_e, n_e->v1);
         return n_e;
       }
-      if (rv->fbcoord[0] == n_e->v2->fbcoord[0] && rv->fbcoord[1] == n_e->v2->fbcoord[1]) {
+      if (vt->fbcoord[0] == n_e->v2->fbcoord[0] && vt->fbcoord[1] == n_e->v2->fbcoord[1]) {
         *new_rv = LRT_OTHER_RV(n_e, n_e->v2);
         return n_e;
       }
@@ -76,33 +76,33 @@ static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
   return NULL;
 }
 
-static LineartLineChain *lineart_chain_create(LineartRenderBuffer *rb)
+static LineartEdgeChain *lineart_chain_create(LineartRenderBuffer *rb)
 {
-  LineartLineChain *rlc;
-  rlc = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartLineChain));
+  LineartEdgeChain *ec;
+  ec = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartEdgeChain));
 
-  BLI_addtail(&rb->chains, rlc);
+  BLI_addtail(&rb->chains, ec);
 
-  return rlc;
+  return ec;
 }
 
-static bool lineart_point_overlapping(LineartLineChainItem *rlci,
+static bool lineart_point_overlapping(LineartEdgeChainItem *eci,
                                       float x,
                                       float y,
                                       double threshold)
 {
-  if (!rlci) {
+  if (!eci) {
     return false;
   }
-  if (((rlci->pos[0] + threshold) >= x) && ((rlci->pos[0] - threshold) <= x) &&
-      ((rlci->pos[1] + threshold) >= y) && ((rlci->pos[1] - threshold) <= y)) {
+  if (((eci->pos[0] + threshold) >= x) && ((eci->pos[0] - threshold) <= x) &&
+      ((eci->pos[1] + threshold) >= y) && ((eci->pos[1] - threshold) <= y)) {
     return true;
   }
   return false;
 }
 
-static LineartLineChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
-                                                        LineartLineChain *rlc,
+static LineartEdgeChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
+                                                        LineartEdgeChain *ec,
                                                         float *fbcoord,
                                                         float *gpos,
                                                         float *normal,
@@ -111,35 +111,35 @@ static LineartLineChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
                                                         unsigned char transparency_mask,
                                                         size_t index)
 {
-  LineartLineChainItem *rlci;
+  LineartEdgeChainItem *eci;
 
-  if (lineart_point_overlapping(rlc->chain.last, fbcoord[0], fbcoord[1], 1e-5)) {
+  if (lineart_point_overlapping(ec->chain.last, fbcoord[0], fbcoord[1], 1e-5)) {
     /* Because the new chain point is overlapping, just replace the type and occlusion level of the
      * current point. This makes it so that the line to the point after this one has the correct
      * type and level. */
-    LineartLineChainItem *old_rlci = rlc->chain.last;
+    LineartEdgeChainItem *old_rlci = ec->chain.last;
     old_rlci->line_type = type;
     old_rlci->occlusion = level;
     old_rlci->transparency_mask = transparency_mask;
     return old_rlci;
   }
 
-  rlci = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartLineChainItem));
+  eci = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartEdgeChainItem));
 
-  copy_v2_v2(rlci->pos, fbcoord);
-  copy_v3_v3(rlci->gpos, gpos);
-  rlci->index = index;
-  copy_v3_v3(rlci->normal, normal);
-  rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
-  rlci->occlusion = level;
-  rlci->transparency_mask = transparency_mask;
-  BLI_addtail(&rlc->chain, rlci);
+  copy_v2_v2(eci->pos, fbcoord);
+  copy_v3_v3(eci->gpos, gpos);
+  eci->index = index;
+  copy_v3_v3(eci->normal, normal);
+  eci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
+  eci->occlusion = level;
+  eci->transparency_mask = transparency_mask;
+  BLI_addtail(&ec->chain, eci);
 
-  return rlci;
+  return eci;
 }
 
-static LineartLineChainItem *lineart_chain_prepend_point(LineartRenderBuffer *rb,
-                                                         LineartLineChain *rlc,
+static LineartEdgeChainItem *lineart_chain_prepend_point(LineartRenderBuffer *rb,
+                                                         LineartEdgeChain *ec,
                                                          float *fbcoord,
                                                          float *gpos,
                                                          float *normal,
@@ -148,30 +148,30 @@ static LineartLineChainItem *lineart_chain_prepend_point(LineartRenderBuffer *rb
                                                          unsigned char transparency_mask,
                                                          size_t index)
 {
-  LineartLineChainItem *rlci;
+  LineartEdgeChainItem *eci;
 
-  if (lineart_point_overlapping(rlc->chain.first, fbcoord[0], fbcoord[1], 1e-5)) {
-    return rlc->chain.first;
+  if (lineart_point_overlapping(ec->chain.first, fbcoord[0], fbcoord[1], 1e-5)) {
+    return ec->chain.first;
   }
 
-  rlci = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartLineChainItem));
+  eci = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartEdgeChainItem));
 
-  copy_v2_v2(rlci->pos, fbcoord);
-  copy_v3_v3(rlci->gpos, gpos);
-  rlci->index = index;
-  copy_v3_v3(rlci->normal, normal);
-  rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
-  rlci->occlusion = level;
-  rlci->transparency_mask = transparency_mask;
-  BLI_addhead(&rlc->chain, rlci);
+  copy_v2_v2(eci->pos, fbcoord);
+  copy_v3_v3(eci->gpos, gpos);
+  eci->index = index;
+  copy_v3_v3(eci->normal, normal);
+  eci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
+  eci->occlusion = level;
+  eci->transparency_mask = transparency_mask;
+  BLI_addhead(&ec->chain, eci);
 
-  return rlci;
+  return eci;
 }
 
 void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
 {
-  LineartLineChain *rlc;
-  LineartLineChainItem *rlci;
+  LineartEdgeChain *ec;
+  LineartEdgeChainItem *eci;
   LineartBoundingArea *ba;
   LineartLineSegment *rls;
   int last_occlusion;
@@ -197,12 +197,12 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
 
     e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
 
-    rlc = lineart_chain_create(rb);
+    ec = lineart_chain_create(rb);
 
   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list