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-11-07 11:16:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-07 11:16:28 +0400
commitefc44d0c4de449e2f2a87871319d3842577e1928 (patch)
treea6d421d4b0137c818c78718ccdf989402b5685e9 /source/blender
parentbe367890f7698cd39ed61ffa90f322f078f5c323 (diff)
decimator - interpolate vertex normals rather then re-calculating them. faster and means degenerate faces wont `explode`.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/bmesh/intern/bmesh_decimate_collapse.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_decimate_collapse.c b/source/blender/bmesh/intern/bmesh_decimate_collapse.c
index c5cccc45818..e4d92dffa55 100644
--- a/source/blender/bmesh/intern/bmesh_decimate_collapse.c
+++ b/source/blender/bmesh/intern/bmesh_decimate_collapse.c
@@ -45,6 +45,7 @@
/* defines for testing */
#define USE_CUSTOMDATA
#define USE_TRIANGULATE
+#define USE_VERT_NORMAL_INTERP /* has the advantage that flipped faces don't mess up vertex normals */
/* these checks are for rare cases that we can't avoid since they are valid meshes still */
#define USE_SAFETY_CHECKS
@@ -774,6 +775,11 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
float optimize_co[3];
float customdata_fac;
+#ifdef USE_VERT_NORMAL_INTERP
+ float v_clear_no[3];
+ copy_v3_v3(v_clear_no, e->v2->no);
+#endif
+
bm_decim_calc_target_co(e, optimize_co, vquadrics);
/* use for customdata merging */
@@ -822,7 +828,13 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
/* in fact face normals are not used for progressive updates, no need to update them */
// BM_vert_normal_update_all(v);
+#ifdef USE_VERT_NORMAL_INTERP
+ interp_v3_v3v3(v_other->no, v_other->no, v_clear_no, customdata_fac);
+ normalize_v3(v_other->no);
+#else
BM_vert_normal_update(v_other);
+#endif
+
/* update error costs and the eheap */
if (LIKELY(v_other->e)) {