Blender V2.61 - r43446

btSoftBodyData.h

Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose,
00008 including commercial applications, and to alter it and redistribute it freely,
00009 subject to the following restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef BT_SOFTBODY_FLOAT_DATA
00017 #define BT_SOFTBODY_FLOAT_DATA
00018 
00019 #include "BulletCollision/CollisionDispatch/btCollisionObject.h"
00020 
00021 
00022 
00023 struct  SoftBodyMaterialData
00024 {
00025     float   m_linearStiffness;
00026     float   m_angularStiffness;
00027     float   m_volumeStiffness;
00028     int     m_flags;
00029 };
00030 
00031 struct  SoftBodyNodeData
00032 {
00033     SoftBodyMaterialData        *m_material;
00034     btVector3FloatData          m_position;
00035     btVector3FloatData          m_previousPosition;
00036     btVector3FloatData          m_velocity;
00037     btVector3FloatData          m_accumulatedForce;
00038     btVector3FloatData          m_normal;
00039     float                       m_inverseMass;
00040     float                       m_area;
00041     int                         m_attach;
00042     int                         m_pad;
00043 };
00044 
00045 struct  SoftBodyLinkData
00046 {
00047     SoftBodyMaterialData    *m_material;
00048     int                     m_nodeIndices[2];           // Node pointers
00049     float                   m_restLength;           // Rest length      
00050     int                     m_bbending;     // Bending link
00051 };
00052 
00053 struct  SoftBodyFaceData
00054 {
00055     btVector3FloatData      m_normal;       // Normal
00056     SoftBodyMaterialData    *m_material;
00057     int                     m_nodeIndices[3];           // Node pointers
00058     float                   m_restArea;         // Rest area
00059 };  
00060 
00061 struct  SoftBodyTetraData
00062 {
00063     btVector3FloatData      m_c0[4];        // gradients
00064     SoftBodyMaterialData    *m_material;
00065     int                     m_nodeIndices[4];           // Node pointers        
00066     float                   m_restVolume;           // Rest volume
00067     float                   m_c1;           // (4*kVST)/(im0+im1+im2+im3)
00068     float                   m_c2;           // m_c1/sum(|g0..3|^2)
00069     int                     m_pad;
00070 };
00071 
00072 struct  SoftRigidAnchorData
00073 {
00074     btMatrix3x3FloatData    m_c0;           // Impulse matrix
00075     btVector3FloatData      m_c1;           // Relative anchor
00076     btVector3FloatData      m_localFrame;       // Anchor position in body space
00077     btRigidBodyData         *m_rigidBody;
00078     int                     m_nodeIndex;            // Node pointer
00079     float                   m_c2;           // ima*dt
00080 };
00081 
00082 
00083 
00084 struct  SoftBodyConfigData
00085 {
00086     int                 m_aeroModel;        // Aerodynamic model (default: V_Point)
00087     float               m_baumgarte;            // Velocities correction factor (Baumgarte)
00088     float               m_damping;          // Damping coefficient [0,1]
00089     float               m_drag;         // Drag coefficient [0,+inf]
00090     float               m_lift;         // Lift coefficient [0,+inf]
00091     float               m_pressure;         // Pressure coefficient [-inf,+inf]
00092     float               m_volume;           // Volume conversation coefficient [0,+inf]
00093     float               m_dynamicFriction;          // Dynamic friction coefficient [0,1]
00094     float               m_poseMatch;            // Pose matching coefficient [0,1]      
00095     float               m_rigidContactHardness;         // Rigid contacts hardness [0,1]
00096     float               m_kineticContactHardness;           // Kinetic contacts hardness [0,1]
00097     float               m_softContactHardness;          // Soft contacts hardness [0,1]
00098     float               m_anchorHardness;           // Anchors hardness [0,1]
00099     float               m_softRigidClusterHardness;     // Soft vs rigid hardness [0,1] (cluster only)
00100     float               m_softKineticClusterHardness;       // Soft vs kinetic hardness [0,1] (cluster only)
00101     float               m_softSoftClusterHardness;      // Soft vs soft hardness [0,1] (cluster only)
00102     float               m_softRigidClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
00103     float               m_softKineticClusterImpulseSplit;   // Soft vs rigid impulse split [0,1] (cluster only)
00104     float               m_softSoftClusterImpulseSplit;  // Soft vs rigid impulse split [0,1] (cluster only)
00105     float               m_maxVolume;        // Maximum volume ratio for pose
00106     float               m_timeScale;        // Time scale
00107     int                 m_velocityIterations;   // Velocities solver iterations
00108     int                 m_positionIterations;   // Positions solver iterations
00109     int                 m_driftIterations;  // Drift solver iterations
00110     int                 m_clusterIterations;    // Cluster solver iterations
00111     int                 m_collisionFlags;   // Collisions flags
00112 };
00113 
00114 struct  SoftBodyPoseData
00115 {
00116     btMatrix3x3FloatData    m_rot;          // Rotation
00117     btMatrix3x3FloatData    m_scale;            // Scale
00118     btMatrix3x3FloatData    m_aqq;          // Base scaling
00119     btVector3FloatData      m_com;          // COM
00120 
00121     btVector3FloatData      *m_positions;           // Reference positions
00122     float                   *m_weights; // Weights
00123     int                     m_numPositions;
00124     int                     m_numWeigts;
00125 
00126     int                     m_bvolume;      // Is valid
00127     int                     m_bframe;       // Is frame
00128     float                   m_restVolume;       // Rest volume
00129     int                     m_pad;
00130 };
00131 
00132 struct  SoftBodyClusterData
00133 {
00134         btTransformFloatData        m_framexform;
00135         btMatrix3x3FloatData        m_locii;
00136         btMatrix3x3FloatData        m_invwi;
00137         btVector3FloatData          m_com;
00138         btVector3FloatData          m_vimpulses[2];
00139         btVector3FloatData          m_dimpulses[2];
00140         btVector3FloatData          m_lv;
00141         btVector3FloatData          m_av;
00142         
00143         btVector3FloatData          *m_framerefs;
00144         int                         *m_nodeIndices;
00145         float                       *m_masses;
00146 
00147         int                         m_numFrameRefs;
00148         int                         m_numNodes;
00149         int                         m_numMasses;
00150 
00151         float                       m_idmass;
00152         float                       m_imass;
00153         int                         m_nvimpulses;
00154         int                         m_ndimpulses;
00155         float                       m_ndamping;
00156         float                       m_ldamping;
00157         float                       m_adamping;
00158         float                       m_matching;
00159         float                       m_maxSelfCollisionImpulse;
00160         float                       m_selfCollisionImpulseFactor;
00161         int                         m_containsAnchor;
00162         int                         m_collide;
00163         int                         m_clusterIndex;
00164 };
00165 
00166 
00167 enum    btSoftJointBodyType
00168 {
00169     BT_JOINT_SOFT_BODY_CLUSTER=1,
00170     BT_JOINT_RIGID_BODY,
00171     BT_JOINT_COLLISION_OBJECT
00172 };
00173 
00174 struct  btSoftBodyJointData
00175 {
00176     void                        *m_bodyA;
00177     void                        *m_bodyB;
00178     btVector3FloatData          m_refs[2];
00179     float                       m_cfm;
00180     float                       m_erp;
00181     float                       m_split;
00182     int                         m_delete;
00183     btVector3FloatData          m_relPosition[2];//linear
00184     int                         m_bodyAtype;
00185     int                         m_bodyBtype;
00186     int                         m_jointType;
00187     int                         m_pad;
00188 };
00189 
00191 struct  btSoftBodyFloatData
00192 {
00193     btCollisionObjectFloatData  m_collisionObjectData;
00194 
00195     SoftBodyPoseData        *m_pose;
00196     SoftBodyMaterialData    **m_materials;
00197     SoftBodyNodeData        *m_nodes;
00198     SoftBodyLinkData        *m_links;
00199     SoftBodyFaceData        *m_faces;
00200     SoftBodyTetraData       *m_tetrahedra;
00201     SoftRigidAnchorData     *m_anchors;
00202     SoftBodyClusterData     *m_clusters;
00203     btSoftBodyJointData     *m_joints;
00204 
00205     int                     m_numMaterials;
00206     int                     m_numNodes;
00207     int                     m_numLinks;
00208     int                     m_numFaces;
00209     int                     m_numTetrahedra;
00210     int                     m_numAnchors;
00211     int                     m_numClusters;
00212     int                     m_numJoints;
00213     SoftBodyConfigData      m_config;
00214 };
00215 
00216 #endif //BT_SOFTBODY_FLOAT_DATA
00217