fix padding in btSolverConstraint, see Issue 650
fix some warnings
This commit is contained in:
@@ -506,7 +506,7 @@ void btConeTwistConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolver
|
||||
m_accTwistLimitImpulse = btMax(m_accTwistLimitImpulse + impulseMag, btScalar(0.0) );
|
||||
impulseMag = m_accTwistLimitImpulse - temp;
|
||||
|
||||
btVector3 impulse = m_twistAxis * impulseMag;
|
||||
// btVector3 impulse = m_twistAxis * impulseMag;
|
||||
|
||||
bodyA.internalApplyImpulse(btVector3(0,0,0), m_rbA.getInvInertiaTensorWorld()*m_twistAxis,impulseMag);
|
||||
bodyB.internalApplyImpulse(btVector3(0,0,0), m_rbB.getInvInertiaTensorWorld()*m_twistAxis,-impulseMag);
|
||||
@@ -828,12 +828,11 @@ void btConeTwistConstraint::computeConeLimitInfo(const btQuaternion& qCone,
|
||||
{
|
||||
vSwingAxis = btVector3(qCone.x(), qCone.y(), qCone.z());
|
||||
vSwingAxis.normalize();
|
||||
if (fabs(vSwingAxis.x()) > SIMD_EPSILON)
|
||||
{
|
||||
// non-zero twist?! this should never happen.
|
||||
int wtf = 0; wtf = wtf;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// non-zero twist?! this should never happen.
|
||||
btAssert(fabs(vSwingAxis.x()) <= SIMD_EPSILON));
|
||||
#endif
|
||||
|
||||
// Compute limit for given swing. tricky:
|
||||
// Given a swing axis, we're looking for the intersection with the bounding cone ellipse.
|
||||
// (Since we're dealing with angles, this ellipse is embedded on the surface of a sphere.)
|
||||
@@ -877,8 +876,10 @@ void btConeTwistConstraint::computeConeLimitInfo(const btQuaternion& qCone,
|
||||
else if (swingAngle < 0)
|
||||
{
|
||||
// this should never happen!
|
||||
int wtf = 0; wtf = wtf;
|
||||
}
|
||||
#if 0
|
||||
btAssert(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
btVector3 btConeTwistConstraint::GetPointForAngle(btScalar fAngleInRadians, btScalar fLength) const
|
||||
@@ -929,7 +930,9 @@ void btConeTwistConstraint::computeTwistLimitInfo(const btQuaternion& qTwist,
|
||||
if (twistAngle < 0)
|
||||
{
|
||||
// this should never happen
|
||||
int wtf = 0; wtf = wtf;
|
||||
#if 0
|
||||
btAssert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
vTwistAxis = btVector3(qMinTwist.x(), qMinTwist.y(), qMinTwist.z());
|
||||
@@ -976,10 +979,10 @@ void btConeTwistConstraint::setMotorTarget(const btQuaternion &q)
|
||||
{
|
||||
btTransform trACur = m_rbA.getCenterOfMassTransform();
|
||||
btTransform trBCur = m_rbB.getCenterOfMassTransform();
|
||||
btTransform trABCur = trBCur.inverse() * trACur;
|
||||
btQuaternion qABCur = trABCur.getRotation();
|
||||
btTransform trConstraintCur = (trBCur * m_rbBFrame).inverse() * (trACur * m_rbAFrame);
|
||||
btQuaternion qConstraintCur = trConstraintCur.getRotation();
|
||||
// btTransform trABCur = trBCur.inverse() * trACur;
|
||||
// btQuaternion qABCur = trABCur.getRotation();
|
||||
// btTransform trConstraintCur = (trBCur * m_rbBFrame).inverse() * (trACur * m_rbAFrame);
|
||||
//btQuaternion qConstraintCur = trConstraintCur.getRotation();
|
||||
|
||||
btQuaternion qConstraint = m_rbBFrame.getRotation().inverse() * q * m_rbAFrame.getRotation();
|
||||
setMotorTargetInConstraintSpace(qConstraint);
|
||||
|
||||
@@ -144,6 +144,7 @@ public:
|
||||
|
||||
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep);
|
||||
|
||||
|
||||
void updateRHS(btScalar timeStep);
|
||||
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ void btGeneric6DofSpringConstraint::internalUpdateSprings(btConstraintInfo2* inf
|
||||
{
|
||||
// it is assumed that calculateTransforms() have been called before this call
|
||||
int i;
|
||||
btVector3 relVel = m_rbB.getLinearVelocity() - m_rbA.getLinearVelocity();
|
||||
//btVector3 relVel = m_rbB.getLinearVelocity() - m_rbA.getLinearVelocity();
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
if(m_springEnabled[i])
|
||||
|
||||
@@ -702,8 +702,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info
|
||||
btTransform trA = transA*m_rbAFrame;
|
||||
btTransform trB = transB*m_rbBFrame;
|
||||
// pivot point
|
||||
btVector3 pivotAInW = trA.getOrigin();
|
||||
btVector3 pivotBInW = trB.getOrigin();
|
||||
// btVector3 pivotAInW = trA.getOrigin();
|
||||
// btVector3 pivotBInW = trB.getOrigin();
|
||||
#if 1
|
||||
// difference between frames in WCS
|
||||
btVector3 ofs = trB.getOrigin() - trA.getOrigin();
|
||||
|
||||
@@ -124,7 +124,7 @@ void btPoint2PointConstraint::getInfo2NonVirtual (btConstraintInfo2* info, const
|
||||
btVector3 a2 = body1_trans.getBasis()*getPivotInB();
|
||||
|
||||
{
|
||||
btVector3 a2n = -a2;
|
||||
// btVector3 a2n = -a2;
|
||||
btVector3* angular0 = (btVector3*)(info->m_J2angularAxis);
|
||||
btVector3* angular1 = (btVector3*)(info->m_J2angularAxis+info->rowskip);
|
||||
btVector3* angular2 = (btVector3*)(info->m_J2angularAxis+2*info->rowskip);
|
||||
|
||||
@@ -677,8 +677,8 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
|
||||
int solverBodyIdA = getOrInitSolverBody(*colObj0);
|
||||
int solverBodyIdB = getOrInitSolverBody(*colObj1);
|
||||
|
||||
btRigidBody* bodyA = btRigidBody::upcast(colObj0);
|
||||
btRigidBody* bodyB = btRigidBody::upcast(colObj1);
|
||||
// btRigidBody* bodyA = btRigidBody::upcast(colObj0);
|
||||
// btRigidBody* bodyB = btRigidBody::upcast(colObj1);
|
||||
|
||||
btSolverBody* solverBodyA = &m_tmpSolverBodyPool[solverBodyIdA];
|
||||
btSolverBody* solverBodyB = &m_tmpSolverBodyPool[solverBodyIdB];
|
||||
@@ -686,7 +686,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
|
||||
|
||||
|
||||
///avoid collision response between two static objects
|
||||
if (!solverBodyA || !solverBodyA->m_originalBody && (!solverBodyB || !solverBodyB->m_originalBody))
|
||||
if (!solverBodyA || (!solverBodyA->m_originalBody && (!solverBodyB || !solverBodyB->m_originalBody)))
|
||||
return;
|
||||
|
||||
for (int j=0;j<manifold->getNumContacts();j++)
|
||||
@@ -704,8 +704,8 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m
|
||||
|
||||
int frictionIndex = m_tmpSolverContactConstraintPool.size();
|
||||
btSolverConstraint& solverConstraint = m_tmpSolverContactConstraintPool.expandNonInitializing();
|
||||
btRigidBody* rb0 = btRigidBody::upcast(colObj0);
|
||||
btRigidBody* rb1 = btRigidBody::upcast(colObj1);
|
||||
// btRigidBody* rb0 = btRigidBody::upcast(colObj0);
|
||||
// btRigidBody* rb1 = btRigidBody::upcast(colObj1);
|
||||
solverConstraint.m_solverBodyIdA = solverBodyIdA;
|
||||
solverConstraint.m_solverBodyIdB = solverBodyIdB;
|
||||
|
||||
@@ -908,7 +908,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
|
||||
info2.m_J2angularAxis = currentConstraintRow->m_relpos2CrossNormal;
|
||||
info2.rowskip = sizeof(btSolverConstraint)/sizeof(btScalar);//check this
|
||||
///the size of btSolverConstraint needs be a multiple of btScalar
|
||||
btAssert(info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint));
|
||||
btAssert(info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint));
|
||||
info2.m_constraintError = ¤tConstraintRow->m_rhs;
|
||||
currentConstraintRow->m_cfm = infoGlobal.m_globalCfm;
|
||||
info2.m_damping = infoGlobal.m_damping;
|
||||
@@ -997,7 +997,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
|
||||
}
|
||||
}
|
||||
|
||||
btContactSolverInfo info = infoGlobal;
|
||||
// btContactSolverInfo info = infoGlobal;
|
||||
|
||||
|
||||
int numNonContactPool = m_tmpSolverNonContactConstraintPool.size();
|
||||
|
||||
@@ -275,7 +275,7 @@ ATTRIBUTE_ALIGNED64 (struct) btSolverBody
|
||||
btTransform newTransform;
|
||||
if (m_pushVelocity[0]!=0.f || m_pushVelocity[1]!=0 || m_pushVelocity[2]!=0 || m_turnVelocity[0]!=0.f || m_turnVelocity[1]!=0 || m_turnVelocity[2]!=0)
|
||||
{
|
||||
btQuaternion orn = m_worldTransform.getRotation();
|
||||
// btQuaternion orn = m_worldTransform.getRotation();
|
||||
btTransformUtil::integrateTransform(m_worldTransform,m_pushVelocity,m_turnVelocity*splitImpulseTurnErp,timeStep,newTransform);
|
||||
m_worldTransform = newTransform;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class btRigidBody;
|
||||
|
||||
|
||||
///1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and friction constraints.
|
||||
ATTRIBUTE_ALIGNED64 (struct) btSolverConstraint
|
||||
ATTRIBUTE_ALIGNED16 (struct) btSolverConstraint
|
||||
{
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
@@ -42,41 +42,27 @@ ATTRIBUTE_ALIGNED64 (struct) btSolverConstraint
|
||||
|
||||
mutable btSimdScalar m_appliedPushImpulse;
|
||||
mutable btSimdScalar m_appliedImpulse;
|
||||
|
||||
|
||||
|
||||
btScalar m_friction;
|
||||
btScalar m_jacDiagABInv;
|
||||
union
|
||||
{
|
||||
int m_numConsecutiveRowsPerKernel;
|
||||
btScalar m_unusedPadding0;
|
||||
};
|
||||
|
||||
int m_overrideNumSolverIterations;
|
||||
|
||||
union
|
||||
{
|
||||
int m_frictionIndex;
|
||||
btScalar m_unusedPadding1;
|
||||
};
|
||||
btScalar m_rhs;
|
||||
btScalar m_cfm;
|
||||
|
||||
int m_solverBodyIdA;
|
||||
|
||||
int m_solverBodyIdB;
|
||||
|
||||
union
|
||||
btScalar m_lowerLimit;
|
||||
btScalar m_upperLimit;
|
||||
btScalar m_rhsPenetration;
|
||||
union
|
||||
{
|
||||
void* m_originalContactPoint;
|
||||
btScalar m_unusedPadding4;
|
||||
};
|
||||
|
||||
btScalar m_rhs;
|
||||
btScalar m_cfm;
|
||||
btScalar m_lowerLimit;
|
||||
btScalar m_upperLimit;
|
||||
|
||||
btScalar m_rhsPenetration;
|
||||
int m_overrideNumSolverIterations;
|
||||
int m_frictionIndex;
|
||||
int m_solverBodyIdA;
|
||||
int m_solverBodyIdB;
|
||||
|
||||
|
||||
enum btSolverConstraintType
|
||||
{
|
||||
BT_SOLVER_CONTACT_1D = 0,
|
||||
|
||||
Reference in New Issue
Block a user