Pre merge commit, only added debug output so far
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 2 Jan 2008 13:51:44 +0000 (13:51 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 2 Jan 2008 13:51:44 +0000 (13:51 +0000)
source/blender/blenkernel/intern/implicit.c
source/blender/src/drawobject.c

index 9e4428c1055eb633cf7dcbde9c675c6d4304195c..a1d60b34125436e9f35993d7dd050e8fc174224e 100644 (file)
@@ -1687,8 +1687,7 @@ int collisions_collision_response_static ( ClothModifierData *clmd, CollisionMod
        // 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 @@ int collisions_collision_response_static ( ClothModifierData *clmd, CollisionMod
                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 @@ int collisions_collision_response_static ( ClothModifierData *clmd, CollisionMod
                collmd->verts[collpair->point_indexB[2]].impulse_count++;
                */
                
+               
                result = 1;
 
                // printf("magnitude_i: %f\n", magnitude_i); // negative before collision in my case
index a6fced7124a6dddb2da0bd99e67916c1e2773a4a..111f0789ee9a8da7aed84d1c2dd42b1ba1d49aeb 100644 (file)
@@ -2483,7 +2483,7 @@ void draw_fl(ClothModifierData *clmd)
        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 draw_fl(ClothModifierData *clmd)
 */
 }
 
+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)
 {