small improvement to previous commit, use pre-calculated ngon normal to avoid calcula...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 25 Sep 2012 00:25:17 +0000 (00:25 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 25 Sep 2012 00:25:17 +0000 (00:25 +0000)
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/mesh.c

index 0b082c4..c14085a 100644 (file)
@@ -98,7 +98,7 @@ void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart,
                                struct MVert *mvarray, float cent[3]);
 
 float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart,
-                              struct MVert *mvarray, float polynormal[3]);
+                              struct MVert *mvarray, const float polynormal[3]);
 
 /* Find the index of the loop in 'poly' which references vertex,
  * returns -1 if not found */
index 8dbffc5..ec15e2e 100644 (file)
@@ -1171,7 +1171,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
                                                
                                                /* scale */
                                                if (par->transflag & OB_DUPLIFACES_SCALE) {
-                                                       float size = BKE_mesh_calc_poly_area(mp, loopstart, mvert, NULL);
+                                                       float size = BKE_mesh_calc_poly_area(mp, loopstart, mvert, f_no);
                                                        size = sqrtf(size) * par->dupfacesca;
                                                        mul_m3_fl(mat, size);
                                                }
index f0354b8..d407166 100644 (file)
@@ -3016,7 +3016,7 @@ void BKE_mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart,
 
 /* note, passing polynormal is only a speedup so we can skip calculating it */
 float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
-                              MVert *mvarray, float polynormal[3])
+                              MVert *mvarray, const float polynormal[3])
 {
        if (mpoly->totloop == 3) {
                return area_tri_v3(mvarray[loopstart[0].v].co,
@@ -3035,7 +3035,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
                int i;
                MLoop *l_iter = loopstart;
                float area, polynorm_local[3], (*vertexcos)[3];
-               float *no = polynormal ? polynormal : polynorm_local;
+               const float *no = polynormal ? polynormal : polynorm_local;
                BLI_array_fixedstack_declare(vertexcos, BM_NGON_STACK_SIZE, mpoly->totloop, __func__);
 
                /* pack vertex cos into an array for area_poly_v3 */
@@ -3045,7 +3045,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
 
                /* need normal for area_poly_v3 as well */
                if (polynormal == NULL) {
-                       BKE_mesh_calc_poly_normal(mpoly, loopstart, mvarray, no);
+                       BKE_mesh_calc_poly_normal(mpoly, loopstart, mvarray, polynorm_local);
                }
 
                /* finally calculate the area */