diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index edd7601ac1d..1eadc3a39b0 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -472,12 +472,6 @@ void BKE_mesh_calc_normals(struct Mesh *me); * Called after calculating all modifiers. */ void BKE_mesh_ensure_normals_for_display(struct Mesh *mesh); -void BKE_mesh_calc_normals_looptri(const struct MVert *mverts, - int numVerts, - const struct MLoop *mloop, - const struct MLoopTri *looptri, - int looptri_num, - float (*r_tri_nors)[3]); /** * Define sharp edges as needed to mimic 'autosmooth' from angle threshold. diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc index 49729ede956..6750d3c34fd 100644 --- a/source/blender/blenkernel/intern/mesh_normals.cc +++ b/source/blender/blenkernel/intern/mesh_normals.cc @@ -444,60 +444,6 @@ void BKE_mesh_calc_normals(Mesh *mesh) BKE_mesh_vertex_normals_ensure(mesh); } -void BKE_mesh_calc_normals_looptri(const MVert *mverts, - int numVerts, - const MLoop *mloop, - const MLoopTri *looptri, - int looptri_num, - float (*r_tri_nors)[3]) -{ - float(*tnorms)[3] = (float(*)[3])MEM_calloc_arrayN(size_t(numVerts), sizeof(*tnorms), "tnorms"); - float(*fnors)[3] = (r_tri_nors) ? r_tri_nors : - (float(*)[3])MEM_calloc_arrayN( - size_t(looptri_num), sizeof(*fnors), "meshnormals"); - - if (!tnorms || !fnors) { - goto cleanup; - } - - for (int i = 0; i < looptri_num; i++) { - const MLoopTri *lt = &looptri[i]; - float *f_no = fnors[i]; - const uint vtri[3] = { - mloop[lt->tri[0]].v, - mloop[lt->tri[1]].v, - mloop[lt->tri[2]].v, - }; - - normal_tri_v3(f_no, mverts[vtri[0]].co, mverts[vtri[1]].co, mverts[vtri[2]].co); - - accumulate_vertex_normals_tri_v3(tnorms[vtri[0]], - tnorms[vtri[1]], - tnorms[vtri[2]], - f_no, - mverts[vtri[0]].co, - mverts[vtri[1]].co, - mverts[vtri[2]].co); - } - - /* Following Mesh convention; we use vertex coordinate itself for normal in this case. */ - for (int i = 0; i < numVerts; i++) { - const MVert *mv = &mverts[i]; - float *no = tnorms[i]; - - if (UNLIKELY(normalize_v3(no) == 0.0f)) { - normalize_v3_v3(no, mv->co); - } - } - -cleanup: - MEM_freeN(tnorms); - - if (fnors != r_tri_nors) { - MEM_freeN(fnors); - } -} - void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, const int numLoops, const char data_type) diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 24ea2de98f6..942d124ded4 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -3140,9 +3140,6 @@ void BKE_pbvh_vert_coords_apply(PBVH *pbvh, const float (*vertCos)[3], const int } } - /* coordinates are new -- normals should also be updated */ - BKE_mesh_calc_normals_looptri( - pbvh->verts, pbvh->totvert, pbvh->mloop, pbvh->looptri, pbvh->totprim, NULL); for (int a = 0; a < pbvh->totnode; a++) { BKE_pbvh_node_mark_update(&pbvh->nodes[a]);