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:
authorCampbell Barton <ideasman42@gmail.com>2012-09-25 04:25:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-25 04:25:17 +0400
commit9d0875828ef2c08a49e93d630c82cf4faca571dd (patch)
tree04d254c035489c0043bca4779742d2bba3eb9950 /source/blender/blenkernel
parentb0bf816ececfaf56281e1539577656df3c995aa0 (diff)
small improvement to previous commit, use pre-calculated ngon normal to avoid calculating twice when dupli-scale is enabled.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_mesh.h2
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c6
3 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 0b082c46471..c14085a559a 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -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 */
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 8dbffc5628b..ec15e2ea87f 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -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);
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index f0354b892b7..d407166646b 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -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 */