[Bf-blender-cvs] [35f225b44c5] master: Cleanup: split normals: use different varnames for angle and its cosine.

Bastien Montagne noreply at git.blender.org
Tue Feb 20 15:07:28 CET 2018


Commit: 35f225b44c5dc7229a87aab6b5d36652e2e50be9
Author: Bastien Montagne
Date:   Tue Feb 20 13:03:10 2018 +0100
Branches: master
https://developer.blender.org/rB35f225b44c5dc7229a87aab6b5d36652e2e50be9

Cleanup: split normals: use different varnames for angle and its cosine.

Using same name for two different things is not the best idea ever...

===================================================================

M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/blenkernel/intern/mesh_evaluate.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index f3b2b653e3d..2fd000ebaae 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -236,7 +236,7 @@ void BKE_mesh_normals_loop_split(
         const struct MVert *mverts, const int numVerts, struct MEdge *medges, const int numEdges,
         struct MLoop *mloops, float (*r_loopnors)[3], const int numLoops,
         struct MPoly *mpolys, const float (*polynors)[3], const int numPolys,
-        const bool use_split_normals, float split_angle,
+        const bool use_split_normals, const float split_angle,
         MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], int *r_loop_to_poly);
 
 void BKE_mesh_normals_loop_custom_set(
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 91331043be4..8ec93ce6a09 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1264,7 +1264,7 @@ void BKE_mesh_normals_loop_split(
         const MVert *mverts, const int UNUSED(numVerts), MEdge *medges, const int numEdges,
         MLoop *mloops, float (*r_loopnors)[3], const int numLoops,
         MPoly *mpolys, const float (*polynors)[3], const int numPolys,
-        const bool use_split_normals, float split_angle,
+        const bool use_split_normals, const float split_angle,
         MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], int *r_loop_to_poly)
 {
 	/* For now this is not supported. If we do not use split normals, we do not generate anything fancy! */
@@ -1325,9 +1325,7 @@ void BKE_mesh_normals_loop_split(
 	TIMEIT_START_AVERAGED(BKE_mesh_normals_loop_split);
 #endif
 
-	if (check_angle) {
-		split_angle = cosf(split_angle);
-	}
+	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! */
@@ -1371,7 +1369,7 @@ void BKE_mesh_normals_loop_split(
 				 */
 				if (!(mp->flag & ME_SMOOTH) || (medges[ml_curr->e].flag & ME_SHARP) ||
 				    ml_curr->v == mloops[e2l[0]].v ||
-				    (check_angle && dot_v3v3(polynors[loop_to_poly[e2l[0]]], polynors[mp_index]) < split_angle))
+				    (check_angle && dot_v3v3(polynors[loop_to_poly[e2l[0]]], polynors[mp_index]) < split_angle_cos))
 				{
 					/* Note: we are sure that loop != 0 here ;) */
 					e2l[1] = INDEX_INVALID;



More information about the Bf-blender-cvs mailing list