diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-28 18:23:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-28 18:23:07 +0400 |
commit | ef4db04da848a9790e502300285ccd17d71b4646 (patch) | |
tree | 490b41f9665a7405d348dd0b817d57a3398a706e /source/blender/blenkernel/intern/mesh.c | |
parent | c987aa7df5d4e47b0b141d47d605cc1af18a88c9 (diff) |
code cleanup: lots of calls to BKE_mesh_calc_normals_mapping were not using the mapping functionality.
replace ED_mesh_calc_normals with BKE_mesh_calc_normals().
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6feb39bd836..7db724aa11d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1197,7 +1197,7 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me) BKE_mesh_update_customdata_pointers(me, true); - BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); + BKE_mesh_calc_normals(me); BKE_mesh_calc_edges(me, true, false); } @@ -1591,7 +1591,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use me->mloopuv = CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_ASSIGN, alluv, me->totloop, uvname); } - BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); + BKE_mesh_calc_normals(me); } else { me = BKE_mesh_add(G.main, "Mesh"); @@ -1907,7 +1907,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, if (only_face_normals == FALSE) { /* vertex normals are optional, they require some extra calculations, * so make them optional */ - BKE_mesh_calc_normals(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors); + BKE_mesh_calc_normals_poly(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors); } else { /* only calc poly normals */ @@ -1929,7 +1929,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, } else { /* eek, we're not corresponding to polys */ - printf("error in BKE_mesh_calc_normals; tessellation face indices are incorrect. normals may look bad.\n"); + printf("error in %s: tessellation face indices are incorrect. normals may look bad.\n", __func__); } } } @@ -1993,10 +1993,10 @@ static void mesh_calc_normals_poly_accum(MPoly *mp, MLoop *ml, } -void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, - int UNUSED(numLoops), int numPolys, float (*polyNors_r)[3]) +void BKE_mesh_calc_normals_poly(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, + int UNUSED(numLoops), int numPolys, float (*r_polynors)[3]) { - float (*pnors)[3] = polyNors_r; + float (*pnors)[3] = r_polynors; float (*tnorms)[3]; float tpnor[3]; /* temp poly normal */ int i; @@ -2025,6 +2025,13 @@ void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpo MEM_freeN(tnorms); } +void BKE_mesh_calc_normals(Mesh *mesh) +{ + BKE_mesh_calc_normals_poly(mesh->mvert, mesh->totvert, + mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, + NULL); +} + void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float (*faceNors_r)[3]) { float (*tnorms)[3] = MEM_callocN(numVerts * sizeof(*tnorms), "tnorms"); |