Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 7db724aa11d..babaadf2d17 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1998,16 +1998,24 @@ void BKE_mesh_calc_normals_poly(MVert *mverts, int numVerts, MLoop *mloop, MPoly
{
float (*pnors)[3] = r_polynors;
float (*tnorms)[3];
- float tpnor[3]; /* temp poly normal */
int i;
MPoly *mp;
/* first go through and calculate normals for all the polys */
tnorms = MEM_callocN(sizeof(*tnorms) * numVerts, __func__);
- mp = mpolys;
- for (i = 0; i < numPolys; i++, mp++) {
- mesh_calc_normals_poly_accum(mp, mloop + mp->loopstart, mverts, pnors ? pnors[i] : tpnor, tnorms);
+ if (pnors) {
+ mp = mpolys;
+ for (i = 0; i < numPolys; i++, mp++) {
+ mesh_calc_normals_poly_accum(mp, mloop + mp->loopstart, mverts, pnors[i], tnorms);
+ }
+ }
+ else {
+ float tpnor[3]; /* temp poly normal */
+ mp = mpolys;
+ for (i = 0; i < numPolys; i++, mp++) {
+ mesh_calc_normals_poly_accum(mp, mloop + mp->loopstart, mverts, tpnor, tnorms);
+ }
}
/* following Mesh convention; we use vertex coordinate itself for normal in this case */