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:
authorCampbell Barton <ideasman42@gmail.com>2021-11-10 13:22:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-11-10 13:22:01 +0300
commitff0c42acfc78cffba8c18dfe1f82dc00e8f6ba0e (patch)
tree92293e06468c65a3cb91e60ec13d6f6f05b56b14
parenta49d6a53503e2d8ef9cb95d83bdfcc723f959836 (diff)
parentbec72a43aef0d0f4553f193be6d67df001dfe3b7 (diff)
Merge branch 'blender-v3.0-release'
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_normals.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c
index 186c85abe58..16ce9703568 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c
@@ -404,16 +404,13 @@ void BM_normals_loops_edges_tag(BMesh *bm, const bool do_edges)
*/
static void bm_mesh_edges_sharp_tag(BMesh *bm,
const float (*fnos)[3],
- const float split_angle,
+ float split_angle_cos,
const bool do_sharp_edges_tag)
{
BMIter eiter;
BMEdge *e;
int i;
- const bool check_angle = (split_angle < (float)M_PI);
- const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f;
-
if (fnos) {
BM_mesh_elem_index_ensure(bm, BM_FACE);
}
@@ -451,7 +448,7 @@ void BM_edges_sharp_from_angle_set(BMesh *bm, const float split_angle)
return;
}
- bm_mesh_edges_sharp_tag(bm, NULL, split_angle, true);
+ bm_mesh_edges_sharp_tag(bm, NULL, cosf(split_angle), true);
}
/** \} */
@@ -1110,11 +1107,13 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
const short (*clnors_data)[2],
const int cd_loop_clnors_offset,
const bool do_rebuild,
- const float split_angle)
+ const float split_angle_cos)
{
BMIter fiter;
BMFace *f_curr;
const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
+ /* When false the caller must have already tagged the edges. */
+ const bool do_edge_tag = (split_angle_cos != EDGE_TAG_FROM_SPLIT_ANGLE_BYPASS);
MLoopNorSpaceArray _lnors_spacearr = {NULL};
@@ -1155,7 +1154,9 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
/* Always tag edges based on winding & sharp edge flag
* (even when the auto-smooth angle doesn't need to be calculated). */
- bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, false);
+ if (do_edge_tag) {
+ bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? -1.0f : split_angle_cos, false);
+ }
/* We now know edges that can be smoothed (they are tagged),
* and edges that will be hard (they aren't).
@@ -1308,12 +1309,9 @@ static void bm_mesh_loops_calc_normals__multi_threaded(BMesh *bm,
const short (*clnors_data)[2],
const int cd_loop_clnors_offset,
const bool do_rebuild,
- const float split_angle)
+ const float split_angle_cos)
{
const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
- const bool check_angle = (split_angle < (float)M_PI);
- const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f;
-
MLoopNorSpaceArray _lnors_spacearr = {NULL};
{
@@ -1387,7 +1385,7 @@ static void bm_mesh_loops_calc_normals(BMesh *bm,
const short (*clnors_data)[2],
const int cd_loop_clnors_offset,
const bool do_rebuild,
- const float split_angle)
+ const float split_angle_cos)
{
if (bm->totloop < BM_OMP_LIMIT) {
bm_mesh_loops_calc_normals__single_threaded(bm,
@@ -1398,7 +1396,7 @@ static void bm_mesh_loops_calc_normals(BMesh *bm,
clnors_data,
cd_loop_clnors_offset,
do_rebuild,
- split_angle);
+ split_angle_cos);
}
else {
bm_mesh_loops_calc_normals__multi_threaded(bm,
@@ -1409,7 +1407,7 @@ static void bm_mesh_loops_calc_normals(BMesh *bm,
clnors_data,
cd_loop_clnors_offset,
do_rebuild,
- split_angle);
+ split_angle_cos);
}
}
@@ -1620,7 +1618,7 @@ static void bm_mesh_loops_custom_normals_set(BMesh *bm,
/* Tag smooth edges and set lnos from vnos when they might be completely smooth...
* When using custom loop normals, disable the angle feature! */
- bm_mesh_edges_sharp_tag(bm, fnos, (float)M_PI, false);
+ bm_mesh_edges_sharp_tag(bm, fnos, -1.0f, false);
/* Finish computing lnos by accumulating face normals
* in each fan of faces defined by sharp edges. */
@@ -1751,7 +1749,7 @@ void BM_loops_calc_normal_vcos(BMesh *bm,
clnors_data,
cd_loop_clnors_offset,
do_rebuild,
- has_clnors ? (float)M_PI : split_angle);
+ has_clnors ? -1.0f : cosf(split_angle));
}
else {
BLI_assert(!r_lnors_spacearr);