minor tweaks to demos: enable constraint debug drawing in AllBulletDemos, default constraint debugging size set to 0.3,
set svn:eol-style native for folder files http://code.google.com/p/bullet/issues/detail?id=191
This commit is contained in:
@@ -103,13 +103,13 @@ public:
|
|||||||
btDemoEntry g_demoEntries[] =
|
btDemoEntry g_demoEntries[] =
|
||||||
{
|
{
|
||||||
|
|
||||||
|
{"ConstraintDemo",ConstraintDemo::Create},
|
||||||
{"ForkLift Demo",ForkLiftDemo::Create},
|
{"ForkLift Demo",ForkLiftDemo::Create},
|
||||||
{"Ragdoll Demo",RagdollDemo::Create},
|
{"Ragdoll Demo",RagdollDemo::Create},
|
||||||
{"Basic Demo", BasicDemo::Create},
|
{"Basic Demo", BasicDemo::Create},
|
||||||
{"Convex Decomposition",ConvexDecompositionDemo::Create},
|
{"Convex Decomposition",ConvexDecompositionDemo::Create},
|
||||||
{"Concave Moving", GimpactConcaveDemo::Create},
|
{"Concave Moving", GimpactConcaveDemo::Create},
|
||||||
{"Dynamic Control Demo",MotorDemo::Create},
|
// {"Dynamic Control Demo",MotorDemo::Create},
|
||||||
//{"ConcaveDemo",ConcaveDemo::Create},
|
//{"ConcaveDemo",ConcaveDemo::Create},
|
||||||
{"Concave Convexcast Demo",ConcaveConvexcastDemo::Create},
|
{"Concave Convexcast Demo",ConcaveConvexcastDemo::Create},
|
||||||
// {"SoftBody Cloth",SoftDemo0::Create},
|
// {"SoftBody Cloth",SoftDemo0::Create},
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ namespace
|
|||||||
int gDrawAabb;
|
int gDrawAabb;
|
||||||
int gWireFrame;
|
int gWireFrame;
|
||||||
int gHelpText;
|
int gHelpText;
|
||||||
|
int gDebugConstraints;
|
||||||
int gDebugContacts;
|
int gDebugContacts;
|
||||||
int gDrawTextures=1;
|
int gDrawTextures=1;
|
||||||
int gDrawShadows=0;
|
int gDrawShadows=0;
|
||||||
@@ -80,6 +81,14 @@ void setDefaultSettings()
|
|||||||
gDrawAabb=0;
|
gDrawAabb=0;
|
||||||
gWireFrame=0;
|
gWireFrame=0;
|
||||||
gDebugContacts=0;
|
gDebugContacts=0;
|
||||||
|
//enable constraint debug visualization for first demo, only if user hasn't overridden the setting
|
||||||
|
if (testSelection>1)
|
||||||
|
{
|
||||||
|
gDebugConstraints=0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
gDebugConstraints=1;
|
||||||
|
}
|
||||||
gHelpText = 0;
|
gHelpText = 0;
|
||||||
gDrawTextures=1;
|
gDrawTextures=1;
|
||||||
gDrawShadows=0;
|
gDrawShadows=0;
|
||||||
@@ -118,6 +127,14 @@ void ResetScene()
|
|||||||
void NextScene()
|
void NextScene()
|
||||||
{
|
{
|
||||||
testSelection++;
|
testSelection++;
|
||||||
|
if (testSelection>1)
|
||||||
|
{
|
||||||
|
gDebugConstraints=0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
gDebugConstraints=1;
|
||||||
|
}
|
||||||
|
|
||||||
if(testSelection>23)
|
if(testSelection>23)
|
||||||
testSelection=0;
|
testSelection=0;
|
||||||
if (glui)
|
if (glui)
|
||||||
@@ -216,6 +233,13 @@ void SimulationLoop()
|
|||||||
{
|
{
|
||||||
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_NoHelpText);
|
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_NoHelpText);
|
||||||
}
|
}
|
||||||
|
if (gDebugConstraints)
|
||||||
|
{
|
||||||
|
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_DrawConstraints+btIDebugDraw::DBG_DrawConstraintLimits);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
demo->setDebugMode(demo->getDebugMode() & (~btIDebugDraw::DBG_DrawConstraints+btIDebugDraw::DBG_DrawConstraintLimits));
|
||||||
|
}
|
||||||
if (gDebugContacts)
|
if (gDebugContacts)
|
||||||
{
|
{
|
||||||
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_DrawContactPoints);
|
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_DrawContactPoints);
|
||||||
@@ -281,6 +305,14 @@ void SimulationLoop()
|
|||||||
}
|
}
|
||||||
if (testSelection != testIndex)
|
if (testSelection != testIndex)
|
||||||
{
|
{
|
||||||
|
if (testSelection>1)
|
||||||
|
{
|
||||||
|
gDebugConstraints=0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
gDebugConstraints=1;
|
||||||
|
}
|
||||||
|
|
||||||
testIndex = testSelection;
|
testIndex = testSelection;
|
||||||
if (demo->getDynamicsWorld() && demo->getDynamicsWorld()->getDebugDrawer())
|
if (demo->getDynamicsWorld() && demo->getDynamicsWorld()->getDebugDrawer())
|
||||||
delete demo->getDynamicsWorld()->getDebugDrawer();
|
delete demo->getDynamicsWorld()->getDebugDrawer();
|
||||||
@@ -464,6 +496,7 @@ int main(int argc, char** argv)
|
|||||||
glui->add_checkbox_to_panel(drawPanel, "AABBs", &gDrawAabb);
|
glui->add_checkbox_to_panel(drawPanel, "AABBs", &gDrawAabb);
|
||||||
glui->add_checkbox_to_panel(drawPanel, "Wireframe", &gWireFrame);
|
glui->add_checkbox_to_panel(drawPanel, "Wireframe", &gWireFrame);
|
||||||
glui->add_checkbox_to_panel(drawPanel, "Contacts", &gDebugContacts);
|
glui->add_checkbox_to_panel(drawPanel, "Contacts", &gDebugContacts);
|
||||||
|
glui->add_checkbox_to_panel(drawPanel, "Constraints", &gDebugConstraints);
|
||||||
|
|
||||||
glui->add_checkbox_to_panel(drawPanel, "Textures", &gDrawTextures);
|
glui->add_checkbox_to_panel(drawPanel, "Textures", &gDrawTextures);
|
||||||
glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
|
glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ int main(int argc,char** argv)
|
|||||||
|
|
||||||
/// Import Collada 1.4 Physics objects
|
/// Import Collada 1.4 Physics objects
|
||||||
/// also can pass filename in as argument
|
/// also can pass filename in as argument
|
||||||
const char* filename = "boxc4d.dae";
|
const char* filename = "jenga.dae";
|
||||||
printf("argc=%i\n",argc);
|
printf("argc=%i\n",argc);
|
||||||
{
|
{
|
||||||
for (int i=0;i<argc;i++)
|
for (int i=0;i<argc;i++)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ subject to the following restrictions:
|
|||||||
Written by: Marten Svanfeldt
|
Written by: Marten Svanfeldt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CONSTRAINT_DEBUG_SIZE 0.2f
|
||||||
|
|
||||||
|
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "GlutStuff.h"
|
#include "GlutStuff.h"
|
||||||
@@ -197,6 +199,8 @@ public:
|
|||||||
hingeC = new btHingeConstraint(*m_bodies[BODYPART_PELVIS], *m_bodies[BODYPART_SPINE], localA, localB);
|
hingeC = new btHingeConstraint(*m_bodies[BODYPART_PELVIS], *m_bodies[BODYPART_SPINE], localA, localB);
|
||||||
hingeC->setLimit(btScalar(-M_PI_4), btScalar(M_PI_2));
|
hingeC->setLimit(btScalar(-M_PI_4), btScalar(M_PI_2));
|
||||||
m_joints[JOINT_PELVIS_SPINE] = hingeC;
|
m_joints[JOINT_PELVIS_SPINE] = hingeC;
|
||||||
|
hingeC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_PELVIS_SPINE], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_PELVIS_SPINE], true);
|
||||||
|
|
||||||
|
|
||||||
@@ -206,6 +210,8 @@ public:
|
|||||||
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_SPINE], *m_bodies[BODYPART_HEAD], localA, localB);
|
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_SPINE], *m_bodies[BODYPART_HEAD], localA, localB);
|
||||||
coneC->setLimit(M_PI_4, M_PI_4, M_PI_2);
|
coneC->setLimit(M_PI_4, M_PI_4, M_PI_2);
|
||||||
m_joints[JOINT_SPINE_HEAD] = coneC;
|
m_joints[JOINT_SPINE_HEAD] = coneC;
|
||||||
|
coneC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_SPINE_HEAD], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_SPINE_HEAD], true);
|
||||||
|
|
||||||
|
|
||||||
@@ -215,6 +221,8 @@ public:
|
|||||||
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_PELVIS], *m_bodies[BODYPART_LEFT_UPPER_LEG], localA, localB);
|
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_PELVIS], *m_bodies[BODYPART_LEFT_UPPER_LEG], localA, localB);
|
||||||
coneC->setLimit(M_PI_4, M_PI_4, 0);
|
coneC->setLimit(M_PI_4, M_PI_4, 0);
|
||||||
m_joints[JOINT_LEFT_HIP] = coneC;
|
m_joints[JOINT_LEFT_HIP] = coneC;
|
||||||
|
coneC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_HIP], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_HIP], true);
|
||||||
|
|
||||||
localA.setIdentity(); localB.setIdentity();
|
localA.setIdentity(); localB.setIdentity();
|
||||||
@@ -223,6 +231,8 @@ public:
|
|||||||
hingeC = new btHingeConstraint(*m_bodies[BODYPART_LEFT_UPPER_LEG], *m_bodies[BODYPART_LEFT_LOWER_LEG], localA, localB);
|
hingeC = new btHingeConstraint(*m_bodies[BODYPART_LEFT_UPPER_LEG], *m_bodies[BODYPART_LEFT_LOWER_LEG], localA, localB);
|
||||||
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
||||||
m_joints[JOINT_LEFT_KNEE] = hingeC;
|
m_joints[JOINT_LEFT_KNEE] = hingeC;
|
||||||
|
hingeC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_KNEE], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_KNEE], true);
|
||||||
|
|
||||||
|
|
||||||
@@ -232,6 +242,8 @@ public:
|
|||||||
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_PELVIS], *m_bodies[BODYPART_RIGHT_UPPER_LEG], localA, localB);
|
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_PELVIS], *m_bodies[BODYPART_RIGHT_UPPER_LEG], localA, localB);
|
||||||
coneC->setLimit(M_PI_4, M_PI_4, 0);
|
coneC->setLimit(M_PI_4, M_PI_4, 0);
|
||||||
m_joints[JOINT_RIGHT_HIP] = coneC;
|
m_joints[JOINT_RIGHT_HIP] = coneC;
|
||||||
|
coneC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_HIP], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_HIP], true);
|
||||||
|
|
||||||
localA.setIdentity(); localB.setIdentity();
|
localA.setIdentity(); localB.setIdentity();
|
||||||
@@ -240,6 +252,8 @@ public:
|
|||||||
hingeC = new btHingeConstraint(*m_bodies[BODYPART_RIGHT_UPPER_LEG], *m_bodies[BODYPART_RIGHT_LOWER_LEG], localA, localB);
|
hingeC = new btHingeConstraint(*m_bodies[BODYPART_RIGHT_UPPER_LEG], *m_bodies[BODYPART_RIGHT_LOWER_LEG], localA, localB);
|
||||||
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
||||||
m_joints[JOINT_RIGHT_KNEE] = hingeC;
|
m_joints[JOINT_RIGHT_KNEE] = hingeC;
|
||||||
|
hingeC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_KNEE], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_KNEE], true);
|
||||||
|
|
||||||
|
|
||||||
@@ -248,6 +262,8 @@ public:
|
|||||||
localB.getBasis().setEulerZYX(0,0,M_PI_2); localB.setOrigin(btVector3(btScalar(0.), btScalar(-0.18), btScalar(0.)));
|
localB.getBasis().setEulerZYX(0,0,M_PI_2); localB.setOrigin(btVector3(btScalar(0.), btScalar(-0.18), btScalar(0.)));
|
||||||
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_SPINE], *m_bodies[BODYPART_LEFT_UPPER_ARM], localA, localB);
|
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_SPINE], *m_bodies[BODYPART_LEFT_UPPER_ARM], localA, localB);
|
||||||
coneC->setLimit(M_PI_2, M_PI_2, 0);
|
coneC->setLimit(M_PI_2, M_PI_2, 0);
|
||||||
|
coneC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_joints[JOINT_LEFT_SHOULDER] = coneC;
|
m_joints[JOINT_LEFT_SHOULDER] = coneC;
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_SHOULDER], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_SHOULDER], true);
|
||||||
|
|
||||||
@@ -258,6 +274,8 @@ public:
|
|||||||
// hingeC->setLimit(btScalar(-M_PI_2), btScalar(0));
|
// hingeC->setLimit(btScalar(-M_PI_2), btScalar(0));
|
||||||
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
||||||
m_joints[JOINT_LEFT_ELBOW] = hingeC;
|
m_joints[JOINT_LEFT_ELBOW] = hingeC;
|
||||||
|
hingeC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_ELBOW], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_LEFT_ELBOW], true);
|
||||||
|
|
||||||
|
|
||||||
@@ -268,6 +286,8 @@ public:
|
|||||||
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_SPINE], *m_bodies[BODYPART_RIGHT_UPPER_ARM], localA, localB);
|
coneC = new btConeTwistConstraint(*m_bodies[BODYPART_SPINE], *m_bodies[BODYPART_RIGHT_UPPER_ARM], localA, localB);
|
||||||
coneC->setLimit(M_PI_2, M_PI_2, 0);
|
coneC->setLimit(M_PI_2, M_PI_2, 0);
|
||||||
m_joints[JOINT_RIGHT_SHOULDER] = coneC;
|
m_joints[JOINT_RIGHT_SHOULDER] = coneC;
|
||||||
|
coneC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_SHOULDER], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_SHOULDER], true);
|
||||||
|
|
||||||
localA.setIdentity(); localB.setIdentity();
|
localA.setIdentity(); localB.setIdentity();
|
||||||
@@ -277,6 +297,8 @@ public:
|
|||||||
// hingeC->setLimit(btScalar(-M_PI_2), btScalar(0));
|
// hingeC->setLimit(btScalar(-M_PI_2), btScalar(0));
|
||||||
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
hingeC->setLimit(btScalar(0), btScalar(M_PI_2));
|
||||||
m_joints[JOINT_RIGHT_ELBOW] = hingeC;
|
m_joints[JOINT_RIGHT_ELBOW] = hingeC;
|
||||||
|
hingeC->setDbgDrawSize(CONSTRAINT_DEBUG_SIZE);
|
||||||
|
|
||||||
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_ELBOW], true);
|
m_ownerWorld->addConstraint(m_joints[JOINT_RIGHT_ELBOW], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ bool btTriangleIndexVertexArray::hasPremadeAabb() const
|
|||||||
return (m_hasAabb == 1);
|
return (m_hasAabb == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btTriangleIndexVertexArray::setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
|
void btTriangleIndexVertexArray::setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
|
||||||
{
|
{
|
||||||
m_aabbMin = aabbMin;
|
m_aabbMin = aabbMin;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Bullet Continuous Collision Detection and Physics Library
|
Bullet Continuous Collision Detection and Physics Library
|
||||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
static btRigidBody s_fixed(0, 0,0);
|
static btRigidBody s_fixed(0, 0,0);
|
||||||
|
|
||||||
#define DEFAULT_DEBUGDRAW_SIZE btScalar(5.f)
|
#define DEFAULT_DEBUGDRAW_SIZE btScalar(0.3f)
|
||||||
|
|
||||||
btTypedConstraint::btTypedConstraint(btTypedConstraintType type)
|
btTypedConstraint::btTypedConstraint(btTypedConstraintType type)
|
||||||
:m_userConstraintType(-1),
|
:m_userConstraintType(-1),
|
||||||
|
|||||||
Reference in New Issue
Block a user