Pre merge commit, only added debug output so far

This commit is contained in:
Daniel Genrich 2008-01-02 13:51:44 +00:00
parent 9e96ac11bb
commit 5b9a06e041
2 changed files with 51 additions and 3 deletions

@ -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

@ -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)
{