diff options
author | Fabian Schempp <fabianschempp@googlemail.com> | 2021-08-06 00:50:08 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2021-08-06 08:48:40 +0300 |
commit | 6fd836f53b0b6914933ce60b6649f5981519fe98 (patch) | |
tree | b70eb16ab218d03d82f9caac87e7a294d6ecc313 /source/blender/bmesh/intern | |
parent | aef45a4ef2593365eeb40f11f4b8ea3d399c9717 (diff) | |
parent | 92edf37997c25444fc2628c8057a87b7e87c5eff (diff) |
Merged Master
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_normals.c | 30 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers_impl.c | 8 |
2 files changed, 13 insertions, 25 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c index 746f094aed6..8eda38046a1 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_normals.c +++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c @@ -50,8 +50,6 @@ static void bm_edge_tag_from_smooth(const float (*fnos)[3], BMEdge *e, const float split_angle_cos); -static void bm_edge_tag_clear(BMEdge *e); - /* -------------------------------------------------------------------- */ /** \name Update Vertex & Face Normals * \{ */ @@ -866,13 +864,6 @@ static void bm_edge_tag_from_smooth(const float (*fnos)[3], BMEdge *e, const flo } } -static void bm_edge_tag_clear(BMEdge *e) -{ - /* No need for atomics here as this is a single byte. */ - char *hflag_p = &e->head.hflag; - *hflag_p = *hflag_p & ~BM_ELEM_TAG; -} - /** * A version of #bm_edge_tag_from_smooth that sets sharp edges * when they would be considered smooth but exceed the split angle . @@ -941,6 +932,7 @@ static void bm_mesh_loops_calc_normals_for_vert_with_clnors(BMesh *bm, const bool has_clnors = true; LinkNode *loops_of_vert = NULL; int loops_of_vert_count = 0; + /* When false the caller must have already tagged the edges. */ const bool do_edge_tag = (split_angle_cos != EDGE_TAG_FROM_SPLIT_ANGLE_BYPASS); /* The loop with the lowest index. */ @@ -954,13 +946,9 @@ static void bm_mesh_loops_calc_normals_for_vert_with_clnors(BMesh *bm, continue; } - /* Always set as #bm_mesh_loops_calc_normals_for_loop checks the tag. */ if (do_edge_tag) { bm_edge_tag_from_smooth(fnos, e_curr_iter, split_angle_cos); } - else { - bm_edge_tag_clear(e_curr_iter); - } do { /* Radial loops. */ if (l_curr->v != v) { @@ -1053,6 +1041,7 @@ static void bm_mesh_loops_calc_normals_for_vert_without_clnors( { const bool has_clnors = false; const short(*clnors_data)[2] = NULL; + /* When false the caller must have already tagged the edges. */ const bool do_edge_tag = (split_angle_cos != EDGE_TAG_FROM_SPLIT_ANGLE_BYPASS); const int cd_loop_clnors_offset = -1; @@ -1066,13 +1055,9 @@ static void bm_mesh_loops_calc_normals_for_vert_without_clnors( continue; } - /* Always set as #bm_mesh_loops_calc_normals_for_loop checks the tag. */ if (do_edge_tag) { bm_edge_tag_from_smooth(fnos, e_curr_iter, split_angle_cos); } - else { - bm_edge_tag_clear(e_curr_iter); - } do { /* Radial loops. */ if (l_curr->v != v) { @@ -1156,10 +1141,6 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm, edge_vectors = BLI_stack_new(sizeof(float[3]), __func__); } - if (split_angle_cos != -1.0f) { - bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, false); - } - /* Clear all loops' tags (means none are to be skipped for now). */ int index_face, index_loop = 0; BM_ITER_MESH_INDEX (f_curr, &fiter, bm, BM_FACES_OF_MESH, index_face) { @@ -1171,10 +1152,17 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm, do { BM_elem_index_set(l_curr, index_loop++); /* set_inline */ BM_elem_flag_disable(l_curr, BM_ELEM_TAG); + /* Needed for when #bm_mesh_edges_sharp_tag doesn't run. + * Mark smooth if there is no smoothing angle. */ + BM_elem_flag_enable(l_curr->e, BM_ELEM_TAG); } while ((l_curr = l_curr->next) != l_first); } bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP); + if (split_angle_cos != -1.0f) { + bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, false); + } + /* We now know edges that can be smoothed (they are tagged), * and edges that will be hard (they aren't). * Now, time to generate the normals. diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index e66afcd88d9..7931e953295 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -203,9 +203,9 @@ static void *bmw_VertShellWalker_step(BMWalker *walker) curedge = shellWalk.curedge; do { if (!BLI_gset_haskey(walker->visit_set, curedge)) { - if (!walker->restrictflag || - (walker->restrictflag && - BMO_edge_flag_test(walker->bm, curedge, walker->restrictflag))) { + if (!walker->visibility_flag || + (walker->visibility_flag && + BMO_edge_flag_test(walker->bm, curedge, walker->visibility_flag))) { BMwShellWalker *newstate; v_old = BM_edge_other_vert(curedge, shellWalk.base); @@ -714,7 +714,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) iwalk->base = owalk.base; #if 0 - if (!BMO_face_flag_test(walker->bm, l->f, walker->restrictflag)) { + if (!BMO_face_flag_test(walker->bm, l->f, walker->visibility_flag)) { iwalk->curloop = l->radial_next; } else { |