[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13095] branches/cloth/blender/source/ blender: Pre merge commit, only added debug output so far

Daniel Genrich daniel.genrich at gmx.net
Wed Jan 2 14:51:49 CET 2008


Revision: 13095
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13095
Author:   genscher
Date:     2008-01-02 14:51:44 +0100 (Wed, 02 Jan 2008)

Log Message:
-----------
Pre merge commit, only added debug output so far

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

Modified: branches/cloth/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2008-01-02 12:35:30 UTC (rev 13094)
+++ branches/cloth/blender/source/blender/blenkernel/intern/implicit.c	2008-01-02 13:51:44 UTC (rev 13095)
@@ -1687,8 +1687,7 @@
 	// If v_n_mag < 0 the edges are approaching each other.
 	if ( magrelVel < -ALMOST_ZERO )
 	{
-		printf("magrelVel < -ALMOST_ZERO\n");
-				
+		
 		// Calculate Impulse magnitude to stop all motion in normal direction.
 		// const double I_mag = v_n_mag / (1/m1 + 1/m2);
 		float magnitude_i = magrelVel / 2.0f; // TODO implement masses
@@ -1697,6 +1696,8 @@
 		float vrel_t[3];
 		double impulse;
 		float overlap = ( epsilon + ALMOST_ZERO-collpair->distance );
+		
+		printf("magrelVel < -ALMOST_ZERO\n");
 
 		// calculateFrictionImpulse(tangential, relativeVelocity, collpair->normal, magrelVel, clmd->coll_parms.friction*0.01, magrelVel);
 
@@ -1737,6 +1738,7 @@
 		collmd->verts[collpair->point_indexB[2]].impulse_count++;
 		*/
 		
+		
 		result = 1;
 
 		// printf("magnitude_i: %f\n", magnitude_i); // negative before collision in my case

Modified: branches/cloth/blender/source/blender/src/drawobject.c
===================================================================
--- branches/cloth/blender/source/blender/src/drawobject.c	2008-01-02 12:35:30 UTC (rev 13094)
+++ branches/cloth/blender/source/blender/src/drawobject.c	2008-01-02 13:51:44 UTC (rev 13095)
@@ -2483,7 +2483,7 @@
 	m_fc->_light_dir[0] = -1.0f;
 	m_fc->_light_dir[1] = 0.5f;
 	m_fc->_light_dir[2] = 0.0f;
-		
+	
 	gen_ray_templ(m_fc->_ray_templ, m_fc->_light_dir, 30 + 2);
 	
 	cast_light(m_fc->_texture_data, m_fc->_ray_templ, m_fc->_light_dir, 30+2);
@@ -2514,6 +2514,52 @@
 */
 }
 
+void fc_load_frame(ClothModifierData *clmd)
+{
+	float* tmp = (float*) MEM_callocN(30*30*30*sizeof(float), "fc_tmp");
+	float tmin=9999999, tmax=-99999999;
+	Cloth *cloth = clmd->clothObject;
+	fc *m_fc = NULL;
+	int i = 0;
+	
+	if(!cloth)
+		return;
+	
+	m_fc = cloth->m_fc;
+
+	if (++m_fc->_cur_frame == m_fc->_nframes) {
+		fseek(m_fc->_fp, 12, SEEK_SET);
+		m_fc->_cur_frame = 0;
+	}
+
+	fread(tmp, sizeof(float), 30*30*30, m_fc->_fp);
+
+	for (i=0; i<30*30*30; i++)
+	{
+		m_fc->_texture_data[(i<<2)+1] = (unsigned char) (tmp[i]*255.0f);
+	}
+
+	fread(tmp, sizeof(float), 30*30*30, m_fc->_fp);
+
+	for (i=0; i<30*30*30; i++)
+	{
+		m_fc->_texture_data[(i<<2)] = (unsigned char) (tmp[i]*255.0f);
+		if (tmp[i]<tmin)
+			tmin = tmp[i];
+		if (tmp[i]>tmax)
+			tmax = tmp[i];
+		m_fc->_texture_data[(i<<2)+2] = 0;
+		m_fc->_texture_data[(i<<2)+3] = 255;
+	}
+
+	MEM_freeN(tmp);
+
+	// cast_light(_N); DG NOT NEEDED
+
+	glActiveTextureARB(GL_TEXTURE0_ARB);
+	glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 30, 30, 30, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_fc->_texture_data);
+}
+
 static void draw_mesh_object_outline(Object *ob, DerivedMesh *dm)
 {
 	





More information about the Bf-blender-cvs mailing list