Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletSoftBody/btSoftBodyData.h
| Show All 13 Lines | |||||
| */ | */ | ||||
| #ifndef BT_SOFTBODY_FLOAT_DATA | #ifndef BT_SOFTBODY_FLOAT_DATA | ||||
| #define BT_SOFTBODY_FLOAT_DATA | #define BT_SOFTBODY_FLOAT_DATA | ||||
| #include "BulletCollision/CollisionDispatch/btCollisionObject.h" | #include "BulletCollision/CollisionDispatch/btCollisionObject.h" | ||||
| #include "BulletDynamics/Dynamics/btRigidBody.h" | #include "BulletDynamics/Dynamics/btRigidBody.h" | ||||
| struct SoftBodyMaterialData | struct SoftBodyMaterialData | ||||
| { | { | ||||
| float m_linearStiffness; | float m_linearStiffness; | ||||
| float m_angularStiffness; | float m_angularStiffness; | ||||
| float m_volumeStiffness; | float m_volumeStiffness; | ||||
| int m_flags; | int m_flags; | ||||
| }; | }; | ||||
| struct SoftBodyNodeData | struct SoftBodyNodeData | ||||
| { | { | ||||
| SoftBodyMaterialData *m_material; | SoftBodyMaterialData *m_material; | ||||
| btVector3FloatData m_position; | btVector3FloatData m_position; | ||||
| btVector3FloatData m_previousPosition; | btVector3FloatData m_previousPosition; | ||||
| btVector3FloatData m_velocity; | btVector3FloatData m_velocity; | ||||
| btVector3FloatData m_accumulatedForce; | btVector3FloatData m_accumulatedForce; | ||||
| btVector3FloatData m_normal; | btVector3FloatData m_normal; | ||||
| float m_inverseMass; | float m_inverseMass; | ||||
| float m_area; | float m_area; | ||||
| int m_attach; | int m_attach; | ||||
| int m_pad; | int m_pad; | ||||
| }; | }; | ||||
| struct SoftBodyLinkData | struct SoftBodyLinkData | ||||
| { | { | ||||
| SoftBodyMaterialData *m_material; | SoftBodyMaterialData *m_material; | ||||
| int m_nodeIndices[2]; // Node pointers | int m_nodeIndices[2]; // Node pointers | ||||
| float m_restLength; // Rest length | float m_restLength; // Rest length | ||||
| int m_bbending; // Bending link | int m_bbending; // Bending link | ||||
| }; | }; | ||||
| struct SoftBodyFaceData | struct SoftBodyFaceData | ||||
| { | { | ||||
| btVector3FloatData m_normal; // Normal | btVector3FloatData m_normal; // Normal | ||||
| SoftBodyMaterialData *m_material; | SoftBodyMaterialData *m_material; | ||||
| int m_nodeIndices[3]; // Node pointers | int m_nodeIndices[3]; // Node pointers | ||||
| float m_restArea; // Rest area | float m_restArea; // Rest area | ||||
| }; | }; | ||||
| struct SoftBodyTetraData | struct SoftBodyTetraData | ||||
| { | { | ||||
| btVector3FloatData m_c0[4]; // gradients | btVector3FloatData m_c0[4]; // gradients | ||||
| SoftBodyMaterialData *m_material; | SoftBodyMaterialData *m_material; | ||||
| int m_nodeIndices[4]; // Node pointers | int m_nodeIndices[4]; // Node pointers | ||||
| float m_restVolume; // Rest volume | float m_restVolume; // Rest volume | ||||
| float m_c1; // (4*kVST)/(im0+im1+im2+im3) | float m_c1; // (4*kVST)/(im0+im1+im2+im3) | ||||
| float m_c2; // m_c1/sum(|g0..3|^2) | float m_c2; // m_c1/sum(|g0..3|^2) | ||||
| int m_pad; | int m_pad; | ||||
| }; | }; | ||||
| struct SoftRigidAnchorData | struct SoftRigidAnchorData | ||||
| { | { | ||||
| btMatrix3x3FloatData m_c0; // Impulse matrix | btMatrix3x3FloatData m_c0; // Impulse matrix | ||||
| btVector3FloatData m_c1; // Relative anchor | btVector3FloatData m_c1; // Relative anchor | ||||
| btVector3FloatData m_localFrame; // Anchor position in body space | btVector3FloatData m_localFrame; // Anchor position in body space | ||||
| btRigidBodyData *m_rigidBody; | btRigidBodyData *m_rigidBody; | ||||
| int m_nodeIndex; // Node pointer | int m_nodeIndex; // Node pointer | ||||
| float m_c2; // ima*dt | float m_c2; // ima*dt | ||||
| }; | }; | ||||
| struct SoftBodyConfigData | struct SoftBodyConfigData | ||||
| { | { | ||||
| int m_aeroModel; // Aerodynamic model (default: V_Point) | int m_aeroModel; // Aerodynamic model (default: V_Point) | ||||
| float m_baumgarte; // Velocities correction factor (Baumgarte) | float m_baumgarte; // Velocities correction factor (Baumgarte) | ||||
| float m_damping; // Damping coefficient [0,1] | float m_damping; // Damping coefficient [0,1] | ||||
| float m_drag; // Drag coefficient [0,+inf] | float m_drag; // Drag coefficient [0,+inf] | ||||
| float m_lift; // Lift coefficient [0,+inf] | float m_lift; // Lift coefficient [0,+inf] | ||||
| float m_pressure; // Pressure coefficient [-inf,+inf] | float m_pressure; // Pressure coefficient [-inf,+inf] | ||||
| float m_volume; // Volume conversation coefficient [0,+inf] | float m_volume; // Volume conversation coefficient [0,+inf] | ||||
| float m_dynamicFriction; // Dynamic friction coefficient [0,1] | float m_dynamicFriction; // Dynamic friction coefficient [0,1] | ||||
| float m_poseMatch; // Pose matching coefficient [0,1] | float m_poseMatch; // Pose matching coefficient [0,1] | ||||
| float m_rigidContactHardness; // Rigid contacts hardness [0,1] | float m_rigidContactHardness; // Rigid contacts hardness [0,1] | ||||
| float m_kineticContactHardness; // Kinetic contacts hardness [0,1] | float m_kineticContactHardness; // Kinetic contacts hardness [0,1] | ||||
| float m_softContactHardness; // Soft contacts hardness [0,1] | float m_softContactHardness; // Soft contacts hardness [0,1] | ||||
| float m_anchorHardness; // Anchors hardness [0,1] | float m_anchorHardness; // Anchors hardness [0,1] | ||||
| float m_softRigidClusterHardness; // Soft vs rigid hardness [0,1] (cluster only) | float m_softRigidClusterHardness; // Soft vs rigid hardness [0,1] (cluster only) | ||||
| float m_softKineticClusterHardness; // Soft vs kinetic hardness [0,1] (cluster only) | float m_softKineticClusterHardness; // Soft vs kinetic hardness [0,1] (cluster only) | ||||
| float m_softSoftClusterHardness; // Soft vs soft hardness [0,1] (cluster only) | float m_softSoftClusterHardness; // Soft vs soft hardness [0,1] (cluster only) | ||||
| float m_softRigidClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only) | float m_softRigidClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only) | ||||
| float m_softKineticClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only) | float m_softKineticClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only) | ||||
| float m_softSoftClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only) | float m_softSoftClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only) | ||||
| float m_maxVolume; // Maximum volume ratio for pose | float m_maxVolume; // Maximum volume ratio for pose | ||||
| float m_timeScale; // Time scale | float m_timeScale; // Time scale | ||||
| int m_velocityIterations; // Velocities solver iterations | int m_velocityIterations; // Velocities solver iterations | ||||
| int m_positionIterations; // Positions solver iterations | int m_positionIterations; // Positions solver iterations | ||||
| int m_driftIterations; // Drift solver iterations | int m_driftIterations; // Drift solver iterations | ||||
| int m_clusterIterations; // Cluster solver iterations | int m_clusterIterations; // Cluster solver iterations | ||||
| int m_collisionFlags; // Collisions flags | int m_collisionFlags; // Collisions flags | ||||
| }; | }; | ||||
| struct SoftBodyPoseData | struct SoftBodyPoseData | ||||
| { | { | ||||
| btMatrix3x3FloatData m_rot; // Rotation | btMatrix3x3FloatData m_rot; // Rotation | ||||
| btMatrix3x3FloatData m_scale; // Scale | btMatrix3x3FloatData m_scale; // Scale | ||||
| btMatrix3x3FloatData m_aqq; // Base scaling | btMatrix3x3FloatData m_aqq; // Base scaling | ||||
| btVector3FloatData m_com; // COM | btVector3FloatData m_com; // COM | ||||
| btVector3FloatData *m_positions; // Reference positions | btVector3FloatData *m_positions; // Reference positions | ||||
| float *m_weights; // Weights | float *m_weights; // Weights | ||||
| int m_numPositions; | int m_numPositions; | ||||
| int m_numWeigts; | int m_numWeigts; | ||||
| int m_bvolume; // Is valid | int m_bvolume; // Is valid | ||||
| int m_bframe; // Is frame | int m_bframe; // Is frame | ||||
| float m_restVolume; // Rest volume | float m_restVolume; // Rest volume | ||||
| int m_pad; | int m_pad; | ||||
| }; | }; | ||||
| struct SoftBodyClusterData | struct SoftBodyClusterData | ||||
| { | { | ||||
| btTransformFloatData m_framexform; | btTransformFloatData m_framexform; | ||||
| btMatrix3x3FloatData m_locii; | btMatrix3x3FloatData m_locii; | ||||
| btMatrix3x3FloatData m_invwi; | btMatrix3x3FloatData m_invwi; | ||||
| btVector3FloatData m_com; | btVector3FloatData m_com; | ||||
| btVector3FloatData m_vimpulses[2]; | btVector3FloatData m_vimpulses[2]; | ||||
| btVector3FloatData m_dimpulses[2]; | btVector3FloatData m_dimpulses[2]; | ||||
| btVector3FloatData m_lv; | btVector3FloatData m_lv; | ||||
| btVector3FloatData m_av; | btVector3FloatData m_av; | ||||
| btVector3FloatData *m_framerefs; | btVector3FloatData *m_framerefs; | ||||
| int *m_nodeIndices; | int *m_nodeIndices; | ||||
| float *m_masses; | float *m_masses; | ||||
| int m_numFrameRefs; | int m_numFrameRefs; | ||||
| int m_numNodes; | int m_numNodes; | ||||
| int m_numMasses; | int m_numMasses; | ||||
| float m_idmass; | float m_idmass; | ||||
| float m_imass; | float m_imass; | ||||
| int m_nvimpulses; | int m_nvimpulses; | ||||
| int m_ndimpulses; | int m_ndimpulses; | ||||
| float m_ndamping; | float m_ndamping; | ||||
| float m_ldamping; | float m_ldamping; | ||||
| float m_adamping; | float m_adamping; | ||||
| float m_matching; | float m_matching; | ||||
| float m_maxSelfCollisionImpulse; | float m_maxSelfCollisionImpulse; | ||||
| float m_selfCollisionImpulseFactor; | float m_selfCollisionImpulseFactor; | ||||
| int m_containsAnchor; | int m_containsAnchor; | ||||
| int m_collide; | int m_collide; | ||||
| int m_clusterIndex; | int m_clusterIndex; | ||||
| }; | }; | ||||
| enum btSoftJointBodyType | enum btSoftJointBodyType | ||||
| { | { | ||||
| BT_JOINT_SOFT_BODY_CLUSTER=1, | BT_JOINT_SOFT_BODY_CLUSTER = 1, | ||||
| BT_JOINT_RIGID_BODY, | BT_JOINT_RIGID_BODY, | ||||
| BT_JOINT_COLLISION_OBJECT | BT_JOINT_COLLISION_OBJECT | ||||
| }; | }; | ||||
| struct btSoftBodyJointData | struct btSoftBodyJointData | ||||
| { | { | ||||
| void *m_bodyA; | void *m_bodyA; | ||||
| void *m_bodyB; | void *m_bodyB; | ||||
| btVector3FloatData m_refs[2]; | btVector3FloatData m_refs[2]; | ||||
| float m_cfm; | float m_cfm; | ||||
| float m_erp; | float m_erp; | ||||
| float m_split; | float m_split; | ||||
| int m_delete; | int m_delete; | ||||
| btVector3FloatData m_relPosition[2];//linear | btVector3FloatData m_relPosition[2]; //linear | ||||
| int m_bodyAtype; | int m_bodyAtype; | ||||
| int m_bodyBtype; | int m_bodyBtype; | ||||
| int m_jointType; | int m_jointType; | ||||
| int m_pad; | int m_pad; | ||||
| }; | }; | ||||
| ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 | ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 | ||||
| struct btSoftBodyFloatData | struct btSoftBodyFloatData | ||||
| { | { | ||||
| btCollisionObjectFloatData m_collisionObjectData; | btCollisionObjectFloatData m_collisionObjectData; | ||||
| SoftBodyPoseData *m_pose; | SoftBodyPoseData *m_pose; | ||||
| SoftBodyMaterialData **m_materials; | SoftBodyMaterialData **m_materials; | ||||
| SoftBodyNodeData *m_nodes; | SoftBodyNodeData *m_nodes; | ||||
| SoftBodyLinkData *m_links; | SoftBodyLinkData *m_links; | ||||
| SoftBodyFaceData *m_faces; | SoftBodyFaceData *m_faces; | ||||
| SoftBodyTetraData *m_tetrahedra; | SoftBodyTetraData *m_tetrahedra; | ||||
| SoftRigidAnchorData *m_anchors; | SoftRigidAnchorData *m_anchors; | ||||
| SoftBodyClusterData *m_clusters; | SoftBodyClusterData *m_clusters; | ||||
| btSoftBodyJointData *m_joints; | btSoftBodyJointData *m_joints; | ||||
| int m_numMaterials; | int m_numMaterials; | ||||
| int m_numNodes; | int m_numNodes; | ||||
| int m_numLinks; | int m_numLinks; | ||||
| int m_numFaces; | int m_numFaces; | ||||
| int m_numTetrahedra; | int m_numTetrahedra; | ||||
| int m_numAnchors; | int m_numAnchors; | ||||
| int m_numClusters; | int m_numClusters; | ||||
| int m_numJoints; | int m_numJoints; | ||||
| SoftBodyConfigData m_config; | SoftBodyConfigData m_config; | ||||
| }; | }; | ||||
| #endif //BT_SOFTBODY_FLOAT_DATA | #endif //BT_SOFTBODY_FLOAT_DATA | ||||