diff options
Diffstat (limited to 'thirdparty/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h')
-rw-r--r-- | thirdparty/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h | 131 |
1 files changed, 62 insertions, 69 deletions
diff --git a/thirdparty/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h b/thirdparty/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h index 8fa03d719d..4717e19800 100644 --- a/thirdparty/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h +++ b/thirdparty/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h @@ -22,26 +22,24 @@ subject to the following restrictions: class btRigidBody; - #ifdef BT_USE_DOUBLE_PRECISION -#define btPoint2PointConstraintData2 btPoint2PointConstraintDoubleData2 -#define btPoint2PointConstraintDataName "btPoint2PointConstraintDoubleData2" +#define btPoint2PointConstraintData2 btPoint2PointConstraintDoubleData2 +#define btPoint2PointConstraintDataName "btPoint2PointConstraintDoubleData2" #else -#define btPoint2PointConstraintData2 btPoint2PointConstraintFloatData -#define btPoint2PointConstraintDataName "btPoint2PointConstraintFloatData" -#endif //BT_USE_DOUBLE_PRECISION +#define btPoint2PointConstraintData2 btPoint2PointConstraintFloatData +#define btPoint2PointConstraintDataName "btPoint2PointConstraintFloatData" +#endif //BT_USE_DOUBLE_PRECISION -struct btConstraintSetting +struct btConstraintSetting { - btConstraintSetting() : - m_tau(btScalar(0.3)), - m_damping(btScalar(1.)), - m_impulseClamp(btScalar(0.)) + btConstraintSetting() : m_tau(btScalar(0.3)), + m_damping(btScalar(1.)), + m_impulseClamp(btScalar(0.)) { } - btScalar m_tau; - btScalar m_damping; - btScalar m_impulseClamp; + btScalar m_tau; + btScalar m_damping; + btScalar m_impulseClamp; }; enum btPoint2PointFlags @@ -51,52 +49,51 @@ enum btPoint2PointFlags }; /// point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocket' location in local space -ATTRIBUTE_ALIGNED16(class) btPoint2PointConstraint : public btTypedConstraint +ATTRIBUTE_ALIGNED16(class) +btPoint2PointConstraint : public btTypedConstraint { #ifdef IN_PARALLELL_SOLVER public: #endif - btJacobianEntry m_jac[3]; //3 orthogonal linear constraints - - btVector3 m_pivotInA; - btVector3 m_pivotInB; - - int m_flags; - btScalar m_erp; - btScalar m_cfm; - -public: + btJacobianEntry m_jac[3]; //3 orthogonal linear constraints + + btVector3 m_pivotInA; + btVector3 m_pivotInB; + + int m_flags; + btScalar m_erp; + btScalar m_cfm; +public: BT_DECLARE_ALIGNED_ALLOCATOR(); ///for backwards compatibility during the transition to 'getInfo/getInfo2' - bool m_useSolveConstraintObsolete; - - btConstraintSetting m_setting; + bool m_useSolveConstraintObsolete; - btPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB); + btConstraintSetting m_setting; - btPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA); + btPoint2PointConstraint(btRigidBody & rbA, btRigidBody & rbB, const btVector3& pivotInA, const btVector3& pivotInB); + btPoint2PointConstraint(btRigidBody & rbA, const btVector3& pivotInA); - virtual void buildJacobian(); + virtual void buildJacobian(); - virtual void getInfo1 (btConstraintInfo1* info); + virtual void getInfo1(btConstraintInfo1 * info); - void getInfo1NonVirtual (btConstraintInfo1* info); + void getInfo1NonVirtual(btConstraintInfo1 * info); - virtual void getInfo2 (btConstraintInfo2* info); + virtual void getInfo2(btConstraintInfo2 * info); - void getInfo2NonVirtual (btConstraintInfo2* info, const btTransform& body0_trans, const btTransform& body1_trans); + void getInfo2NonVirtual(btConstraintInfo2 * info, const btTransform& body0_trans, const btTransform& body1_trans); - void updateRHS(btScalar timeStep); + void updateRHS(btScalar timeStep); - void setPivotA(const btVector3& pivotA) + void setPivotA(const btVector3& pivotA) { m_pivotInA = pivotA; } - void setPivotB(const btVector3& pivotB) + void setPivotB(const btVector3& pivotB) { m_pivotInB = pivotB; } @@ -111,70 +108,66 @@ public: return m_pivotInB; } - ///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). + ///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). ///If no axis is provided, it uses the default axis for this constraint. - virtual void setParam(int num, btScalar value, int axis = -1); + virtual void setParam(int num, btScalar value, int axis = -1); ///return the local value of parameter - virtual btScalar getParam(int num, int axis = -1) const; - - virtual int getFlags() const + virtual btScalar getParam(int num, int axis = -1) const; + + virtual int getFlags() const { - return m_flags; - } + return m_flags; + } - virtual int calculateSerializeBufferSize() const; + virtual int calculateSerializeBufferSize() const; ///fills the dataBuffer and returns the struct name (and 0 on failure) - virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; - - + virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; }; ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 -struct btPoint2PointConstraintFloatData +struct btPoint2PointConstraintFloatData { - btTypedConstraintData m_typeConstraintData; - btVector3FloatData m_pivotInA; - btVector3FloatData m_pivotInB; + btTypedConstraintData m_typeConstraintData; + btVector3FloatData m_pivotInA; + btVector3FloatData m_pivotInB; }; ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 -struct btPoint2PointConstraintDoubleData2 +struct btPoint2PointConstraintDoubleData2 { - btTypedConstraintDoubleData m_typeConstraintData; - btVector3DoubleData m_pivotInA; - btVector3DoubleData m_pivotInB; + btTypedConstraintDoubleData m_typeConstraintData; + btVector3DoubleData m_pivotInA; + btVector3DoubleData m_pivotInB; }; #ifdef BT_BACKWARDS_COMPATIBLE_SERIALIZATION ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ///this structure is not used, except for loading pre-2.82 .bullet files ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 -struct btPoint2PointConstraintDoubleData +struct btPoint2PointConstraintDoubleData { - btTypedConstraintData m_typeConstraintData; - btVector3DoubleData m_pivotInA; - btVector3DoubleData m_pivotInB; + btTypedConstraintData m_typeConstraintData; + btVector3DoubleData m_pivotInA; + btVector3DoubleData m_pivotInB; }; -#endif //BT_BACKWARDS_COMPATIBLE_SERIALIZATION +#endif //BT_BACKWARDS_COMPATIBLE_SERIALIZATION - -SIMD_FORCE_INLINE int btPoint2PointConstraint::calculateSerializeBufferSize() const +SIMD_FORCE_INLINE int btPoint2PointConstraint::calculateSerializeBufferSize() const { return sizeof(btPoint2PointConstraintData2); - } - ///fills the dataBuffer and returns the struct name (and 0 on failure) -SIMD_FORCE_INLINE const char* btPoint2PointConstraint::serialize(void* dataBuffer, btSerializer* serializer) const +///fills the dataBuffer and returns the struct name (and 0 on failure) +SIMD_FORCE_INLINE const char* btPoint2PointConstraint::serialize(void* dataBuffer, btSerializer* serializer) const { btPoint2PointConstraintData2* p2pData = (btPoint2PointConstraintData2*)dataBuffer; - btTypedConstraint::serialize(&p2pData->m_typeConstraintData,serializer); + btTypedConstraint::serialize(&p2pData->m_typeConstraintData, serializer); m_pivotInA.serialize(p2pData->m_pivotInA); m_pivotInB.serialize(p2pData->m_pivotInB); return btPoint2PointConstraintDataName; } -#endif //BT_POINT2POINTCONSTRAINT_H +#endif //BT_POINT2POINTCONSTRAINT_H |