Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Schempp <fabianschempp@googlemail.com>2021-08-03 22:02:56 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-08-03 22:02:56 +0300
commitb5573bfbf45fb67a5ee4081f3e22f9e73c74e8ae (patch)
tree6dc17161fdf7193118a94f73d645ceea6c89880b /source/blender/bmesh/intern
parentba9561ab0de6c0b387b1082a7657b2d83d4481c1 (diff)
parent41357d556f4e3b286ab4ecfaeb990cc40bf08333 (diff)
Merge branch 'master' into soc-2021-porting-modifiers-to-nodes-extrude
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_normals.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c
index 6dfaa0ca688..746f094aed6 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c
@@ -50,6 +50,8 @@ 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
* \{ */
@@ -754,7 +756,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
/* Fix/update all clnors of this fan with computed average value. */
/* Prints continuously when merge custom normals, so commenting. */
- /* printf("Invalid clnors in this fan!\n"); */
+ // printf("Invalid clnors in this fan!\n");
while ((clnor = BLI_SMALLSTACK_POP(clnors))) {
// print_v2("org clnor", clnor);
@@ -820,9 +822,10 @@ BLI_INLINE bool bm_edge_is_smooth_no_angle_test(const BMEdge *e,
const BMLoop *l_a,
const BMLoop *l_b)
{
+ BLI_assert(l_a->radial_next == l_b);
return (
/* The face is manifold. */
- (l_a->radial_next == l_b) &&
+ (l_b->radial_next == l_a) &&
/* Faces have winding that faces the same way. */
(l_a->v != l_b->v) &&
/* The edge is smooth. */
@@ -863,6 +866,13 @@ 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 .
@@ -944,9 +954,13 @@ 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) {
@@ -1052,9 +1066,13 @@ 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) {
@@ -1816,8 +1834,8 @@ void BM_lnorspace_invalidate(BMesh *bm, const bool do_invalidate_all)
BM_mesh_elem_index_ensure(bm, BM_VERT);
/* When we affect a given vertex, we may affect following smooth fans:
- * - all smooth fans of said vertex;
- * - all smooth fans of all immediate loop-neighbors vertices;
+ * - all smooth fans of said vertex;
+ * - all smooth fans of all immediate loop-neighbors vertices;
* This can be simplified as 'all loops of selected vertices and their immediate neighbors'
* need to be tagged for update.
*/