[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12166] branches/cloth/blender/source/ blender/blenkernel/intern/implicit.c: Some additional wind problems ( hopefully) fixed, added force fields, reported by Rui Paulo Sanguinheira Diogo

Daniel Genrich daniel.genrich at gmx.net
Fri Sep 28 13:06:13 CEST 2007


Revision: 12166
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12166
Author:   genscher
Date:     2007-09-28 13:06:13 +0200 (Fri, 28 Sep 2007)

Log Message:
-----------
Some additional wind problems (hopefully) fixed, added force fields, reported by Rui Paulo Sanguinheira Diogo

Modified Paths:
--------------
    branches/cloth/blender/source/blender/blenkernel/intern/implicit.c

Modified: branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-09-28 08:06:38 UTC (rev 12165)
+++ branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2007-09-28 11:06:13 UTC (rev 12166)
@@ -1261,7 +1261,7 @@
 		}
 	}
 }
-float calculateVertexWindForce(int index, float wind[3], float vertexnormal[3])  
+float calculateVertexWindForce(float wind[3], float vertexnormal[3])  
 {
 	return fabs(INPR(wind, vertexnormal) * 0.5f);
 }
@@ -1328,21 +1328,25 @@
 	/* handle external forces like wind */
 	if(effectors)
 	{
-		float wind[3] = {0.0f,1.0f,0.0f};
+		float speed[3] = {0.0f, 0.0f,0.0f};
 		float force[3]= {0.0f, 0.0f, 0.0f};
 		
 		#pragma omp parallel for private (i) shared(lF)
 		for(i = 0; i < cloth->numverts; i++)
 		{
 			float vertexnormal[3]={0,0,0};
+			float fieldfactor = 1000.0f, windfactor  = 250.0f; // from sb
+			
+			pdDoEffectors(effectors, lX[i], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);		
+			
+			// TODO apply forcefields here
+			VECADDS(lF[i], lF[i], force, fieldfactor*0.01f);
 
-			pdDoEffectors(effectors, lX[i], force, wind, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);		
-
-			VECCOPY(wind_normalized, wind);
+			VECCOPY(wind_normalized, speed);
 			Normalize(wind_normalized);
-
+			
 			calculateWeightedVertexNormal(clmd, mfaces, vertexnormal, i, lX);
-			VECADDS(lF[i], lF[i], wind_normalized, calculateVertexWindForce(i, wind, vertexnormal));
+			VECADDS(lF[i], lF[i], wind_normalized, -calculateVertexWindForce(speed, vertexnormal));
 		}
 	}
 	





More information about the Bf-blender-cvs mailing list