diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-12 13:35:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-12 13:35:02 +0400 |
commit | 31e667c10eec08aadf1a8fc156ffefcaf63a24ec (patch) | |
tree | 5bd6837a8239aa0d83e18f43d3c728d7cb28daa0 /source/blender/blenkernel | |
parent | 8e2e590484dbdb2da433649fac8521b91f384ca2 (diff) |
solidify: dont add poly-normal layer to the derived mesh, since this is no longer a convention.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 17 |
3 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 7bb188d5ff6..3054849999c 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -221,7 +221,8 @@ void BKE_mesh_calc_normals_mapping_ex( void BKE_mesh_calc_normals_poly( struct MVert *mverts, int numVerts, struct MLoop *mloop, struct MPoly *mpolys, - int numLoops, int numPolys, float (*polyNors_r)[3]); + int numLoops, int numPolys, float (*polyNors_r)[3], + const bool only_face_normals); void BKE_mesh_calc_normals(struct Mesh *me); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index af0dadeccab..64d6ca6666e 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2291,7 +2291,7 @@ void CDDM_calc_normals(DerivedMesh *dm) } BKE_mesh_calc_normals_poly(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm), - dm->numLoopData, dm->numPolyData, poly_nors); + dm->numLoopData, dm->numPolyData, poly_nors, false); cddm->dm.dirty &= ~DM_DIRTY_NORMALS; } @@ -2306,7 +2306,7 @@ void CDDM_calc_normals(DerivedMesh *dm) cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData); BKE_mesh_calc_normals_poly(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm), - dm->numLoopData, dm->numPolyData, NULL); + dm->numLoopData, dm->numPolyData, NULL, false); cddm->dm.dirty &= ~DM_DIRTY_NORMALS; } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 2eb318c316f..d02884f1a7b 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -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_poly(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors); + BKE_mesh_calc_normals_poly(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors, false); } else { /* only calc poly normals */ @@ -1994,13 +1994,24 @@ static void mesh_calc_normals_poly_accum(MPoly *mp, MLoop *ml, } void BKE_mesh_calc_normals_poly(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, - int UNUSED(numLoops), int numPolys, float (*r_polynors)[3]) + int UNUSED(numLoops), int numPolys, float (*r_polynors)[3], + const bool only_face_normals) { float (*pnors)[3] = r_polynors; float (*tnorms)[3]; int i; MPoly *mp; + if (only_face_normals) { + BLI_assert(pnors != NULL); + +#pragma omp parallel for if (numPolys > BM_OMP_LIMIT) + for (i = 0; i < numPolys; i++) { + BKE_mesh_calc_poly_normal(&mpolys[i], mloop + mpolys[i].loopstart, mverts, pnors[i]); + } + return; + } + /* first go through and calculate normals for all the polys */ tnorms = MEM_callocN(sizeof(*tnorms) * numVerts, __func__); @@ -2037,7 +2048,7 @@ 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); + NULL, false); } void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float (*faceNors_r)[3]) |