[Bf-blender-cvs] [e50f8cfdde6] temp-fracture-modifier-2.8: cleanup, removed (non-working) compound stuff again
Martin Felke
noreply at git.blender.org
Sun Nov 25 12:07:31 CET 2018
Commit: e50f8cfdde683d98b6b14adce66b1c895678a5ad
Author: Martin Felke
Date: Sun Nov 25 11:57:30 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rBe50f8cfdde683d98b6b14adce66b1c895678a5ad
cleanup, removed (non-working) compound stuff again
===================================================================
M extern/bullet2/CMakeLists.txt
D extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.cpp
D extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.h
D extern/bullet2/src/BulletDynamics/Dynamics/btFractureBody.cpp
D extern/bullet2/src/BulletDynamics/Dynamics/btFractureBody.h
D extern/bullet2/src/BulletDynamics/Dynamics/btFractureDynamicsWorld.cpp
D extern/bullet2/src/BulletDynamics/Dynamics/btFractureDynamicsWorld.h
M extern/bullet2/src/btBulletDynamicsCommon.h
M intern/rigidbody/RBI_api.h
M intern/rigidbody/rb_bullet_api.cpp
M source/blender/blenkernel/intern/fracture_rigidbody.c
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/makesdna/DNA_rigidbody_types.h
===================================================================
diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt
index 9d7a9726529..949a8b01bd2 100644
--- a/extern/bullet2/CMakeLists.txt
+++ b/extern/bullet2/CMakeLists.txt
@@ -130,7 +130,6 @@ set(SRC
src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
src/BulletDynamics/Character/btKinematicCharacterController.cpp
- src/BulletDynamics/ConstraintSolver/btCompoundConstraint.cpp
src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
src/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
src/BulletDynamics/ConstraintSolver/btFixedConstraint.cpp
@@ -149,9 +148,7 @@ set(SRC
src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
src/BulletDynamics/Dynamics/Bullet-C-API.cpp
src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
- src/BulletDynamics/Dynamics/btFractureDynamicsWorld.cpp
src/BulletDynamics/Dynamics/btRigidBody.cpp
- src/BulletDynamics/Dynamics/btFractureBody.cpp
src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp
src/BulletDynamics/Featherstone/btMultiBody.cpp
src/BulletDynamics/Featherstone/btMultiBodyConstraint.cpp
@@ -317,7 +314,6 @@ set(SRC
src/BulletDynamics/Character/btCharacterControllerInterface.h
src/BulletDynamics/Character/btKinematicCharacterController.h
- src/BulletDynamics/ConstraintSolver/btCompoundConstraint.h
src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
src/BulletDynamics/ConstraintSolver/btConstraintSolver.h
src/BulletDynamics/ConstraintSolver/btContactConstraint.h
diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.cpp b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.cpp
deleted file mode 100644
index 2f621eac171..00000000000
--- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#include "btCompoundConstraint.h"
-
-btCompoundConstraint::btCompoundConstraint(btRigidBody& rbA, btRigidBody& rbB)
- :btTypedConstraint(static_cast<btTypedConstraintType>(COMPOUND_CONSTRAINT_TYPE), rbA, rbB)
-{
-}
-
diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.h b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.h
deleted file mode 100644
index d95ddbe79f6..00000000000
--- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btCompoundConstraint.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef BTCOMPOUNDCONSTRAINT_H
-#define BTCOMPOUNDCONSTRAINT_H
-
-#include "btTypedConstraint.h"
-
-#define COMPOUND_CONSTRAINT_TYPE (MAX_CONSTRAINT_TYPE+1)
-
-ATTRIBUTE_ALIGNED16(class) btCompoundConstraint : public btTypedConstraint
-{
- public:
- btCompoundConstraint(btRigidBody& rbA,btRigidBody& rbB);
- virtual void getInfo1(btConstraintInfo1* info) {}
- virtual void getInfo2(btConstraintInfo2* info) {}
- virtual btScalar getParam(int num, int axis) const { return 0;}
- virtual void setParam(int num, btScalar value, int axis) {}
-
- int m_objectId;
-};
-
-#endif // BTCOMPOUNDCONSTRAINT_H
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btFractureBody.cpp b/extern/bullet2/src/BulletDynamics/Dynamics/btFractureBody.cpp
deleted file mode 100644
index 4c60e2d3ea9..00000000000
--- a/extern/bullet2/src/BulletDynamics/Dynamics/btFractureBody.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-
-#include "btFractureBody.h"
-#include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
-#include "BulletCollision/CollisionShapes/btCompoundShape.h"
-#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
-
-#include "BulletDynamics/Dynamics/btFractureDynamicsWorld.h"
-
-
-class btConnectionSortPredicate
-{
- public:
-
- bool operator() ( const btConnection& lhs, const btConnection& rhs ) const
- {
- btVector3 locLhsA = lhs.m_parent->getWorldTransform().inverse() * lhs.m_obA->getWorldTransform().getOrigin();
- btVector3 locLhsB = lhs.m_parent->getWorldTransform().inverse() * lhs.m_obB->getWorldTransform().getOrigin();
-
- btVector3 locRhsA = rhs.m_parent->getWorldTransform().inverse() * rhs.m_obA->getWorldTransform().getOrigin();
- btVector3 locRhsB = rhs.m_parent->getWorldTransform().inverse() * rhs.m_obB->getWorldTransform().getOrigin();
-
- btVector3 locLhs = (locLhsA + locLhsB) * 0.5f;
- btVector3 locRhs = (locRhsA + locRhsB) * 0.5f;
-
- //lhs.parent should match rhs.parent... same object
- btAssert(lhs.m_parent == rhs.m_parent);
-
- btScalar dLhs = lhs.m_parent->getWorldTransform().getOrigin().distance(locLhs);
- btScalar dRhs = rhs.m_parent->getWorldTransform().getOrigin().distance(locRhs);
- //btTransform id = btTransform::getIdentity();
- //btScalar dLhs = id.getOrigin().distance(locLhs);
- //btScalar dRhs = id.getOrigin().distance(locRhs);
-
- return dLhs < dRhs;
- }
-};
-
-
-void btFractureBody::recomputeConnectivity(btCollisionWorld* world)
-{
- m_connections.clear();
- //@todo use the AABB tree to avoid N^2 checks
-
- if (getCollisionShape()->isCompound())
- {
- btCompoundShape* compound = (btCompoundShape*)getCollisionShape();
- for (int i=0;i<compound->getNumChildShapes();i++)
- {
- for (int j=i+1;j<compound->getNumChildShapes();j++)
- {
-
- struct MyContactResultCallback : public btCollisionWorld::ContactResultCallback
- {
- bool m_connected;
- btScalar m_margin;
- MyContactResultCallback() :m_connected(false),m_margin(0.05)
- {
- }
- virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1)
- {
- if (cp.getDistance()<=m_margin)
- m_connected = true;
- return 1.f;
- }
- };
-
- MyContactResultCallback result;
-
- btCollisionObject obA;
- obA.setWorldTransform(compound->getChildTransform(i));
- obA.setCollisionShape(compound->getChildShape(i));
- btCollisionObject obB;
- obB.setWorldTransform(compound->getChildTransform(j));
- obB.setCollisionShape(compound->getChildShape(j));
- world->contactPairTest(&obA,&obB,result);
- if (result.m_connected)
- {
- btConnection tmp;
- tmp.m_childIndex0 = i;
- tmp.m_childIndex1 = j;
- tmp.m_childShape0 = compound->getChildShape(i);
- tmp.m_childShape1 = compound->getChildShape(j);
- tmp.m_strength = 1.f;//??
- m_connections.push_back(tmp);
- }
- }
- }
- }
-}
-
-void btFractureBody::recomputeConnectivityByConstraints(btCollisionWorld *world1)
-{
- btFractureDynamicsWorld *world = (btFractureDynamicsWorld*)world1;
-
- if (world->m_idCallback != NULL)
- {
- int i, size = world->m_compoundConstraints.size();
- m_connections.clear();
-
- for (i=0; i<size;i++)
- {
- btCompoundConstraint *con = world->m_compoundConstraints[i];
-
- if (con->isEnabled())
- {
- int obIdA, shardIdA, obIdB, shardIdB;
- btFractureBody *obA = (btFractureBody*)&con->getRigidBodyA();
- btFractureBody *obB = (btFractureBody*)&con->getRigidBodyB();
-
- //if (this == obA || this == obB)
- {
- int *index0 = NULL, *index1 = NULL;
- world->m_idCallback(obA->getUserPointer(), &obIdA, &shardIdA);
- world->m_idCallback(obB->getUserPointer(), &obIdB, &shardIdB);
-
- index0 = world->m_childIndexHash->find(to_str(obIdA, shardIdA));
- index1 = world->m_childIndexHash->find(to_str(obIdB, shardIdB));
-
- if ((obIdA == obIdB) && (shardIdA != shardIdB) &&
- index0 && index1 && *index0 > -1 && *index1 > -1)
- {
- btConnection tmp;
- tmp.m_childIndex0 = *index0;
- tmp.m_childIndex1 = *index1;
- tmp.m_childShape0 = obA->getCollisionShape();
- tmp.m_childShape1 = obB->getCollisionShape();
- tmp.m_strength = con->getBreakingImpulseThreshold();
- tmp.m_obA = obA;
- tmp.m_obB = obB;
- tmp.m_parent = this;
- tmp.m_id = i;
- m_connections.push_back(tmp);
- }
-
- //break;
- }
- }
- }
-
- m_connections.quickSort(btConnectionSortPredicate());
- //build a connection map
- m_connection_map->clear();
-
- size = m_connections.size();
- for (i=0; i < size; i++)
- {
- btConnection& con = m_connections[i];
- btAlignedObjectArray<int> *adjacents = m_connection_map->find(con.m_childIndex0);
- if (!adjacents) {
- btAlignedObjectArray<int> adj;
- adj.push_back(con.m_childIndex1);
- m_connection_map->insert(con.m_childIndex0, adj);
- }
- else
- {
- if (adjacents->size() != adjacents->findLinearSearch(con.m_childIndex1))
- adjacents->push_back(con.m_childIndex1);
- }
- }
- }
-}
-
-btCompoundShape* btFractureBody::shiftTransformDistributeMass(btCompoundShape* boxCompound,btScalar mass,btTransform& shift)
-{
-
- btVector3 principalInertia;
-
- btScalar* masses = new btScalar[boxCompound->getNumChildShapes()];
- for (int j=0;j<boxCompound->getNumChildShapes();j++)
- {
- //evenly distribute mass
- masses[j]=mass/boxCompound->getNumChildShapes();
- }
-
- return shiftTransform(boxCompound,masses,shift,principalInertia);
-
-}
-
-
-btCompoundShape* btFractureBody::shiftTransform(btCompoundShape* boxCompound,btScalar* masses,btTransform& shift, btVector3& principalInertia)
-{
- btTransform principal;
-
- boxCompound->calculatePrincipalAxisTransform(masses,principal,principalInertia);
-
-
- ///create a new compound with world transform/center of mass properly aligned with the principal axis
-
- ///non-recursive compound shapes perform better
-
-#ifdef USE_RECURSIVE_COMPOUND
-
- btCompoundShape* newCompound = new btCompoundShape();
- newCompound->addChildShape(principal.inverse(),boxCompound);
- newBoxCompound = newCompound;
- //m_collisionShapes.push_back(newCompound);
-
- //btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
- //btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,newCompound,principalInertia);
-
-#else
-#ifdef CHANGE_COMPOUND_INPLACE
- newBoxCompound = boxCompound;
- for (int i=0;i<boxCompound->getNumChildShapes();i++)
- {
- btTransform newChildTransform = principal.inverse()*boxCompound->getChildTransform(i);
- ///updateChildTransform is really slow, because it re-calculates the AABB each time. todo: add option to disable this update
- boxCompound->updateChildTransform(i,newChildTransform);
- }
- bool isDyna
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list