Added example of tetrahedral (volumetric) softbodies

Keep camera distance positive when using mouse zoom
Updated autogenerated msvc projectfiles
Added glut 64 bit support
This commit is contained in:
erwin.coumans
2009-08-27 18:39:17 +00:00
parent f82cfc8259
commit f492899499
27 changed files with 429 additions and 3937 deletions

View File

@@ -115,11 +115,14 @@ btDemoEntry g_demoEntries[] =
{"Dynamic Control Demo",MotorDemo::Create},
{"ConcaveDemo",ConcaveDemo::Create},
{"Concave Convexcast Demo",ConcaveConvexcastDemo::Create},
{"SoftBody Cloth",SoftDemo0::Create},
{"SoftBody Ropes Attach",SoftDemo4::Create},
{"SoftBody Cloth Attach",SoftDemo5::Create},
{"SoftBody Cluster Collide1",SoftDemo19::Create},
{"SoftBody Ropes Attach",SoftDemo4::Create},
{"SoftBody Cloth Attach",SoftDemo5::Create},
{"SoftBody Cloth",SoftDemo0::Create},
// {"SoftBody Volume",SoftDemo2::Create},
{"SoftBody Pressure",SoftDemo1::Create},
{"SoftBody Cluster Car",SoftDemo24::Create},
@@ -145,6 +148,10 @@ btDemoEntry g_demoEntries[] =
{"SoftBody Cluster Combine",SoftDemo23::Create},
// {"SoftBody Cluster Stack Soft",SoftDemo26::Create},
{"SoftBody Cluster Stack Mixed",SoftDemo27::Create},
{"SoftBody TetGen Tetrahedral Cube",SoftDemo28::Create},
{"SoftBody TetGen Tetrahedral Bunny",SoftDemo29::Create},
// {"SliderConstraint",SliderConstraintDemo::Create},

View File

@@ -884,6 +884,10 @@ void DemoApplication::mouseMotionFunc(int x,int y)
else if(m_mouseButtons & 4)
{
m_cameraDistance -= dy * 0.2f;
if (m_cameraDistance<0.1)
m_cameraDistance = 0.1;
}
}

View File

@@ -771,9 +771,10 @@ static void Init_Cloth(SoftDemo* pdemo)
btVector3(-s,0,+s),
btVector3(+s,0,+s),
31,31,
// 31,31,
1+2+4+8,true);
psb->getCollisionShape()->setMargin(0.5);
btSoftBody::Material* pm=psb->appendMaterial();
pm->m_kLST = 0.4;
pm->m_flags -= btSoftBody::fMaterial::DebugDraw;
@@ -1259,7 +1260,51 @@ static void Init_ClusterStackMixed(SoftDemo* pdemo)
}
}
unsigned current_demo=19;
//
// TetraBunny
//
static void Init_TetraBunny(SoftDemo* pdemo)
{
btSoftBody* psb=btSoftBodyHelpers::CreateFromTetGenData(pdemo->m_softBodyWorldInfo,
TetraBunny::getElements(),
0,
TetraBunny::getNodes(),
false,true,true);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
psb->rotate(btQuaternion(SIMD_PI/2,0,0));
psb->setVolumeMass(150);
psb->m_cfg.piterations=2;
pdemo->m_cutting=true;
}
//
// TetraCube
//
static void Init_TetraCube(SoftDemo* pdemo)
{
btSoftBody* psb=btSoftBodyHelpers::CreateFromTetGenData(pdemo->m_softBodyWorldInfo,
TetraCube::getElements(),
0,
TetraCube::getNodes(),
false,true,true);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
psb->scale(btVector3(4,4,4));
psb->translate(btVector3(0,5,0));
psb->setVolumeMass(300);
///fix one vertex
psb->setMass(0,0);
//psb->setMass(10,0);
//psb->setMass(20,0);
psb->m_cfg.piterations=1;
//psb->m_materials[0]->m_kLST=0.05;
pdemo->m_cutting=true;
}
unsigned current_demo=21;
void SoftDemo::clientResetScene()
{
@@ -1326,6 +1371,8 @@ void SoftDemo::clientResetScene()
Init_ClusterRobot,
Init_ClusterStackSoft,
Init_ClusterStackMixed,
Init_TetraCube,
Init_TetraBunny,
};
current_demo=current_demo%(sizeof(demofncs)/sizeof(demofncs[0]));
@@ -1813,4 +1860,3 @@ void SoftDemo::exitPhysics()

View File

@@ -178,7 +178,8 @@ MACRO_SOFT_DEMO(24)//Init_ClusterCar
MACRO_SOFT_DEMO(25)//Init_ClusterRobot
MACRO_SOFT_DEMO(26)//Init_ClusterStackSoft
MACRO_SOFT_DEMO(27)//Init_ClusterStackMixed
MACRO_SOFT_DEMO(28)//Init_TetraCube
MACRO_SOFT_DEMO(29)//Init_TetraBunny
#endif //CCD_PHYSICS_DEMO_H

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long