fix Linux version of ConstraintDemo
This commit is contained in:
@@ -40,9 +40,10 @@ B3_ATTRIBUTE_ALIGNED16 (struct) b3SolverConstraint
|
||||
b3Vector3 m_angularComponentA;
|
||||
b3Vector3 m_angularComponentB;
|
||||
|
||||
mutable b3SimdScalar m_appliedPushImpulse;
|
||||
mutable b3SimdScalar m_appliedImpulse;
|
||||
|
||||
mutable b3Scalar m_appliedPushImpulse;
|
||||
mutable b3Scalar m_appliedImpulse;
|
||||
int m_padding1;
|
||||
int m_padding2;
|
||||
b3Scalar m_friction;
|
||||
b3Scalar m_jacDiagABInv;
|
||||
b3Scalar m_rhs;
|
||||
|
||||
@@ -133,9 +133,10 @@ typedef struct
|
||||
float4 m_angularComponentA;
|
||||
float4 m_angularComponentB;
|
||||
|
||||
float4 m_appliedPushImpulse;
|
||||
float4 m_appliedImpulse;
|
||||
|
||||
float m_appliedPushImpulse;
|
||||
float m_appliedImpulse;
|
||||
int m_padding1;
|
||||
int m_padding2;
|
||||
float m_friction;
|
||||
float m_jacDiagABInv;
|
||||
float m_rhs;
|
||||
@@ -272,27 +273,27 @@ __inline void internalApplyImpulse(__global b3GpuSolverBody* body, float4 linea
|
||||
|
||||
void resolveSingleConstraintRowGeneric(__global b3GpuSolverBody* body1, __global b3GpuSolverBody* body2, __global b3SolverConstraint* c)
|
||||
{
|
||||
float deltaImpulse = c->m_rhs-c->m_appliedImpulse.x*c->m_cfm;
|
||||
float deltaImpulse = c->m_rhs-c->m_appliedImpulse*c->m_cfm;
|
||||
float deltaVel1Dotn = dot3F4(c->m_contactNormal,body1->m_deltaLinearVelocity) + dot3F4(c->m_relpos1CrossNormal,body1->m_deltaAngularVelocity);
|
||||
float deltaVel2Dotn = -dot3F4(c->m_contactNormal,body2->m_deltaLinearVelocity) + dot3F4(c->m_relpos2CrossNormal,body2->m_deltaAngularVelocity);
|
||||
|
||||
deltaImpulse -= deltaVel1Dotn*c->m_jacDiagABInv;
|
||||
deltaImpulse -= deltaVel2Dotn*c->m_jacDiagABInv;
|
||||
|
||||
float sum = c->m_appliedImpulse.x + deltaImpulse;
|
||||
float sum = c->m_appliedImpulse + deltaImpulse;
|
||||
if (sum < c->m_lowerLimit)
|
||||
{
|
||||
deltaImpulse = c->m_lowerLimit-c->m_appliedImpulse.x;
|
||||
c->m_appliedImpulse.x = c->m_lowerLimit;
|
||||
deltaImpulse = c->m_lowerLimit-c->m_appliedImpulse;
|
||||
c->m_appliedImpulse = c->m_lowerLimit;
|
||||
}
|
||||
else if (sum > c->m_upperLimit)
|
||||
{
|
||||
deltaImpulse = c->m_upperLimit-c->m_appliedImpulse.x;
|
||||
c->m_appliedImpulse.x = c->m_upperLimit;
|
||||
deltaImpulse = c->m_upperLimit-c->m_appliedImpulse;
|
||||
c->m_appliedImpulse = c->m_upperLimit;
|
||||
}
|
||||
else
|
||||
{
|
||||
c->m_appliedImpulse.x = sum;
|
||||
c->m_appliedImpulse = sum;
|
||||
}
|
||||
|
||||
internalApplyImpulse(body1,c->m_contactNormal*body1->m_invMass,c->m_angularComponentA,deltaImpulse);
|
||||
@@ -730,4 +731,4 @@ __kernel void getInfo2Kernel(__global b3SolverConstraint* solverConstraintRows,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,9 +135,10 @@ static const char* solveConstraintRowsCL= \
|
||||
" float4 m_angularComponentA;\n"
|
||||
" float4 m_angularComponentB;\n"
|
||||
" \n"
|
||||
" float4 m_appliedPushImpulse;\n"
|
||||
" float4 m_appliedImpulse;\n"
|
||||
"\n"
|
||||
" float m_appliedPushImpulse;\n"
|
||||
" float m_appliedImpulse;\n"
|
||||
" int m_padding1;\n"
|
||||
" int m_padding2;\n"
|
||||
" float m_friction;\n"
|
||||
" float m_jacDiagABInv;\n"
|
||||
" float m_rhs;\n"
|
||||
@@ -274,27 +275,27 @@ static const char* solveConstraintRowsCL= \
|
||||
"\n"
|
||||
"void resolveSingleConstraintRowGeneric(__global b3GpuSolverBody* body1, __global b3GpuSolverBody* body2, __global b3SolverConstraint* c)\n"
|
||||
"{\n"
|
||||
" float deltaImpulse = c->m_rhs-c->m_appliedImpulse.x*c->m_cfm;\n"
|
||||
" float deltaImpulse = c->m_rhs-c->m_appliedImpulse*c->m_cfm;\n"
|
||||
" float deltaVel1Dotn = dot3F4(c->m_contactNormal,body1->m_deltaLinearVelocity) + dot3F4(c->m_relpos1CrossNormal,body1->m_deltaAngularVelocity);\n"
|
||||
" float deltaVel2Dotn = -dot3F4(c->m_contactNormal,body2->m_deltaLinearVelocity) + dot3F4(c->m_relpos2CrossNormal,body2->m_deltaAngularVelocity);\n"
|
||||
"\n"
|
||||
" deltaImpulse -= deltaVel1Dotn*c->m_jacDiagABInv;\n"
|
||||
" deltaImpulse -= deltaVel2Dotn*c->m_jacDiagABInv;\n"
|
||||
"\n"
|
||||
" float sum = c->m_appliedImpulse.x + deltaImpulse;\n"
|
||||
" float sum = c->m_appliedImpulse + deltaImpulse;\n"
|
||||
" if (sum < c->m_lowerLimit)\n"
|
||||
" {\n"
|
||||
" deltaImpulse = c->m_lowerLimit-c->m_appliedImpulse.x;\n"
|
||||
" c->m_appliedImpulse.x = c->m_lowerLimit;\n"
|
||||
" deltaImpulse = c->m_lowerLimit-c->m_appliedImpulse;\n"
|
||||
" c->m_appliedImpulse = c->m_lowerLimit;\n"
|
||||
" }\n"
|
||||
" else if (sum > c->m_upperLimit) \n"
|
||||
" {\n"
|
||||
" deltaImpulse = c->m_upperLimit-c->m_appliedImpulse.x;\n"
|
||||
" c->m_appliedImpulse.x = c->m_upperLimit;\n"
|
||||
" deltaImpulse = c->m_upperLimit-c->m_appliedImpulse;\n"
|
||||
" c->m_appliedImpulse = c->m_upperLimit;\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" c->m_appliedImpulse.x = sum;\n"
|
||||
" c->m_appliedImpulse = sum;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" internalApplyImpulse(body1,c->m_contactNormal*body1->m_invMass,c->m_angularComponentA,deltaImpulse);\n"
|
||||
@@ -733,4 +734,5 @@ static const char* solveConstraintRowsCL= \
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
|
||||
static const char* solverUtilsCL= \
|
||||
"/*\n"
|
||||
"Copyright (c) 2012 Advanced Micro Devices, Inc. \n"
|
||||
"Copyright (c) 2013 Advanced Micro Devices, Inc. \n"
|
||||
"\n"
|
||||
"This software is provided 'as-is', without any express or implied warranty.\n"
|
||||
"In no event will the authors be held liable for any damages arising from the use of this software.\n"
|
||||
|
||||
Reference in New Issue
Block a user