diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-02-22 12:35:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-02-22 17:20:39 +0300 |
commit | 4b068c4d6f960e0a4da7e252c1d69743e282362f (patch) | |
tree | 7a9ebb4511199fa9032d47e3d13b602610b9cb09 /source | |
parent | e83b9cde1a6caeb4468f12d68632df0d0e4e8ae7 (diff) |
Cleanup: clnor code: more 'do not use same varname for two different things'.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_evaluate.c | 3 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 9 |
2 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 8ec93ce6a09..528a1c0f552 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -1318,6 +1318,7 @@ void BKE_mesh_normals_loop_split( /* When using custom loop normals, disable the angle feature! */ const bool check_angle = (split_angle < (float)M_PI) && (clnors_data == NULL); + const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f; MLoopNorSpaceArray _lnors_spacearr = {NULL}; @@ -1325,8 +1326,6 @@ void BKE_mesh_normals_loop_split( TIMEIT_START_AVERAGED(BKE_mesh_normals_loop_split); #endif - const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f; - if (!r_lnors_spacearr && clnors_data) { /* We need to compute lnor spacearr if some custom lnor data are given to us! */ r_lnors_spacearr = &_lnors_spacearr; diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 67db51446df..2eb9c1c6597 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -524,7 +524,7 @@ void BM_verts_calc_normal_vcos(BMesh *bm, const float (*fnos)[3], const float (* * Helpers for #BM_mesh_loop_normals_update and #BM_loops_calc_normals_vnos */ static void bm_mesh_edges_sharp_tag( - BMesh *bm, const float (*vnos)[3], const float (*fnos)[3], float split_angle, + BMesh *bm, const float (*vnos)[3], const float (*fnos)[3], const float split_angle, float (*r_lnos)[3]) { BMIter eiter; @@ -532,10 +532,7 @@ static void bm_mesh_edges_sharp_tag( int i; const bool check_angle = (split_angle < (float)M_PI); - - if (check_angle) { - split_angle = cosf(split_angle); - } + const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f; { char htype = BM_VERT | BM_LOOP; @@ -560,7 +557,7 @@ static void bm_mesh_edges_sharp_tag( if (check_angle) { const float *no_a = fnos ? fnos[BM_elem_index_get(l_a->f)] : l_a->f->no; const float *no_b = fnos ? fnos[BM_elem_index_get(l_b->f)] : l_b->f->no; - is_angle_smooth = (dot_v3v3(no_a, no_b) >= split_angle); + is_angle_smooth = (dot_v3v3(no_a, no_b) >= split_angle_cos); } /* We only tag edges that are *really* smooth: |