Commit: ca2c6634d5f1849c56232355179c0ca264db7d4d Author: YimingWu Date: Thu Jun 10 20:53:27 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rBca2c6634d5f1849c56232355179c0ca264db7d4d
LineArt: Change edge flag to 16 bits. =================================================================== M release/datafiles/locale M release/scripts/addons M release/scripts/addons_contrib M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c M source/blender/makesdna/DNA_lineart_types.h M source/tools =================================================================== diff --git a/release/datafiles/locale b/release/datafiles/locale index 5ab29b1331d..2cef4877edc 160000 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 5ab29b1331d2103dae634b987f121c4599459d7f +Subproject commit 2cef4877edc40875978c4e95322bb5193f5815bf diff --git a/release/scripts/addons b/release/scripts/addons index cdabac54c4f..4fcdbfe7c20 160000 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit cdabac54c4fe7c6f8df125814442762aa539172b +Subproject commit 4fcdbfe7c20edfc1204c0aa46c98ea25354abcd9 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index 5a82baad9f9..7d78c8a63f2 160000 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit 5a82baad9f986722104280e8354a4427d8e9eab1 +Subproject commit 7d78c8a63f2f4b146f9327ddc0d567a5921b94ea diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index 866f7eb72c5..8a8f379eedb 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -151,8 +151,8 @@ typedef struct LineartEdge { char min_occ; /** Also for line type determination on chaining. */ - unsigned char flags; - unsigned char intersection_mask; + uint16_t flags; + uint8_t intersection_mask; /** * Still need this entry because culled lines will not add to object diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 34d7ef60d5b..0190f49f812 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -782,7 +782,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb, int e_count = *r_e_count; int t_count = *r_t_count; int v1_obi, v2_obi; - char new_flag = 0; + uint16_t new_flag = 0; LineartEdge *new_e, *e, *old_e; LineartEdgeSegment *es; @@ -1441,15 +1441,15 @@ static LineartTriangle *lineart_triangle_from_index(LineartRenderBuffer *rb, return (LineartTriangle *)b; } -static char lineart_identify_feature_line(LineartRenderBuffer *rb, - BMEdge *e, - LineartTriangle *rt_array, - LineartVert *rv_array, - float crease_threshold, - bool no_crease, - bool use_freestyle_edge, - bool use_freestyle_face, - BMesh *bm_if_freestyle) +static uint16_t lineart_identify_feature_line(LineartRenderBuffer *rb, + BMEdge *e, + LineartTriangle *rt_array, + LineartVert *rv_array, + float crease_threshold, + bool no_crease, + bool use_freestyle_edge, + bool use_freestyle_face, + BMesh *bm_if_freestyle) { BMLoop *ll, *lr = NULL; @@ -1518,7 +1518,7 @@ static char lineart_identify_feature_line(LineartRenderBuffer *rb, double *view_vector = vv; double dot_1 = 0, dot_2 = 0; double result; - char edge_flag_result = 0; + uint16_t edge_flag_result = 0; if (rb->cam_is_persp) { sub_v3_v3v3_db(view_vector, l->gloc, rb->camera_pos); @@ -1638,11 +1638,11 @@ static void lineart_triangle_adjacent_assign(LineartTriangle *tri, } } -static int lineart_edge_type_duplication_count(char eflag) +static int lineart_edge_type_duplication_count(uint8_t eflag) { int count = 0; /* See eLineartEdgeFlag for details. */ - for (int i = 0; i < LRT_EDGE_FLAG_FLOATING; i++) { + for (int i = 0; i < LRT_EDGE_FLAG_TYPE_MAX_BITS; i++) { if (eflag & (1 << i)) { count++; } @@ -1838,15 +1838,15 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu e = BM_edge_at_index(bm, i); /* Because e->head.hflag is char, so line type flags should not exceed positive 7 bits. */ - char eflag = lineart_identify_feature_line(rb, - e, - ort, - orv, - use_crease, - orig_ob->type == OB_FONT, - can_find_freestyle_edge, - can_find_freestyle_face, - bm); + uint16_t eflag = lineart_identify_feature_line(rb, + e, + ort, + orv, + use_crease, + orig_ob->type == OB_FONT, + can_find_freestyle_edge, + can_find_freestyle_face, + bm); if (eflag) { /* Only allocate for feature lines (instead of all lines) to save memory. * If allow duplicated edges, one edge gets added multiple times if it has multiple types. */ @@ -1855,7 +1855,8 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu /* Here we just use bm's flag for when loading actual lines, then we don't need to call * lineart_identify_feature_line() again, e->head.hflag deleted after loading anyway. Always * set the flag, so hflag stays 0 for lines that are not feature lines. */ - e->head.hflag = eflag; + e->head.hflag = 0; + e->head.hflag |= eflag; } o_la_e = lineart_mem_acquire_thread(&rb->render_data_pool, sizeof(LineartEdge) * allocate_la_e); @@ -1881,8 +1882,8 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu bool edge_added = false; /* See eLineartEdgeFlag for details. */ - for (int flag_bit = 0; flag_bit < LRT_EDGE_FLAG_FLOATING; flag_bit++) { - char use_type = 1 << flag_bit; + for (int flag_bit = 0; flag_bit < LRT_EDGE_FLAG_TYPE_MAX_BITS; flag_bit++) { + uint8_t use_type = 1 << flag_bit; if (!(use_type & e->head.hflag)) { continue; } diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h index 26bb6299cfe..576bcc37f3d 100644 --- a/source/blender/makesdna/DNA_lineart_types.h +++ b/source/blender/makesdna/DNA_lineart_types.h @@ -65,14 +65,18 @@ typedef enum eLineartEdgeFlag { LRT_EDGE_FLAG_CREASE = (1 << 2), LRT_EDGE_FLAG_MATERIAL = (1 << 3), LRT_EDGE_FLAG_INTERSECTION = (1 << 4), - /** Floating edge, unimplemented yet. */ LRT_EDGE_FLAG_FLOATING = (1 << 5), + LRT_EDGE_FLAG_LIGHT_CONTOUR = (1 << 6), + /* LRT_EDGE_FLAG_FOR_FUTURE = (1 << 7), */ + /* Limited to 8 bits for edge type flag, don't add anymore because BMEdge->head.eflag only has 8 + bits. So unless we changed this into a non-single-bit flag thing, we keep it this way. */ /** Also used as discarded line mark. */ - LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6), - LRT_EDGE_FLAG_CLIPPED = (1 << 7), - /** Limited to 8 bits, DON'T ADD ANYMORE until improvements on the data structure. */ + LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 8), + LRT_EDGE_FLAG_CLIPPED = (1 << 9), + /** Limited to 16 bits for the entire thing. */ } eLineartEdgeFlag; -#define LRT_EDGE_FLAG_ALL_TYPE 0x3f +#define LRT_EDGE_FLAG_ALL_TYPE 0x7f +#define LRT_EDGE_FLAG_TYPE_MAX_BITS 7 #endif diff --git a/source/tools b/source/tools index 01f51a0e551..f99d29ae3e6 160000 --- a/source/tools +++ b/source/tools @@ -1 +1 @@ -Subproject commit 01f51a0e551ab730f0934dc6488613690ac4bf8f +Subproject commit f99d29ae3e6ad44d45d79309454c45f8088781a4 _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs