[Bf-blender-cvs] [cd9317e74e4] lanpr-under-gp: LineArt: Near clipping intersection hack.

YimingWu noreply at git.blender.org
Wed Jul 29 16:51:21 CEST 2020


Commit: cd9317e74e409ccb67770b33d84aa1d132dca9a3
Author: YimingWu
Date:   Wed Jul 29 22:44:39 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBcd9317e74e409ccb67770b33d84aa1d132dca9a3

LineArt: Near clipping intersection hack.

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

M	source/blender/editors/include/ED_lineart.h
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 a002c4d1779..29b00e70e7b 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -325,6 +325,7 @@ typedef enum eLineartCullState {
   LRT_CULL_DONT_CARE = 0,
   LRT_CULL_USED = 1,
   LRT_CULL_DISCARD = 2,
+  LRT_CULL_GENERATED = 3,
 } eLineartCullState;
 
 /** Controls how many lines a worker thread is processing at one request.
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 9b961dc1253..d47e094e0fb 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -668,6 +668,7 @@ static void lineart_triangle_post(LineartRenderTriangle *rt, LineartRenderTriang
   mul_v3db_db(rt->gc, 1.0f / 3.0f);
 
   copy_v3_v3_db(rt->gn, orig->gn);
+  rt->cull_status = LRT_CULL_GENERATED;
 }
 
 /** This function cuts triangles that are (partially or fully) behind near clipping plane.
@@ -1876,11 +1877,6 @@ static bool lineart_triangle_share_edge(const LineartRenderTriangle *l,
       l->rl[1]->tl == r || l->rl[1]->tr == r) {
     return true;
   }
-  if (l->rl[0] == r->rl[0] || l->rl[0] == r->rl[1] || l->rl[0] == r->rl[2] ||
-      l->rl[1] == r->rl[0] || l->rl[1] == r->rl[1] || l->rl[1] == r->rl[2] ||
-      l->rl[2] == r->rl[0] || l->rl[2] == r->rl[1] || l->rl[2] == r->rl[2]) {
-    return true;
-  }
   return false;
 }
 
@@ -2148,8 +2144,9 @@ static void lineart_triangle_intersections_in_bounding_area(LineartRenderBuffer
     next_lip = lip->next;
     testing_triangle = lip->data;
     if (testing_triangle == rt || testing_triangle->testing == rt ||
+        (rt->cull_status == LRT_CULL_GENERATED &&
+         testing_triangle->cull_status == LRT_CULL_GENERATED) ||
         lineart_triangle_share_edge(rt, testing_triangle)) {
-
       continue;
     }
 
@@ -3085,7 +3082,7 @@ static void lineart_add_triangles(LineartRenderBuffer *rb)
     rt = reln->pointer;
     lim = reln->element_count;
     for (i = 0; i < lim; i++) {
-      if (rt->cull_status) {
+      if (rt->cull_status == LRT_CULL_USED || rt->cull_status == LRT_CULL_DISCARD) {
         rt = (void *)(((unsigned char *)rt) + rb->triangle_size);
         continue;
       }



More information about the Bf-blender-cvs mailing list