17 #ifndef _BT_SOFT_BODY_H    18 #define _BT_SOFT_BODY_H    34 #define btSoftBodyData  btSoftBodyFloatData    35 #define btSoftBodyDataName      "btSoftBodyFloatData"    59                 m_maxDisplacement(1000.f),
   346                 Cluster() : m_leaf(0),m_ndamping(0),m_ldamping(0),m_adamping(0),m_matching(0) 
   347                 ,m_maxSelfCollisionImpulse(100.f),
   348                 m_selfCollisionImpulseFactor(0.01f),
   349                 m_containsAnchor(false)
   359                 Impulse() : m_velocity(0,0,0),m_drift(0,0,0),m_asVelocity(0),m_asDrift(0)       {}
   382                 Body() : m_soft(0),m_rigid(0),m_collisionObject(0)                              {}
   393                         if (m_collisionObject)
   401                         if(m_soft)      
return(m_soft->
m_invwi);
   407                         if(m_soft)      
return(m_soft->
m_imass);
   420                         if(m_soft)      
return(m_soft->
m_lv);
   432                         if(m_soft)      
return(m_soft->
m_av);
   437                         return(linearVelocity()+angularVelocity(rpos));
   459                                 applyDImpulse(impulse.
m_drift,rpos);
   509                 virtual void                            Prepare(
btScalar dt,
int iterations);
   511                 virtual void                            Terminate(
btScalar dt)=0;
   522                 void                                            Prepare(
btScalar dt,
int iterations);
   525                 eType::_                                        
Type()
 const { 
return(eType::Linear); }
   545                 void                                            Prepare(
btScalar dt,
int iterations);
   548                 eType::_                                        
Type()
 const { 
return(eType::Angular); }
   558                 void                                            Prepare(
btScalar dt,
int iterations);
   561                 eType::_                                        
Type()
 const { 
return(eType::Contact); }
   694         virtual ~btSoftBody();
   710         bool                            checkLink(      
int node0,
   712         bool                            checkLink(      
const Node* node0,
   713                 const Node* node1) 
const;
   715         bool                            checkFace(      
int node0,
   721         void                            appendNote(     
const char* text,
   728         void                            appendNote(     
const char* text,
   731         void                            appendNote(     
const char* text,
   734         void                            appendNote(     
const char* text,
   738         void                            appendNode(     
const btVector3& x,btScalar m);
   740         void                            appendLink(
int model=-1,
Material* mat=0);
   741         void                            appendLink(     
int node0,
   744                 bool bcheckexist=
false);
   745         void                            appendLink(     
Node* node0,
   748                 bool bcheckexist=
false);
   750         void                            appendFace(
int model=-1,
Material* mat=0);
   751         void                            appendFace(     
int node0,
   755         void                    appendTetra(
int model,
Material* mat);
   757         void                    appendTetra(
int node0,
   765         void                            appendAnchor(   
int node,
   766                 btRigidBody* body, 
bool disableCollisionBetweenLinkedBodies=
false,btScalar influence = 1);
   767         void                    appendAnchor(
int node,
btRigidBody* body, 
const btVector3& localPivot,
bool disableCollisionBetweenLinkedBodies=
false,btScalar influence = 1);
   771         void                            appendLinearJoint(
const LJoint::Specs& specs,btSoftBody* body);
   775         void                            appendAngularJoint(
const AJoint::Specs& specs,btSoftBody* body);
   782         void                        addAeroForceToNode(
const btVector3& windVelocity,
int nodeIndex);
   785         void                        addAeroForceToFace(
const btVector3& windVelocity,
int faceIndex);
   788         void                            addVelocity(    
const btVector3& velocity);
   791         void                            setVelocity(    
const btVector3& velocity);
   794         void                            addVelocity(    
const btVector3& velocity,
   797         void                            setMass(                
int node,
   800         btScalar                        getMass(                
int node) 
const;
   802         btScalar                        getTotalMass() 
const;
   804         void                            setTotalMass(   btScalar mass,
   805                 bool fromfaces=
false);
   807         void                            setTotalDensity(btScalar density);
   809         void                            setVolumeMass(          btScalar mass);
   811         void                            setVolumeDensity(       btScalar density);
   821         btScalar                        getRestLengthScale();
   823         void                            setRestLengthScale(btScalar restLength);
   825         void                            setPose(                
bool bvolume,
   828         void                            resetLinkRestLengths();
   830         btScalar                        getVolume() 
const;
   832         int                                     clusterCount() 
const;
   844         static void                     clusterAImpulse(
Cluster* cluster,
const Impulse& impulse);
   847         int                                     generateBendingConstraints(     
int distance,
   850         void                            randomizeConstraints();
   852         void                            releaseCluster(
int index);
   853         void                            releaseClusters();
   857         int                                     generateClusters(
int k,
int maxiterations=8192);
   859         void                            refine(
ImplicitFn* ifn,btScalar accurary,
bool cut);
   861         bool                            cutLink(
int node0,
int node1,btScalar position);
   862         bool                            cutLink(
const Node* node0,
const Node* node1,btScalar position);
   871         void                            predictMotion(btScalar dt);
   873         void                            solveConstraints();
   875         void                            staticSolve(
int iterations);
   877         static void                     solveCommonConstraints(btSoftBody** bodies,
int count,
int iterations);
   881         void                            integrateMotion();
   884         void                            defaultCollisionHandler(btSoftBody* psb);
   895         void setWindVelocity( 
const btVector3 &velocity );
   909                 m_softBodySolver = softBodySolver;
   917                 return m_softBodySolver;
   925                 return m_softBodySolver;
   936                         return (
const btSoftBody*)colObj;
   942                         return (btSoftBody*)colObj;
   952                 aabbMin = m_bounds[0];
   953                 aabbMax = m_bounds[1];
   958         void                            pointersToIndices();
   959         void                            indicesToPointers(
const int* map=0);
   962                 btScalar& mint,
eFeature::_& feature,
int& index,
bool bcountonly) 
const;
   963         void                            initializeFaceTree();
   966         void                            updateNormals();
   969         void                            updateConstants();
   970         void                            updateLinkConstants();
   971         void                            updateArea(
bool averageArea = 
true);
   972         void                            initializeClusters();
   973         void                            updateClusters();
   974         void                            cleanupClusters();
   975         void                            prepareClusters(
int iterations);
   976         void                            solveClusters(btScalar sor);
   977         void                            applyClusters(
bool drift);
   980         static void                     PSolve_Anchors(btSoftBody* psb,btScalar kst,btScalar ti);
   981         static void                     PSolve_RContacts(btSoftBody* psb,btScalar kst,btScalar ti);
   982         static void                     PSolve_SContacts(btSoftBody* psb,btScalar,btScalar ti);
   983         static void                     PSolve_Links(btSoftBody* psb,btScalar kst,btScalar ti);
   984         static void                     VSolve_Links(btSoftBody* psb,btScalar kst);
   989         virtual int     calculateSerializeBufferSize()  
const;
   992         virtual const char*     serialize(
void* dataBuffer,  
class btSerializer* serializer) 
const;
  1002 #endif //_BT_SOFT_BODY_H 
btScalar getInvMass() const 
const btCollisionObject * m_colObj
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
Impulse operator*(btScalar x) const 
eFeature::_ feature
soft body 
btAlignedObjectArray< Link > tLinkArray
Vertex normals are oriented toward velocity. 
btScalar m_maxDisplacement
btVector3 linearVelocity() const 
void applyTorqueImpulse(const btVector3 &torque)
btAlignedObjectArray< ePSolver::_ > tPSolverArray
btVector3 angularVelocity() const 
Vertex normals are flipped to match velocity. 
btScalar m_restLengthScale
tVector3Array m_framerefs
btAlignedObjectArray< btVector3 > tVector3Array
Body(const btCollisionObject *colObj)
int getInternalType() const 
reserved for Bullet internal usage 
btAlignedObjectArray< bool > m_clusterConnectivity
btAlignedObjectArray< Cluster * > tClusterArray
btVector3 angularVelocity(const btVector3 &rpos) const 
btAlignedObjectArray< Node * > m_nodes
btAlignedObjectArray< btScalar > tScalarArray
static void clusterVImpulse(Cluster *cluster, const btVector3 &rpos, const btVector3 &impulse)
btDispatcher * m_dispatcher
The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes ...
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btScalar fraction
feature index 
virtual btScalar Speed(AJoint *, btScalar current)
const btMatrix3x3 & invWorldInertia() const 
tSContactArray m_scontacts
btAlignedObjectArray< Face > tFaceArray
btAlignedObjectArray< RContact > tRContactArray
btAlignedObjectArray< int > m_userIndexMapping
static IControl * Default()
btAlignedObjectArray< Tetra > tTetraArray
const btTransform & xform() const 
Vertex normals are taken as it is. 
btTransform m_initialWorldTransform
static btSoftBody * upcast(btCollisionObject *colObj)
btAlignedObjectArray< btDbvtNode * > tLeafArray
btSoftBodyWorldInfo * m_worldInfo
virtual void getAabb(btVector3 &aabbMin, btVector3 &aabbMax) const 
btSparseSdf< 3 > m_sparsesdf
btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors. 
virtual void setCollisionShape(btCollisionShape *collisionShape)
btTransform & getWorldTransform()
void applyDImpulse(const btVector3 &impulse, const btVector3 &rpos) const 
btSoftBodyWorldInfo * getWorldInfo()
Vertex normals are flipped to match velocity and lift and drag forces are applied. 
btAlignedObjectArray< Material * > tMaterialArray
tMaterialArray m_materials
static void clusterDImpulse(Cluster *cluster, const btVector3 &rpos, const btVector3 &impulse)
btSoftBodySolver * getSoftBodySolver() const 
static const btSoftBody * upcast(const btCollisionObject *colObj)
const btCollisionObject * m_collisionObject
RayFromToCaster takes a ray from, ray to (instead of direction!) 
eVSolver : velocities solvers 
btSoftBodySolver * getSoftBodySolver()
const btVector3 & getAngularVelocity() const 
btCollisionObject can be used to manage collision detection objects. 
static void clusterVAImpulse(Cluster *cluster, const btVector3 &impulse)
The btRigidBody is the main class for rigid body objects. 
tPSolverArray m_dsequence
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs...
btScalar m_maxSelfCollisionImpulse
void activate(bool forceActivation=false) const 
btVector3 can be used to represent 3D points and vectors. 
btAlignedObjectArray< Note > tNoteArray
void applyVImpulse(const btVector3 &impulse, const btVector3 &rpos) const 
btAlignedObjectArray< btSoftBody * > tSoftBodyArray
btAlignedObjectArray< SContact > tSContactArray
ePSolver : positions solvers 
btMatrix3x3 operator-(const btMatrix3x3 &m1, const btMatrix3x3 &m2)
btAlignedObjectArray< Joint * > tJointArray
virtual void Prepare(AJoint *)
Face normals are flipped to match velocity. 
static void split(const tNodeArray &leaves, tNodeArray &left, tNodeArray &right, const btVector3 &org, const btVector3 &axis)
void applyDCImpulse(const btVector3 &impulse) const 
Face normals are flipped to match velocity and lift and drag forces are applied. 
void setSoftBodySolver(btSoftBodySolver *softBodySolver)
void applyVAImpulse(const btVector3 &impulse) const 
const btMatrix3x3 & getInvInertiaTensorWorld() const 
void applyCentralImpulse(const btVector3 &impulse)
tVSolverArray m_vsequence
void applyImpulse(const Impulse &impulse, const btVector3 &rpos) const 
tPSolverArray m_psequence
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
const btVector3 & getLinearVelocity() const 
btBroadphaseInterface * m_broadphase
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
btSoftBodySolver * m_softBodySolver
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btAlignedObjectArray< const class btCollisionObject * > m_collisionDisabledObjects
btScalar m_selfCollisionImpulseFactor
The btSoftBody is an class to simulate cloth and volumetric soft bodies. 
btAlignedObjectArray< Node > tNodeArray
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
static void clusterDCImpulse(Cluster *cluster, const btVector3 &impulse)
void applyAImpulse(const Impulse &impulse) const 
void applyDAImpulse(const btVector3 &impulse) const 
tRContactArray m_rcontacts
btAlignedObjectArray< Anchor > tAnchorArray
btVector3 m_rayNormalizedDirection
btAlignedObjectArray< eVSolver::_ > tVSolverArray
btVector3 velocity(const btVector3 &rpos) const 
static void clusterDAImpulse(Cluster *cluster, const btVector3 &impulse)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...