From bada34c766029b1054b7255fd471b0f90cdda8ce Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Aug 2019 14:08:01 +1000 Subject: Cleanup: remove BKE_mesh_calc_normals_tessface This was used for versioning, now normals are calculated after initializing MPoly data. --- source/blender/blenkernel/intern/mesh_evaluate.c | 58 ------------------------ 1 file changed, 58 deletions(-) (limited to 'source/blender/blenkernel/intern/mesh_evaluate.c') diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index ad06f4b7da1..7430bc14858 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -448,64 +448,6 @@ void BKE_mesh_calc_normals(Mesh *mesh) mesh->runtime.cd_dirty_vert &= ~CD_MASK_NORMAL; } -void BKE_mesh_calc_normals_tessface( - MVert *mverts, int numVerts, const MFace *mfaces, int numFaces, float (*r_faceNors)[3]) -{ - float(*tnorms)[3] = MEM_calloc_arrayN((size_t)numVerts, sizeof(*tnorms), "tnorms"); - float(*fnors)[3] = (r_faceNors) ? - r_faceNors : - MEM_calloc_arrayN((size_t)numFaces, sizeof(*fnors), "meshnormals"); - int i; - - if (!tnorms || !fnors) { - goto cleanup; - } - - for (i = 0; i < numFaces; i++) { - const MFace *mf = &mfaces[i]; - float *f_no = fnors[i]; - float *n4 = (mf->v4) ? tnorms[mf->v4] : NULL; - const float *c4 = (mf->v4) ? mverts[mf->v4].co : NULL; - - if (mf->v4) { - normal_quad_v3( - f_no, mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, mverts[mf->v4].co); - } - else { - normal_tri_v3(f_no, mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co); - } - - accumulate_vertex_normals_v3(tnorms[mf->v1], - tnorms[mf->v2], - tnorms[mf->v3], - n4, - f_no, - mverts[mf->v1].co, - mverts[mf->v2].co, - mverts[mf->v3].co, - c4); - } - - /* following Mesh convention; we use vertex coordinate itself for normal in this case */ - 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); - - if (fnors != r_faceNors) { - MEM_freeN(fnors); - } -} - void BKE_mesh_calc_normals_looptri(MVert *mverts, int numVerts, const MLoop *mloop, -- cgit v1.2.3