[Bf-blender-cvs] [423dee4202b] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

YimingWu noreply at git.blender.org
Wed May 26 17:33:32 CEST 2021


Commit: 423dee4202bb5d898da4b81b04223fcee9fe23e1
Author: YimingWu
Date:   Wed May 26 23:32:06 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB423dee4202bb5d898da4b81b04223fcee9fe23e1

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

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



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

diff --cc source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 66ec8b85f16,e679dce2f2d..99cd1fd9c7d
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@@ -103,11 -102,12 +103,11 @@@ typedef struct LineartEdgeSegment 
  
    /**
     * For determining lines behind a glass window material.
 -   * the size of this variable should also be dynamically decided, 1 byte to 8 byte,
 -   * allows 8 to 64 materials for "transparent mask". 1 byte (8 materials) should be
 -   * enough for most cases.
 +   * allows 6 materials for "transparent mask", from bits 1<<2 to 1<<7.
 +   * bits 1<<0 and 1<<1 are for occlusion effectiveness value.
     */
    unsigned char transparency_mask;
- } LineartLineSegment;
+ } LineartEdgeSegment;
  
  typedef struct LineartVert {
    double gloc[3];
diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 1f7353d0e35,c8e4e93843a..a2d6f675371
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@@ -37,12 -37,11 +37,12 @@@
   * intersection lines) who has a vert that has the exact same position. */
  static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
                                                 LineartVert *vt,
-                                                LineartVert **new_rv,
+                                                LineartVert **new_vt,
 -                                               int match_flag)
 +                                               int match_flag,
 +                                               unsigned char match_isec_mask)
  {
 -  LISTBASE_FOREACH (LinkData *, lip, &ba->linked_edges) {
 -    LineartEdge *n_e = lip->data;
 +  for (int i = 0; i < ba->line_count; i++) {
 +    LineartEdge *n_e = ba->linked_lines[i];
  
      if ((!(n_e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (n_e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
        continue;
@@@ -52,12 -51,8 +52,12 @@@
        continue;
      }
  
 +    if (n_e->intersection_mask != match_isec_mask) {
 +      continue;
 +    }
 +
-     *new_rv = LRT_OTHER_RV(n_e, vt);
-     if (*new_rv) {
+     *new_vt = LRT_OTHER_VERT(n_e, vt);
+     if (*new_vt) {
        return n_e;
      }
  
@@@ -117,14 -112,14 +117,14 @@@ static LineartEdgeChainItem *lineart_ch
      /* 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. */
--    LineartEdgeChainItem *old_rlci = ec->chain.last;
--    old_rlci->line_type = type;
--    old_rlci->occlusion = level;
--    old_rlci->transparency_mask = transparency_mask;
--    return old_rlci;
++    LineartEdgeChainItem *old_eci = ec->chain.last;
++    old_eci->line_type = type;
++    old_eci->occlusion = level;
++    old_eci->transparency_mask = transparency_mask;
++    return old_eci;
    }
  
 -  eci = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartEdgeChainItem));
 +  eci = lineart_mem_acquire(rb->chain_data_pool, sizeof(LineartEdgeChainItem));
  
    copy_v2_v2(eci->pos, fbcoord);
    copy_v3_v3(eci->gpos, gpos);
@@@ -199,13 -194,12 +199,13 @@@ void MOD_lineart_chain_feature_lines(Li
  
      ec = lineart_chain_create(rb);
  
 -    /* One chain can only have one object_ref,
 -     * so we assign it based on the first segment we found. */
 +    /* One chain can only have one object_ref and intersection_mask,
 +     * so we assign them based on the first segment we found. */
      ec->object_ref = e->object_ref;
 +    ec->intersection_mask = e->intersection_mask;
  
      LineartEdge *new_e = e;
-     LineartVert *new_rv;
+     LineartVert *new_vt;
      float N[3] = {0};
  
      if (e->t1) {
@@@ -233,11 -227,10 +233,11 @@@
                                  use_gpos,
                                  N,
                                  e->flags,
-                                 rls->occlusion,
-                                 rls->transparency_mask,
+                                 es->occlusion,
+                                 es->transparency_mask,
                                  e->v1_obindex);
 -    while (ba && (new_e = lineart_line_get_connected(ba, new_vt, &new_vt, e->flags))) {
 +    while (ba && (new_e = lineart_line_get_connected(
-                       ba, new_rv, &new_rv, e->flags, ec->intersection_mask))) {
++                      ba, new_vt, &new_vt, e->flags, ec->intersection_mask))) {
        new_e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
  
        if (new_e->t1 || new_e->t2) {
@@@ -366,9 -359,8 +366,9 @@@
  
      /*  Step 3: grow right. */
      ba = MOD_lineart_get_bounding_area(rb, e->v2->fbcoord[0], e->v2->fbcoord[1]);
-     new_rv = e->v2;
+     new_vt = e->v2;
 -    while (ba && (new_e = lineart_line_get_connected(ba, new_vt, &new_vt, e->flags))) {
 +    while (ba && (new_e = lineart_line_get_connected(
-                       ba, new_rv, &new_rv, e->flags, ec->intersection_mask))) {
++                      ba, new_vt, &new_vt, e->flags, ec->intersection_mask))) {
        new_e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
  
        if (new_e->t1 || new_e->t2) {
@@@ -568,8 -560,8 +568,8 @@@ static void lineart_bounding_area_link_
  
  void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
  {
--  LineartEdgeChain *ec, *new_rlc;
--  LineartEdgeChainItem *eci, *next_rlci;
++  LineartEdgeChain *ec, *new_ec;
++  LineartEdgeChainItem *eci, *next_eci;
    ListBase swap = {0};
  
    swap.first = rb->chains.first;
@@@ -580,16 -572,16 +580,16 @@@
    while ((ec = BLI_pophead(&swap)) != NULL) {
      ec->next = ec->prev = NULL;
      BLI_addtail(&rb->chains, ec);
--    LineartEdgeChainItem *first_rlci = (LineartEdgeChainItem *)ec->chain.first;
--    int fixed_occ = first_rlci->occlusion;
-     unsigned char fixed_trans_mask = first_rlci->transparency_mask;
 -    unsigned char fixed_mask = first_rlci->transparency_mask;
++    LineartEdgeChainItem *first_eci = (LineartEdgeChainItem *)ec->chain.first;
++    int fixed_occ = first_eci->occlusion;
++    unsigned char fixed_trans_mask = first_eci->transparency_mask;
      ec->level = fixed_occ;
 -    ec->transparency_mask = fixed_mask;
 -    for (eci = first_rlci->next; eci; eci = next_rlci) {
 -      next_rlci = eci->next;
 -      if (eci->occlusion != fixed_occ || eci->transparency_mask != fixed_mask) {
 -        if (next_rlci) {
 -          if (lineart_point_overlapping(next_rlci, eci->pos[0], eci->pos[1], 1e-5)) {
 +    ec->transparency_mask = fixed_trans_mask;
-     for (eci = first_rlci->next; eci; eci = next_rlci) {
-       next_rlci = eci->next;
++    for (eci = first_eci->next; eci; eci = next_eci) {
++      next_eci = eci->next;
 +      if (eci->occlusion != fixed_occ || eci->transparency_mask != fixed_trans_mask) {
-         if (next_rlci) {
-           if (lineart_point_overlapping(next_rlci, eci->pos[0], eci->pos[1], 1e-5)) {
++        if (next_eci) {
++          if (lineart_point_overlapping(next_eci, eci->pos[0], eci->pos[1], 1e-5)) {
              continue;
            }
          }
@@@ -601,9 -593,9 +601,9 @@@
            /* No need to split at the last point anyway. */
            break;
          }
--        new_rlc = lineart_chain_create(rb);
--        new_rlc->chain.first = eci;
--        new_rlc->chain.last = ec->chain.last;
++        new_ec = lineart_chain_create(rb);
++        new_ec->chain.first = eci;
++        new_ec->chain.last = ec->chain.last;
          ec->chain.last = eci->prev;
          ((LineartEdgeChainItem *)ec->chain.last)->next = 0;
          eci->prev = 0;
@@@ -616,16 -608,15 +616,16 @@@
                                     eci->normal,
                                     eci->line_type,
                                     fixed_occ,
 -                                   fixed_mask,
 +                                   fixed_trans_mask,
                                     eci->index);
--        new_rlc->object_ref = ec->object_ref;
--        new_rlc->type = ec->type;
-         new_rlc->intersection_mask = ec->intersection_mask;
--        ec = new_rlc;
++        new_ec->object_ref = ec->object_ref;
++        new_ec->type = ec->type;
++        new_ec->intersection_mask = ec->intersection_mask;
++        ec = new_ec;
          fixed_occ = eci->occlusion;
 -        fixed_mask = eci->transparency_mask;
 +        fixed_trans_mask = eci->transparency_mask;
          ec->level = fixed_occ;
 -        ec->transparency_mask = fixed_mask;
 +        ec->transparency_mask = fixed_trans_mask;
        }
      }
    }
@@@ -786,7 -775,7 +786,7 @@@ static LineartChainRegisterEntry *linea
  void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
  {
    LineartEdgeChain *ec;
--  LineartEdgeChainItem *rlci_l, *rlci_r;
++  LineartEdgeChainItem *eci_l, *eci_r;
    LineartBoundingArea *ba_l, *ba_r;
    LineartChainRegisterEntry *closest_cre_l, *closest_cre_r, *closest_cre;
    float dist = rb->chaining_image_threshold;
@@@ -811,22 -800,17 +811,22 @@@
      }
      BLI_addtail(&rb->chains, ec);
  
 +    if (ec->type == LRT_EDGE_FLAG_FLOATING && (!rb->chain_floating_edges)) {
 +      continue;
 +    }
 +
      occlusion = ec->level;
 -    transparency_mask = ec->transparency_mask;
 +    trans_mask = ec->transparency_mask;
 +    isec_mask = ec->intersection_mask;
  
--    rlci_l = ec->chain.first;
--    rlci_r = ec->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))) {
++    eci_l = ec->chain.first;
++    eci_r = ec->chain.last;
++    while ((ba_l = lineart_bounding_area_get_end_point(rb, eci_l)) &&
++           (ba_r = lineart_bounding_area_get_end_point(rb, eci_r))) {
        closest_cre_l = lineart_chain_get_closest_cre(
-           rb, ba_l, ec, rlci_l, occlusion, trans_mask, isec_mask, dist, &dist_l, NULL);
 -          rb, ba_l, ec, rlci_l, occlusion, transparency_mask, dist, &dist_l, NULL);
++          rb, ba_l, ec, eci_l, occlusion, trans_mask, isec_mask, dist, &dist_l, NULL);
        closest_cre_r = lineart_chain_get_closest_cre(


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list