LineArt: Force intersection option.
This option allows easier setup of intersection overrides on more complex scene structures. Setting force intersection would allow objects to always produce intersection lines even against no-intersection ones. Reviewed By: Aleš Jelovčan (frogstomp) Antonio Vazquez (antoniov) Differential Revision: https://developer.blender.org/D15978
This commit is contained in:
parent
4f284873d0
commit
0bdb5239c1
Notes:
blender-bot
2023-02-14 06:37:09 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3 Referenced by issue #101087, GPencil: Important feature request for Blender 3.3 LTS: Add new option "Forced Intersection"
|
@ -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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue