Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2005-07-30 22:58:21 +0400
committerErwin Coumans <blender@erwincoumans.com>2005-07-30 22:58:21 +0400
commit697b22cc414298ef94f32f5f1b34fa5fa351c4db (patch)
tree60767d6698be1222ffd991d2a22c7a71494bcdf9 /extern
parent6eeaacde0aef77b294e0ac425aa68a14f38dce1b (diff)
updated testbed demo
Diffstat (limited to 'extern')
-rw-r--r--extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp8
-rw-r--r--extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h6
-rw-r--r--extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp28
-rw-r--r--extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h4
4 files changed, 34 insertions, 12 deletions
diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp
index 8b423204bec..19c4632820c 100644
--- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp
+++ b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp
@@ -31,7 +31,7 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
MassProps mp(ci.m_mass, ci.m_localInertiaTensor);
- m_body = new RigidBody(mp,0,0);
+ m_body = new RigidBody(mp,0,0,ci.m_friction,ci.m_restitution);
m_broadphaseHandle = ci.m_broadphaseHandle;
@@ -44,12 +44,10 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
m_body->setMassProps(ci.m_mass, ci.m_localInertiaTensor);
m_body->setGravity( ci.m_gravity);
- m_friction = ci.m_friction;
- m_restitution = ci.m_restitution;
-
+
m_body->setDamping(ci.m_linearDamping, ci.m_angularDamping);
-
+
m_body->setCenterOfMassTransform( trans );
#ifdef WIN32
diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h
index 3a8590e261c..235931ebab4 100644
--- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h
+++ b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h
@@ -15,7 +15,6 @@ struct CcdConstructionInfo
CcdConstructionInfo()
: m_gravity(0,0,0),
m_mass(0.f),
- m_friction(0.1f),
m_restitution(0.1f),
m_linearDamping(0.1f),
m_angularDamping(0.1f),
@@ -27,9 +26,8 @@ struct CcdConstructionInfo
SimdVector3 m_localInertiaTensor;
SimdVector3 m_gravity;
SimdScalar m_mass;
- SimdScalar m_friction;
SimdScalar m_restitution;
-
+ SimdScalar m_friction;
SimdScalar m_linearDamping;
SimdScalar m_angularDamping;
void* m_broadphaseHandle;
@@ -54,8 +52,6 @@ class CcdPhysicsController : public PHY_IPhysicsController
int m_collisionDelay;
- SimdScalar m_friction;
- SimdScalar m_restitution;
void* m_broadphaseHandle;
CcdPhysicsController (const CcdConstructionInfo& ci);
diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp
index 885304983a6..5b6db434f8b 100644
--- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp
+++ b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp
@@ -33,7 +33,7 @@ bool useIslands = true;
//#include "BroadphaseCollision/QueryBox.h"
//todo: change this to allow dynamic registration of types!
-unsigned long gNumIterations = 1;
+unsigned long gNumIterations = 10;
#ifdef WIN32
void DrawRasterizerLine(const float* from,const float* to,int color);
@@ -366,6 +366,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
//contacts
+
m_dispatcher->SolveConstraints(timeStep, gNumIterations ,numRigidBodies,m_debugDrawer);
for (int g=0;g<numsubstep;g++)
@@ -438,7 +439,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
#ifdef WIN32
SimdVector3 color (1,0,0);
- if (0)//m_debugDrawer)
+ if (m_debugDrawer)
{
//draw aabb
@@ -540,6 +541,29 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
return true;
}
+void CcdPhysicsEnvironment::setDebugMode(int debugMode)
+{
+ if (debugMode > 10)
+ {
+ if (m_dispatcher)
+ delete m_dispatcher;
+
+ if (debugMode == 11)
+ {
+ SimpleConstraintSolver* solver= new SimpleConstraintSolver();
+ m_dispatcher = new ToiContactDispatcher(solver);
+ } else
+ {
+ OdeConstraintSolver* solver = new OdeConstraintSolver();
+ m_dispatcher = new ToiContactDispatcher(solver);
+ }
+ }
+ if (m_debugDrawer){
+ m_debugDrawer->SetDebugMode(debugMode);
+ }
+}
+
+
void CcdPhysicsEnvironment::SyncMotionStates(float timeStep)
{
std::vector<CcdPhysicsController*>::iterator i;
diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h
index fc3786885b7..be6f6c648c7 100644
--- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h
+++ b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h
@@ -50,8 +50,11 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
virtual bool proceedDeltaTime(double curTime,float timeStep);
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){};
//returns 0.f if no fixed timestep is used
+
virtual float getFixedTimeStep(){ return 0.f;};
+ virtual void setDebugMode(int debugMode);
+
virtual void setGravity(float x,float y,float z);
virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
@@ -113,6 +116,7 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
bool m_scalingPropagated;
+
};
#endif //CCDPHYSICSENVIRONMENT