[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51965] trunk/blender/source/blender/bmesh /intern/bmesh_decimate_collapse.c: decimator - interpolate vertex normals rather then re-calculating them.
Campbell Barton
ideasman42 at gmail.com
Wed Nov 7 08:16:30 CET 2012
Revision: 51965
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51965
Author: campbellbarton
Date: 2012-11-07 07:16:28 +0000 (Wed, 07 Nov 2012)
Log Message:
-----------
decimator - interpolate vertex normals rather then re-calculating them. faster and means degenerate faces wont `explode`.
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c 2012-11-07 06:28:46 UTC (rev 51964)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_decimate_collapse.c 2012-11-07 07:16:28 UTC (rev 51965)
@@ -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 @@
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,8 +828,14 @@
/* 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)) {
BMEdge *e_iter;
More information about the Bf-blender-cvs
mailing list