[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14220] trunk/blender/source/blender/src/ sculptmode.c: Fixed bug #6079, sculpt mode thin mesh problem

Nicholas Bishop nicholasbishop at gmail.com
Sun Mar 23 19:08:26 CET 2008


Revision: 14220
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14220
Author:   nicholasbishop
Date:     2008-03-23 19:08:20 +0100 (Sun, 23 Mar 2008)

Log Message:
-----------
Fixed bug #6079, sculpt mode thin mesh problem

Calculating the area normal now checks each normal against the angle of the camera. If the normal is pointing away from the camera, it is ignored.

Modified Paths:
--------------
    trunk/blender/source/blender/src/sculptmode.c

Modified: trunk/blender/source/blender/src/sculptmode.c
===================================================================
--- trunk/blender/source/blender/src/sculptmode.c	2008-03-23 18:05:43 UTC (rev 14219)
+++ trunk/blender/source/blender/src/sculptmode.c	2008-03-23 18:08:20 UTC (rev 14220)
@@ -418,6 +418,16 @@
 	}		
 }
 
+void add_norm_if(const BrushAction *a, float out[3], const short no[3])
+{
+	float fno[3] = {no[0], no[1], no[2]};
+
+	Normalize(fno);
+
+	if(acos(Inpf(((BrushAction*)a)->symm.out, fno)) < M_PI_2)
+		VecAddf(out, out, fno);
+}
+
 /* Currently only for the draw brush; finds average normal for all active
    vertices */
 void calc_area_normal(float out[3], const BrushAction *a, const float *outdir, const ListBase* active_verts)
@@ -429,18 +439,12 @@
 	out[0] = out[1] = out[2] = 0;
 
 	if(sculptmode_brush()->flag & SCULPT_BRUSH_ANCHORED) {
-		for(; node; node = node->next) {
-			out[0] += a->orig_norms[node->Index][0];
-			out[1] += a->orig_norms[node->Index][1];
-			out[2] += a->orig_norms[node->Index][2];
-		}
+		for(; node; node = node->next)
+			add_norm_if(a, out, a->orig_norms[node->Index]);
 	}
 	else {
-		for(; node; node = node->next) {
-			out[0] += me->mvert[node->Index].no[0];
-			out[1] += me->mvert[node->Index].no[1];
-			out[2] += me->mvert[node->Index].no[2];
-		}
+		for(; node; node = node->next)
+			add_norm_if(a, out, me->mvert[node->Index].no);
 	}
 
 	Normalize(out);





More information about the Bf-blender-cvs mailing list