diff options
6 files changed, 27 insertions, 14 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index ae013a7dd02..22037d10a71 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -442,6 +442,7 @@ typedef enum eLineartTriangleFlags { LRT_TRIANGLE_INTERSECTION_ONLY = (1 << 3), LRT_TRIANGLE_NO_INTERSECTION = (1 << 4), LRT_TRIANGLE_MAT_BACK_FACE_CULLING = (1 << 5), + LRT_TRIANGLE_FORCE_INTERSECTION = (1 << 6), } eLineartTriangleFlags; #define LRT_SHADOW_MASK_UNDEFINED 0 diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index c4a235d06bc..6d0ede03680 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -1905,6 +1905,9 @@ static void lineart_load_tri_task(void *__restrict userdata, if (ob_info->usage == OBJECT_LRT_INTERSECTION_ONLY) { tri->flags |= LRT_TRIANGLE_INTERSECTION_ONLY; } + else if (ob_info->usage == OBJECT_LRT_FORCE_INTERSECTION) { + tri->flags |= LRT_TRIANGLE_FORCE_INTERSECTION; + } else if (ob_info->usage == OBJECT_LRT_NO_INTERSECTION || ob_info->usage == OBJECT_LRT_OCCLUSION_ONLY) { tri->flags |= LRT_TRIANGLE_NO_INTERSECTION; @@ -2252,7 +2255,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *ob_info, } if (usage == OBJECT_LRT_INHERIT || usage == OBJECT_LRT_INCLUDE || - usage == OBJECT_LRT_NO_INTERSECTION) { + usage == OBJECT_LRT_NO_INTERSECTION || usage == OBJECT_LRT_FORCE_INTERSECTION) { lineart_add_edge_to_array_thread(ob_info, la_edge); } @@ -2281,7 +2284,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *ob_info, la_edge->edge_identifier = LRT_EDGE_IDENTIFIER(ob_info, la_edge); BLI_addtail(&la_edge->segments, la_seg); if (usage == OBJECT_LRT_INHERIT || usage == OBJECT_LRT_INCLUDE || - usage == OBJECT_LRT_NO_INTERSECTION) { + usage == OBJECT_LRT_NO_INTERSECTION || usage == OBJECT_LRT_FORCE_INTERSECTION) { lineart_add_edge_to_array_thread(ob_info, la_edge); if (shadow_eln) { LineartEdge *shadow_e = lineart_find_matching_edge(shadow_eln, la_edge->edge_identifier); @@ -2382,6 +2385,8 @@ static int lineart_usage_check(Collection *c, Object *ob, bool is_render) return OBJECT_LRT_INTERSECTION_ONLY; case COLLECTION_LRT_NO_INTERSECTION: return OBJECT_LRT_NO_INTERSECTION; + case COLLECTION_LRT_FORCE_INTERSECTION: + return OBJECT_LRT_FORCE_INTERSECTION; } return OBJECT_LRT_INHERIT; } @@ -3410,10 +3415,11 @@ static void lineart_triangle_intersect_in_bounding_area(LineartTriangle *tri, } tt->testing_e[th->thread_id] = (LineartEdge *)tri; - if ((testing_triangle->flags & LRT_TRIANGLE_NO_INTERSECTION) || - ((testing_triangle->flags & LRT_TRIANGLE_INTERSECTION_ONLY) && - (tri->flags & LRT_TRIANGLE_INTERSECTION_ONLY))) { - continue; + if(!((testing_triangle->flags | tri->flags) & LRT_TRIANGLE_FORCE_INTERSECTION)){ + if ((testing_triangle->flags & LRT_TRIANGLE_NO_INTERSECTION) || + (testing_triangle->flags & tri->flags & LRT_TRIANGLE_INTERSECTION_ONLY)) { + continue; + } } double *RG0 = testing_triangle->v[0]->gloc, *RG1 = testing_triangle->v[1]->gloc, @@ -4535,14 +4541,8 @@ static void lineart_add_triangles_worker(TaskPool *__restrict UNUSED(pool), Line _dir_control++; for (co = x1; co <= x2; co++) { for (r = y1; r <= y2; r++) { - lineart_bounding_area_link_triangle(ld, - &ld->qtree.initials[r * ld->qtree.count_x + co], - tri, - 0, - 1, - 0, - (!(tri->flags & LRT_TRIANGLE_NO_INTERSECTION)), - th); + lineart_bounding_area_link_triangle( + ld, &ld->qtree.initials[r * ld->qtree.count_x + co], tri, 0, 1, 0, 1, th); } } } /* Else throw away. */ diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h index a3e5eb4e944..75bfc2575a5 100644 --- a/source/blender/makesdna/DNA_collection_types.h +++ b/source/blender/makesdna/DNA_collection_types.h @@ -36,6 +36,7 @@ enum eCollectionLineArt_Usage { COLLECTION_LRT_EXCLUDE = (1 << 1), COLLECTION_LRT_INTERSECTION_ONLY = (1 << 2), COLLECTION_LRT_NO_INTERSECTION = (1 << 3), + COLLECTION_LRT_FORCE_INTERSECTION = (1 << 4), }; enum eCollectionLineArt_Flags { diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index add11d61db8..8296855ec29 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -231,6 +231,7 @@ enum eObjectLineArt_Usage { OBJECT_LRT_EXCLUDE = (1 << 2), OBJECT_LRT_INTERSECTION_ONLY = (1 << 3), OBJECT_LRT_NO_INTERSECTION = (1 << 4), + OBJECT_LRT_FORCE_INTERSECTION = (1 << 5), }; enum eObjectLineArt_Flags { diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 84ddea368e7..833495dce7a 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -599,6 +599,11 @@ void RNA_def_collections(BlenderRNA *brna) 0, "No Intersection", "Include this collection but do not generate intersection lines"}, + {COLLECTION_LRT_FORCE_INTERSECTION, + "FORCE_INTERSECTION", + 0, + "Force Intersection", + "Generate intersection lines even with objects that disabled intersection"}, {0, NULL, 0, NULL, NULL}}; prop = RNA_def_property(srna, "lineart_usage", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index d60e732ba51..46a89d3a6e0 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2922,6 +2922,11 @@ static void rna_def_object_lineart(BlenderRNA *brna) 0, "No Intersection", "Include this object but do not generate intersection lines"}, + {OBJECT_LRT_FORCE_INTERSECTION, + "FORCE_INTERSECTION", + 0, + "Force Intersection", + "Generate intersection lines even with objects that disabled intersection"}, {0, NULL, 0, NULL, NULL}, }; |