[Bf-blender-cvs] [cb39e2800f4] lanpr-under-gp: LineArt: Object "No Intersection" flag.
YimingWu
noreply at git.blender.org
Sun Sep 27 04:46:18 CEST 2020
Commit: cb39e2800f478cfd380bc0f070775426c48af431
Author: YimingWu
Date: Sun Sep 27 10:45:52 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBcb39e2800f478cfd380bc0f070775426c48af431
LineArt: Object "No Intersection" flag.
===================================================================
M source/blender/editors/include/ED_lineart.h
M source/blender/editors/lineart/lineart_cpu.c
M source/blender/makesdna/DNA_object_types.h
M source/blender/makesrna/intern/rna_object.c
===================================================================
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 3b36f6391ea..fe66aed8522 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -75,6 +75,7 @@ typedef struct LineartRenderTriangleThread {
typedef enum eLineArtElementNodeFlag {
LRT_ELEMENT_IS_ADDITIONAL = (1 << 0),
LRT_ELEMENT_BORDER_ONLY = (1 << 1),
+ LRT_ELEMENT_NO_INTERSECTION = (1 << 2),
} eLineArtElementNodeFlag;
typedef struct LineartRenderElementLinkNode {
@@ -359,6 +360,7 @@ typedef enum eLineartTriangleFlags {
LRT_CULL_DISCARD = (1 << 1),
LRT_CULL_GENERATED = (1 << 2),
LRT_TRIANGLE_INTERSECTION_ONLY = (1 << 3),
+ LRT_TRIANGLE_NO_INTERSECTION = (1 << 4),
} eLineartTriangleFlags;
/** Controls how many lines a worker thread is processing at one request.
@@ -565,9 +567,9 @@ bool ED_lineart_calculation_flag_check(eLineartRenderStatus flag);
void ED_lineart_modifier_sync_flag_set(eLineartModifierSyncStatus flag, bool is_from_modifier);
bool ED_lineart_modifier_sync_flag_check(eLineartModifierSyncStatus flag);
-void ED_lineart_modifier_sync_add_customer();
-void ED_lineart_modifier_sync_remove_customer();
-bool ED_lineart_modifier_sync_still_has_customer();
+void ED_lineart_modifier_sync_add_customer(void);
+void ED_lineart_modifier_sync_remove_customer(void);
+bool ED_lineart_modifier_sync_still_has_customer(void);
int ED_lineart_compute_feature_lines_internal(struct Depsgraph *depsgraph,
const int show_frame_progress);
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 0d351927355..6bb17162f88 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -110,7 +110,8 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
LineartRenderTriangle *rt,
double *LRUB,
int recursive,
- int recursive_level);
+ int recursive_level,
+ bool do_intersection);
static int lineart_triangle_line_imagespace_intersection_v2(SpinLock *spl,
const LineartRenderTriangle *rt,
@@ -1599,6 +1600,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
sizeof(LineartRenderElementLinkNode));
reln->element_count = bm->totface;
reln->object_ref = orig_ob;
+ reln->flags |= (usage == OBJECT_LRT_NO_INTERSECTION ? LRT_ELEMENT_NO_INTERSECTION : 0);
for (i = 0; i < bm->totvert; i++) {
v = BM_vert_at_index(bm, i);
@@ -1628,7 +1630,8 @@ static void lineart_geometry_object_load(Depsgraph *dg,
LineartRenderLineSegment *rls = lineart_mem_aquire(&rb->render_data_pool,
sizeof(LineartRenderLineSegment));
BLI_addtail(&rl->segments, rls);
- if (usage == OBJECT_LRT_INHERENT) {
+ if (usage == OBJECT_LRT_INHERENT || usage == OBJECT_LRT_INCLUDE ||
+ usage == OBJECT_LRT_NO_INTERSECTION) {
BLI_addtail(&rb->all_render_lines, rl);
}
rl++;
@@ -1663,6 +1666,9 @@ static void lineart_geometry_object_load(Depsgraph *dg,
if (usage == OBJECT_LRT_INTERSECTION_ONLY) {
rt->flags |= LRT_TRIANGLE_INTERSECTION_ONLY;
}
+ else if (usage == OBJECT_LRT_NO_INTERSECTION) {
+ rt->flags |= LRT_TRIANGLE_NO_INTERSECTION;
+ }
rt = (LineartRenderTriangle *)(((unsigned char *)rt) + rb->triangle_size);
}
@@ -1702,7 +1708,7 @@ int ED_lineart_object_collection_usage_check(Collection *c, Object *ob)
}
if (c->children.first == NULL) {
- if (BKE_collection_has_object(c, (Object *)(ob->id.orig_id))) {
+ if (BKE_collection_has_object(c, ob)) {
if (ob->lineart.usage == OBJECT_LRT_INHERENT) {
if (c->lineart_usage == COLLECTION_LRT_OCCLUSION_ONLY) {
return OBJECT_LRT_OCCLUSION_ONLY;
@@ -2375,6 +2381,7 @@ static void lineart_triangle_intersections_in_bounding_area(LineartRenderBuffer
rtt = (LineartRenderTriangleThread *)testing_triangle;
if (testing_triangle == rt || rtt->testing[0] == (LineartRenderLine *)rt ||
//((rt->flags & LRT_CULL_GENERATED) && (testing_triangle->flags & LRT_CULL_GENERATED)) ||
+ (testing_triangle->flags & LRT_TRIANGLE_NO_INTERSECTION) ||
lineart_triangle_share_edge(rt, testing_triangle)) {
continue;
}
@@ -3068,16 +3075,16 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb,
b[2] = MAX3(rt->v[0]->fbcoord[1], rt->v[1]->fbcoord[1], rt->v[2]->fbcoord[1]);
b[3] = MIN3(rt->v[0]->fbcoord[1], rt->v[1]->fbcoord[1], rt->v[2]->fbcoord[1]);
if (LRT_BOUND_AREA_CROSSES(b, &cba[0].l)) {
- lineart_bounding_area_link_triangle(rb, &cba[0], rt, b, 0, recursive_level + 1);
+ lineart_bounding_area_link_triangle(rb, &cba[0], rt, b, 0, recursive_level + 1, false);
}
if (LRT_BOUND_AREA_CROSSES(b, &cba[1].l)) {
- lineart_bounding_area_link_triangle(rb, &cba[1], rt, b, 0, recursive_level + 1);
+ lineart_bounding_area_link_triangle(rb, &cba[1], rt, b, 0, recursive_level + 1, false);
}
if (LRT_BOUND_AREA_CROSSES(b, &cba[2].l)) {
- lineart_bounding_area_link_triangle(rb, &cba[2], rt, b, 0, recursive_level + 1);
+ lineart_bounding_area_link_triangle(rb, &cba[2], rt, b, 0, recursive_level + 1, false);
}
if (LRT_BOUND_AREA_CROSSES(b, &cba[3].l)) {
- lineart_bounding_area_link_triangle(rb, &cba[3], rt, b, 0, recursive_level + 1);
+ lineart_bounding_area_link_triangle(rb, &cba[3], rt, b, 0, recursive_level + 1, false);
}
}
@@ -3174,7 +3181,8 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
LineartRenderTriangle *rt,
double *LRUB,
int recursive,
- int recursive_level)
+ int recursive_level,
+ bool do_intersection)
{
if (!lineart_bounding_area_triangle_covered(rb, rt, root_ba)) {
return;
@@ -3189,7 +3197,7 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
if (root_ba->triangle_count > 200 && recursive && recursive_level < 10) {
lineart_bounding_area_split(rb, root_ba, recursive_level);
}
- if (recursive && rb->use_intersections) {
+ if (recursive && do_intersection && rb->use_intersections) {
lineart_triangle_intersections_in_bounding_area(rb, rt, root_ba);
}
}
@@ -3205,16 +3213,20 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
B1 = b;
}
if (LRT_BOUND_AREA_CROSSES(B1, &ba[0].l)) {
- lineart_bounding_area_link_triangle(rb, &ba[0], rt, B1, recursive, recursive_level + 1);
+ lineart_bounding_area_link_triangle(
+ rb, &ba[0], rt, B1, recursive, recursive_level + 1, do_intersection);
}
if (LRT_BOUND_AREA_CROSSES(B1, &ba[1].l)) {
- lineart_bounding_area_link_triangle(rb, &ba[1], rt, B1, recursive, recursive_level + 1);
+ lineart_bounding_area_link_triangle(
+ rb, &ba[1], rt, B1, recursive, recursive_level + 1, do_intersection);
}
if (LRT_BOUND_AREA_CROSSES(B1, &ba[2].l)) {
- lineart_bounding_area_link_triangle(rb, &ba[2], rt, B1, recursive, recursive_level + 1);
+ lineart_bounding_area_link_triangle(
+ rb, &ba[2], rt, B1, recursive, recursive_level + 1, do_intersection);
}
if (LRT_BOUND_AREA_CROSSES(B1, &ba[3].l)) {
- lineart_bounding_area_link_triangle(rb, &ba[3], rt, B1, recursive, recursive_level + 1);
+ lineart_bounding_area_link_triangle(
+ rb, &ba[3], rt, B1, recursive, recursive_level + 1, do_intersection);
}
}
}
@@ -3421,8 +3433,13 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb)
if (lineart_get_triangle_bounding_areas(rb, rt, &y1, &y2, &x1, &x2)) {
for (co = x1; co <= x2; co++) {
for (r = y1; r <= y2; r++) {
- lineart_bounding_area_link_triangle(
- rb, &rb->initial_bounding_areas[r * 4 + co], rt, 0, 1, 0);
+ lineart_bounding_area_link_triangle(rb,
+ &rb->initial_bounding_areas[r * 4 + co],
+ rt,
+ 0,
+ 1,
+ 0,
+ (!(rt->flags & OBJECT_LRT_NO_INTERSECTION)));
}
}
temp_count++;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 7a1dcec7d41..d9de906d085 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -200,6 +200,7 @@ enum ObjectFeatureLine_Usage {
OBJECT_LRT_OCCLUSION_ONLY = (1 << 1),
OBJECT_LRT_EXCLUDE = (1 << 2),
OBJECT_LRT_INTERSECTION_ONLY = (1 << 3),
+ OBJECT_LRT_NO_INTERSECTION = (1 << 4),
};
enum ObjectFeatureLine_Flags {
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index afd68b5e9c8..1156271b0e7 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2628,6 +2628,11 @@ static void rna_def_object_lineart(BlenderRNA *brna)
0,
"Intersection Only",
"Only to generate intersection lines with this object"},
+ {OBJECT_LRT_NO_INTERSECTION,
+ "NO_INTERSECTION",
+ 0,
+ "No Intersection",
+ "Include this object but do not generate intersection lines"},
{0, NULL, 0, NULL,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list