diff options
author | Rohan Rathi <rohanrathi08@gmail.com> | 2018-06-20 19:59:44 +0300 |
---|---|---|
committer | Rohan Rathi <rohanrathi08@gmail.com> | 2018-06-20 19:59:44 +0300 |
commit | c73a6b0d42f5ee16bb2af7d585035463854f4024 (patch) | |
tree | c366aeac74491653e0ba516b745116bfa6475f94 /source/blender/blenkernel/intern/mesh_evaluate.c | |
parent | dd752476b97aa3b35d1359422ca42e33d99ac851 (diff) | |
parent | 82dc5f91e86351e1a26769ec86d9054437eb77d6 (diff) |
Merge branch 'blender2.8' into soc-2018-bevel
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_evaluate.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_evaluate.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 4e1297043d0..3062cd13f5f 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -179,7 +179,7 @@ void BKE_mesh_calc_normals_mapping_ex( /* if (fnors != r_faceNors) MEM_freeN(fnors); */ /* NO NEED TO ALLOC YET */ fnors = pnors = NULL; - + } typedef struct MeshCalcNormalsData { @@ -192,7 +192,7 @@ typedef struct MeshCalcNormalsData { } MeshCalcNormalsData; static void mesh_calc_normals_poly_cb( - void *__restrict userdata, + void *__restrict userdata, const int pidx, const ParallelRangeTLS *__restrict UNUSED(tls)) { @@ -203,7 +203,7 @@ static void mesh_calc_normals_poly_cb( } static void mesh_calc_normals_poly_prepare_cb( - void *__restrict userdata, + void *__restrict userdata, const int pidx, const ParallelRangeTLS *__restrict UNUSED(tls)) { @@ -402,14 +402,14 @@ void BKE_mesh_calc_normals_tessface( for (i = 0; i < numVerts; i++) { MVert *mv = &mverts[i]; float *no = tnorms[i]; - + if (UNLIKELY(normalize_v3(no) == 0.0f)) { normalize_v3_v3(no, mv->co); } normal_float_to_short_v3(mv->no, no); } - + cleanup: MEM_freeN(tnorms); @@ -2325,19 +2325,19 @@ static bool mesh_calc_center_centroid_ex( const MLoopTri *lt; float totweight; int i; - + zero_v3(r_center); - + if (looptri_num == 0) return false; - + totweight = 0.0f; for (i = 0, lt = looptri; i < looptri_num; i++, lt++) { const MVert *v1 = &mverts[mloop[lt->tri[0]].v]; const MVert *v2 = &mverts[mloop[lt->tri[1]].v]; const MVert *v3 = &mverts[mloop[lt->tri[2]].v]; float area; - + area = area_tri_v3(v1->co, v2->co, v3->co); madd_v3_v3fl(r_center, v1->co, area); madd_v3_v3fl(r_center, v2->co, area); @@ -2346,9 +2346,9 @@ static bool mesh_calc_center_centroid_ex( } if (totweight == 0.0f) return false; - + mul_v3_fl(r_center, 1.0f / (3.0f * totweight)); - + return true; } @@ -2368,18 +2368,18 @@ void BKE_mesh_calc_volume( float center[3]; float totvol; int i; - + if (r_volume) *r_volume = 0.0f; if (r_center) zero_v3(r_center); - + if (looptri_num == 0) return; - + if (!mesh_calc_center_centroid_ex(mverts, mverts_num, looptri, looptri_num, mloop, center)) return; - + totvol = 0.0f; for (i = 0, lt = looptri; i < looptri_num; i++, lt++) { @@ -2387,7 +2387,7 @@ void BKE_mesh_calc_volume( const MVert *v2 = &mverts[mloop[lt->tri[1]].v]; const MVert *v3 = &mverts[mloop[lt->tri[2]].v]; float vol; - + vol = volume_tetrahedron_signed_v3(center, v1->co, v2->co, v3->co); if (r_volume) { totvol += vol; @@ -2399,7 +2399,7 @@ void BKE_mesh_calc_volume( madd_v3_v3fl(r_center, v3->co, vol); } } - + /* Note: Depending on arbitrary centroid position, * totvol can become negative even for a valid mesh. * The true value is always the positive value. |