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>2013-06-24 22:13:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-24 22:13:33 +0400
commitafb200f217ddbd0661ffe594ad41f5df6ff644f4 (patch)
tree8883ac97b321195ee479cbf35db6e6930a5c189d /source/blender/blenkernel
parent294b49e312b4c8bd2e4dc2b1711840a11d30abba (diff)
calculate polygon normals for BKE_mesh_recalc_tessellation() inline rather then using scanfills function.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/mesh.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index aeb1538ccf0..2b59aa4a8bb 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -2733,8 +2733,14 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
}
#endif /* USE_TESSFACE_SPEEDUP */
else {
+#define USE_TESSFACE_CALCNORMAL
+
int totfilltri;
+#ifdef USE_TESSFACE_CALCNORMAL
+ float normal[3];
+ zero_v3(normal);
+#endif
ml = mloop + mp->loopstart;
BLI_scanfill_begin(&sf_ctx);
@@ -2745,16 +2751,25 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
sf_vert->keyindex = mp->loopstart + j;
- if (sf_vert_last)
+ if (sf_vert_last) {
BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
+#ifdef USE_TESSFACE_CALCNORMAL
+ add_newell_cross_v3_v3v3(normal, sf_vert_last->co, sf_vert->co);
+#endif
+ }
if (!sf_vert_first)
sf_vert_first = sf_vert;
sf_vert_last = sf_vert;
}
BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert_first);
-
+#ifdef USE_TESSFACE_CALCNORMAL
+ add_newell_cross_v3_v3v3(normal, sf_vert_last->co, sf_vert_first->co);
+ normalize_v3(normal);
+ totfilltri = BLI_scanfill_calc_ex(&sf_ctx, 0, normal);
+#else
totfilltri = BLI_scanfill_calc(&sf_ctx, 0);
+#endif
BLI_assert(totfilltri <= mp->totloop - 2);
(void)totfilltri;
@@ -2779,6 +2794,8 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
}
BLI_scanfill_end(&sf_ctx);
+
+#undef USE_TESSFACE_CALCNORMAL
}
}