sync repo
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#include "PhysicsClient.h"
|
||||
|
||||
PhysicsClient::~PhysicsClient() {}
|
||||
PhysicsClient::~PhysicsClient()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -337,13 +337,15 @@ void PhysicsClientExample::prepareAndSubmitCommand(int commandId)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
PhysicsClientExample::PhysicsClientExample(GUIHelperInterface* helper)
|
||||
:SharedMemoryCommon(helper),
|
||||
m_physicsClientHandle(0),
|
||||
m_selectedBody(-1),
|
||||
m_prevSelectedBody(-1),
|
||||
m_wantsTermination(false),
|
||||
m_sharedMemoryKey(SHARED_MEMORY_KEY),
|
||||
m_selectedBody(-1),
|
||||
m_prevSelectedBody(-1),
|
||||
m_numMotors(0)
|
||||
{
|
||||
b3Printf("Started PhysicsClientExample\n");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Win32SharedMemory.h"
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "Bullet3Common/b3Logging.h"
|
||||
#include "../Utils/b3ResourcePath.h"
|
||||
@@ -71,6 +72,15 @@ struct PhysicsClientSharedMemoryInternalData {
|
||||
bool canSubmitCommand() const;
|
||||
};
|
||||
|
||||
static char* strDup(const char* const str)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return _strdup(str);
|
||||
#else
|
||||
return strdup(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
int PhysicsClientSharedMemory::getNumJoints(int bodyIndex) const
|
||||
{
|
||||
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap[bodyIndex];
|
||||
@@ -188,24 +198,24 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
}
|
||||
|
||||
if (serverCmd.m_dataStreamArguments.m_streamChunkLength > 0) {
|
||||
bParse::btBulletFile* bf = new bParse::btBulletFile(
|
||||
bParse::btBulletFile bf(
|
||||
this->m_data->m_testBlock1->m_bulletStreamDataServerToClient,
|
||||
serverCmd.m_dataStreamArguments.m_streamChunkLength);
|
||||
bf->setFileDNAisMemoryDNA();
|
||||
bf->parse(false);
|
||||
bf.setFileDNAisMemoryDNA();
|
||||
bf.parse(false);
|
||||
int bodyIndex = serverCmd.m_dataStreamArguments.m_bodyUniqueId;
|
||||
|
||||
BodyJointInfoCache* bodyJoints = new BodyJointInfoCache;
|
||||
m_data->m_bodyJointMap.insert(bodyIndex,bodyJoints);
|
||||
|
||||
for (int i = 0; i < bf->m_multiBodies.size(); i++) {
|
||||
int flag = bf->getFlags();
|
||||
for (int i = 0; i < bf.m_multiBodies.size(); i++) {
|
||||
int flag = bf.getFlags();
|
||||
int qOffset = 7;
|
||||
int uOffset = 6;
|
||||
|
||||
if ((flag & bParse::FD_DOUBLE_PRECISION) != 0) {
|
||||
Bullet::btMultiBodyDoubleData* mb =
|
||||
(Bullet::btMultiBodyDoubleData*)bf->m_multiBodies[i];
|
||||
(Bullet::btMultiBodyDoubleData*)bf.m_multiBodies[i];
|
||||
if (mb->m_baseName) {
|
||||
if (m_data->m_verboseOutput) {
|
||||
b3Printf("mb->m_baseName = %s\n", mb->m_baseName);
|
||||
@@ -227,14 +237,14 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
b3Printf("mb->m_links[%d].m_linkName = %s\n", link,
|
||||
mb->m_links[link].m_linkName);
|
||||
}
|
||||
info.m_linkName = mb->m_links[link].m_linkName;
|
||||
info.m_linkName = strDup(mb->m_links[link].m_linkName);
|
||||
}
|
||||
if (mb->m_links[link].m_jointName) {
|
||||
if (m_data->m_verboseOutput) {
|
||||
b3Printf("mb->m_links[%d].m_jointName = %s\n", link,
|
||||
mb->m_links[link].m_jointName);
|
||||
}
|
||||
info.m_jointName = mb->m_links[link].m_jointName;
|
||||
info.m_jointName = strDup(mb->m_links[link].m_jointName);
|
||||
}
|
||||
|
||||
info.m_jointType = mb->m_links[link].m_jointType;
|
||||
@@ -251,7 +261,7 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
|
||||
} else {
|
||||
Bullet::btMultiBodyFloatData* mb =
|
||||
(Bullet::btMultiBodyFloatData*)bf->m_multiBodies[i];
|
||||
(Bullet::btMultiBodyFloatData*)bf.m_multiBodies[i];
|
||||
if (mb->m_baseName) {
|
||||
if (m_data->m_verboseOutput) {
|
||||
b3Printf("mb->m_baseName = %s\n", mb->m_baseName);
|
||||
@@ -272,14 +282,14 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
b3Printf("mb->m_links[%d].m_linkName = %s\n", link,
|
||||
mb->m_links[link].m_linkName);
|
||||
}
|
||||
info.m_linkName = mb->m_links[link].m_linkName;
|
||||
info.m_linkName = strDup(mb->m_links[link].m_linkName);
|
||||
}
|
||||
if (mb->m_links[link].m_jointName) {
|
||||
if (m_data->m_verboseOutput) {
|
||||
b3Printf("mb->m_links[%d].m_jointName = %s\n", link,
|
||||
mb->m_links[link].m_jointName);
|
||||
}
|
||||
info.m_jointName = mb->m_links[link].m_jointName;
|
||||
info.m_jointName = strDup(mb->m_links[link].m_jointName);
|
||||
}
|
||||
info.m_jointType = mb->m_links[link].m_jointType;
|
||||
if ((mb->m_links[link].m_jointType == eRevoluteType) ||
|
||||
@@ -293,7 +303,7 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bf->ok()) {
|
||||
if (bf.ok()) {
|
||||
if (m_data->m_verboseOutput) {
|
||||
b3Printf("Received robot description ok!\n");
|
||||
}
|
||||
@@ -401,6 +411,17 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
|
||||
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
||||
if (bodyJointsPtr && *bodyJointsPtr)
|
||||
{
|
||||
BodyJointInfoCache* bodyJoints = *bodyJointsPtr;
|
||||
for (int j=0;j<bodyJoints->m_jointInfo.size();j++) {
|
||||
if (bodyJoints->m_jointInfo[j].m_jointName)
|
||||
{
|
||||
free(bodyJoints->m_jointInfo[j].m_jointName);
|
||||
}
|
||||
if (bodyJoints->m_jointInfo[j].m_linkName)
|
||||
{
|
||||
free(bodyJoints->m_jointInfo[j].m_linkName);
|
||||
}
|
||||
}
|
||||
delete (*bodyJointsPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1196,23 +1196,32 @@ inline void btDbvt::collideOCL( const btDbvtNode* root,
|
||||
|
||||
//void * memmove ( void * destination, const void * source, size_t num );
|
||||
|
||||
//#if DBVT_USE_MEMMOVE
|
||||
// memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
|
||||
//#else
|
||||
for(int k=stack.size()-1;k>j;--k)
|
||||
{
|
||||
#if DBVT_USE_MEMMOVE
|
||||
{
|
||||
int num_items_to_move = stack.size()-1-j;
|
||||
if(num_items_to_move > 0)
|
||||
memmove(&stack[j+1],&stack[j],sizeof(int)*num_items_to_move);
|
||||
}
|
||||
#else
|
||||
for(int k=stack.size()-1;k>j;--k) {
|
||||
stack[k]=stack[k-1];
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
#endif
|
||||
stack[j]=allocate(ifree,stock,nes[q]);
|
||||
/* Insert 1 */
|
||||
j=nearest(&stack[0],&stock[0],nes[1-q].value,j,stack.size());
|
||||
stack.push_back(0);
|
||||
//#if DBVT_USE_MEMMOVE
|
||||
// memmove(&stack[j],&stack[j-1],sizeof(int)*(stack.size()-j-1));
|
||||
//#else
|
||||
for(int k=stack.size()-1;k>j;--k) stack[k]=stack[k-1];
|
||||
//#endif
|
||||
#if DBVT_USE_MEMMOVE
|
||||
{
|
||||
int num_items_to_move = stack.size()-1-j;
|
||||
if(num_items_to_move > 0)
|
||||
memmove(&stack[j+1],&stack[j],sizeof(int)*num_items_to_move);
|
||||
}
|
||||
#else
|
||||
for(int k=stack.size()-1;k>j;--k) {
|
||||
stack[k]=stack[k-1];
|
||||
}
|
||||
#endif
|
||||
stack[j]=allocate(ifree,stock,nes[1-q]);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -196,10 +196,6 @@ public:
|
||||
m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1;
|
||||
m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2;
|
||||
|
||||
m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse;
|
||||
m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1;
|
||||
m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2;
|
||||
|
||||
|
||||
m_pointCache[insertIndex].m_lifeTime = lifeTime;
|
||||
#else
|
||||
|
||||
@@ -294,7 +294,10 @@ bool btVoronoiSimplexSolver::inSimplex(const btVector3& w)
|
||||
#else
|
||||
if (m_simplexVectorW[i] == w)
|
||||
#endif
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//check in case lastW is already removed
|
||||
|
||||
@@ -171,6 +171,11 @@ public:
|
||||
m_angularOnly = angularOnly;
|
||||
}
|
||||
|
||||
bool getAngularOnly() const
|
||||
{
|
||||
return m_angularOnly;
|
||||
}
|
||||
|
||||
void setLimit(int limitIndex,btScalar limitValue)
|
||||
{
|
||||
switch (limitIndex)
|
||||
@@ -196,6 +201,33 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
btScalar getLimit(int limitIndex) const
|
||||
{
|
||||
switch (limitIndex)
|
||||
{
|
||||
case 3:
|
||||
{
|
||||
return m_twistSpan;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
return m_swingSpan2;
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
return m_swingSpan1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
btAssert(0 && "Invalid limitIndex specified for btConeTwistConstraint");
|
||||
return 0.0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// setLimit(), a few notes:
|
||||
// _softness:
|
||||
// 0->1, recommend ~0.8->1.
|
||||
@@ -218,8 +250,8 @@ public:
|
||||
m_relaxationFactor = _relaxationFactor;
|
||||
}
|
||||
|
||||
const btTransform& getAFrame() { return m_rbAFrame; };
|
||||
const btTransform& getBFrame() { return m_rbBFrame; };
|
||||
const btTransform& getAFrame() const { return m_rbAFrame; };
|
||||
const btTransform& getBFrame() const { return m_rbBFrame; };
|
||||
|
||||
inline int getSolveTwistLimit()
|
||||
{
|
||||
@@ -239,27 +271,43 @@ public:
|
||||
void calcAngleInfo();
|
||||
void calcAngleInfo2(const btTransform& transA, const btTransform& transB,const btMatrix3x3& invInertiaWorldA,const btMatrix3x3& invInertiaWorldB);
|
||||
|
||||
inline btScalar getSwingSpan1()
|
||||
inline btScalar getSwingSpan1() const
|
||||
{
|
||||
return m_swingSpan1;
|
||||
}
|
||||
inline btScalar getSwingSpan2()
|
||||
inline btScalar getSwingSpan2() const
|
||||
{
|
||||
return m_swingSpan2;
|
||||
}
|
||||
inline btScalar getTwistSpan()
|
||||
inline btScalar getTwistSpan() const
|
||||
{
|
||||
return m_twistSpan;
|
||||
}
|
||||
inline btScalar getTwistAngle()
|
||||
inline btScalar getLimitSoftness() const
|
||||
{
|
||||
return m_limitSoftness;
|
||||
}
|
||||
inline btScalar getBiasFactor() const
|
||||
{
|
||||
return m_biasFactor;
|
||||
}
|
||||
inline btScalar getRelaxationFactor() const
|
||||
{
|
||||
return m_relaxationFactor;
|
||||
}
|
||||
inline btScalar getTwistAngle() const
|
||||
{
|
||||
return m_twistAngle;
|
||||
}
|
||||
bool isPastSwingLimit() { return m_solveSwingLimit; }
|
||||
|
||||
btScalar getDamping() const { return m_damping; }
|
||||
void setDamping(btScalar damping) { m_damping = damping; }
|
||||
|
||||
void enableMotor(bool b) { m_bMotorEnabled = b; }
|
||||
bool isMotorEnabled() const { return m_bMotorEnabled; }
|
||||
btScalar getMaxMotorImpulse() const { return m_maxMotorImpulse; }
|
||||
bool isMaxMotorImpulseNormalized() const { return m_bNormalizedMotorStrength; }
|
||||
void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = false; }
|
||||
void setMaxMotorImpulseNormalized(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = true; }
|
||||
|
||||
@@ -271,6 +319,7 @@ public:
|
||||
// note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability)
|
||||
// note: don't forget to enableMotor()
|
||||
void setMotorTarget(const btQuaternion &q);
|
||||
const btQuaternion& getMotorTarget() const { return m_qTarget; }
|
||||
|
||||
// same as above, but q is the desired rotation of frameA wrt frameB in constraint space
|
||||
void setMotorTargetInConstraintSpace(const btQuaternion &q);
|
||||
@@ -297,6 +346,11 @@ public:
|
||||
///return the local value of parameter
|
||||
virtual btScalar getParam(int num, int axis = -1) const;
|
||||
|
||||
int getFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
|
||||
@@ -111,14 +111,14 @@ public:
|
||||
|
||||
|
||||
//! Is limited
|
||||
bool isLimited()
|
||||
bool isLimited() const
|
||||
{
|
||||
if(m_loLimit > m_hiLimit) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//! Need apply correction
|
||||
bool needApplyTorques()
|
||||
bool needApplyTorques() const
|
||||
{
|
||||
if(m_currentLimit == 0 && m_enableMotor == false) return false;
|
||||
return true;
|
||||
@@ -207,11 +207,11 @@ public:
|
||||
- limited means upper > lower
|
||||
- limitIndex: first 3 are linear, next 3 are angular
|
||||
*/
|
||||
inline bool isLimited(int limitIndex)
|
||||
inline bool isLimited(int limitIndex) const
|
||||
{
|
||||
return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]);
|
||||
}
|
||||
inline bool needApplyForce(int limitIndex)
|
||||
inline bool needApplyForce(int limitIndex) const
|
||||
{
|
||||
if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == false) return false;
|
||||
return true;
|
||||
@@ -457,7 +457,7 @@ public:
|
||||
m_linearLimits.m_lowerLimit = linearLower;
|
||||
}
|
||||
|
||||
void getLinearLowerLimit(btVector3& linearLower)
|
||||
void getLinearLowerLimit(btVector3& linearLower) const
|
||||
{
|
||||
linearLower = m_linearLimits.m_lowerLimit;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ public:
|
||||
m_linearLimits.m_upperLimit = linearUpper;
|
||||
}
|
||||
|
||||
void getLinearUpperLimit(btVector3& linearUpper)
|
||||
void getLinearUpperLimit(btVector3& linearUpper) const
|
||||
{
|
||||
linearUpper = m_linearLimits.m_upperLimit;
|
||||
}
|
||||
@@ -478,7 +478,7 @@ public:
|
||||
m_angularLimits[i].m_loLimit = btNormalizeAngle(angularLower[i]);
|
||||
}
|
||||
|
||||
void getAngularLowerLimit(btVector3& angularLower)
|
||||
void getAngularLowerLimit(btVector3& angularLower) const
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
angularLower[i] = m_angularLimits[i].m_loLimit;
|
||||
@@ -490,7 +490,7 @@ public:
|
||||
m_angularLimits[i].m_hiLimit = btNormalizeAngle(angularUpper[i]);
|
||||
}
|
||||
|
||||
void getAngularUpperLimit(btVector3& angularUpper)
|
||||
void getAngularUpperLimit(btVector3& angularUpper) const
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
angularUpper[i] = m_angularLimits[i].m_hiLimit;
|
||||
@@ -532,7 +532,7 @@ public:
|
||||
- limited means upper > lower
|
||||
- limitIndex: first 3 are linear, next 3 are angular
|
||||
*/
|
||||
bool isLimited(int limitIndex)
|
||||
bool isLimited(int limitIndex) const
|
||||
{
|
||||
if(limitIndex<3)
|
||||
{
|
||||
@@ -549,9 +549,12 @@ public:
|
||||
btConstraintInfo2 *info, int row, btVector3& ax1, int rotational, int rotAllowed = false);
|
||||
|
||||
// access for UseFrameOffset
|
||||
bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
|
||||
bool getUseFrameOffset() const { return m_useOffsetForConstraintFrame; }
|
||||
void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
|
||||
|
||||
bool getUseLinearReferenceFrameA() const { return m_useLinearReferenceFrameA; }
|
||||
void setUseLinearReferenceFrameA(bool linearReferenceFrameA) { m_useLinearReferenceFrameA = linearReferenceFrameA; }
|
||||
|
||||
///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);
|
||||
@@ -560,6 +563,10 @@ public:
|
||||
|
||||
void setAxis( const btVector3& axis1, const btVector3& axis2);
|
||||
|
||||
virtual int getFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
|
||||
@@ -63,6 +63,26 @@ public:
|
||||
void setEquilibriumPoint(int index); // set the current constraint position/orientation as an equilibrium point for given DOF
|
||||
void setEquilibriumPoint(int index, btScalar val);
|
||||
|
||||
bool isSpringEnabled(int index) const
|
||||
{
|
||||
return m_springEnabled[index];
|
||||
}
|
||||
|
||||
btScalar getStiffness(int index) const
|
||||
{
|
||||
return m_springStiffness[index];
|
||||
}
|
||||
|
||||
btScalar getDamping(int index) const
|
||||
{
|
||||
return m_springDamping[index];
|
||||
}
|
||||
|
||||
btScalar getEquilibriumPoint(int index) const
|
||||
{
|
||||
return m_equilibriumPoint[index];
|
||||
}
|
||||
|
||||
virtual void setAxis( const btVector3& axis1, const btVector3& axis2);
|
||||
|
||||
virtual void getInfo2 (btConstraintInfo2* info);
|
||||
|
||||
@@ -177,6 +177,7 @@ public:
|
||||
// maintain a given angular target.
|
||||
void enableMotor(bool enableMotor) { m_enableAngularMotor = enableMotor; }
|
||||
void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; }
|
||||
void setMotorTargetVelocity(btScalar motorTargetVelocity) { m_motorTargetVelocity = motorTargetVelocity; }
|
||||
void setMotorTarget(const btQuaternion& qAinB, btScalar dt); // qAinB is rotation of body A wrt body B.
|
||||
void setMotorTarget(btScalar targetAngle, btScalar dt);
|
||||
|
||||
@@ -194,6 +195,33 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
btScalar getLimitSoftness() const
|
||||
{
|
||||
#ifdef _BT_USE_CENTER_LIMIT_
|
||||
return m_limit.getSoftness();
|
||||
#else
|
||||
return m_limitSoftness;
|
||||
#endif
|
||||
}
|
||||
|
||||
btScalar getLimitBiasFactor() const
|
||||
{
|
||||
#ifdef _BT_USE_CENTER_LIMIT_
|
||||
return m_limit.getBiasFactor();
|
||||
#else
|
||||
return m_biasFactor;
|
||||
#endif
|
||||
}
|
||||
|
||||
btScalar getLimitRelaxationFactor() const
|
||||
{
|
||||
#ifdef _BT_USE_CENTER_LIMIT_
|
||||
return m_limit.getRelaxationFactor();
|
||||
#else
|
||||
return m_relaxationFactor;
|
||||
#endif
|
||||
}
|
||||
|
||||
void setAxis(btVector3& axisInA)
|
||||
{
|
||||
btVector3 rbAxisA1, rbAxisA2;
|
||||
@@ -297,7 +325,9 @@ public:
|
||||
// access for UseFrameOffset
|
||||
bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
|
||||
void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
|
||||
|
||||
// access for UseReferenceFrameA
|
||||
bool getUseReferenceFrameA() const { return m_useReferenceFrameA; }
|
||||
void setUseReferenceFrameA(bool useReferenceFrameA) { m_useReferenceFrameA = useReferenceFrameA; }
|
||||
|
||||
///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.
|
||||
@@ -305,6 +335,11 @@ public:
|
||||
///return the local value of parameter
|
||||
virtual btScalar getParam(int num, int axis = -1) const;
|
||||
|
||||
virtual int getFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
|
||||
@@ -117,6 +117,11 @@ public:
|
||||
///return the local value of parameter
|
||||
virtual btScalar getParam(int num, int axis = -1) const;
|
||||
|
||||
virtual int getFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
|
||||
@@ -281,6 +281,11 @@ public:
|
||||
///return the local value of parameter
|
||||
virtual btScalar getParam(int num, int axis = -1) const;
|
||||
|
||||
virtual int getFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
|
||||
@@ -92,7 +92,8 @@ btMultiBody::btMultiBody(int n_links,
|
||||
btScalar mass,
|
||||
const btVector3 &inertia,
|
||||
bool fixedBase,
|
||||
bool canSleep)
|
||||
bool canSleep,
|
||||
bool /*deprecatedUseMultiDof*/)
|
||||
:
|
||||
m_baseCollider(0),
|
||||
m_baseName(0),
|
||||
@@ -137,7 +138,7 @@ void btMultiBody::setupFixed(int i,
|
||||
int parent,
|
||||
const btQuaternion &rotParentToThis,
|
||||
const btVector3 &parentComToThisPivotOffset,
|
||||
const btVector3 &thisPivotToThisComOffset)
|
||||
const btVector3 &thisPivotToThisComOffset, bool /*deprecatedDisableParentCollision*/)
|
||||
{
|
||||
|
||||
m_links[i].m_mass = mass;
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
btScalar mass, // mass of base
|
||||
const btVector3 &inertia, // inertia of base, in base frame; assumed diagonal
|
||||
bool fixedBase, // whether the base is fixed (true) or can move (false)
|
||||
bool canSleep);
|
||||
bool canSleep, bool deprecatedMultiDof=true);
|
||||
|
||||
|
||||
virtual ~btMultiBody();
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
int parent,
|
||||
const btQuaternion &rotParentToThis,
|
||||
const btVector3 &parentComToThisPivotOffset,
|
||||
const btVector3 &thisPivotToThisComOffset);
|
||||
const btVector3 &thisPivotToThisComOffset, bool deprecatedDisableParentCollision=true);
|
||||
|
||||
|
||||
void setupPrismatic(int i,
|
||||
@@ -338,6 +338,7 @@ void addJointTorque(int i, btScalar Q);
|
||||
// allocation appears to be fairly slow).
|
||||
//
|
||||
|
||||
|
||||
void computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar dt,
|
||||
btAlignedObjectArray<btScalar> &scratch_r,
|
||||
btAlignedObjectArray<btVector3> &scratch_v,
|
||||
@@ -345,13 +346,22 @@ void addJointTorque(int i, btScalar Q);
|
||||
bool isConstraintPass=false
|
||||
);
|
||||
|
||||
///stepVelocitiesMultiDof is deprecated, use computeAccelerationsArticulatedBodyAlgorithmMultiDof instead
|
||||
void stepVelocitiesMultiDof(btScalar dt,
|
||||
btAlignedObjectArray<btScalar> &scratch_r,
|
||||
btAlignedObjectArray<btVector3> &scratch_v,
|
||||
btAlignedObjectArray<btMatrix3x3> &scratch_m,
|
||||
bool isConstraintPass=false)
|
||||
{
|
||||
computeAccelerationsArticulatedBodyAlgorithmMultiDof(dt,scratch_r,scratch_v,scratch_m,isConstraintPass);
|
||||
}
|
||||
|
||||
// calcAccelerationDeltasMultiDof
|
||||
// input: force vector (in same format as jacobian, i.e.:
|
||||
// 3 torque values, 3 force values, num_links joint torque values)
|
||||
// output: 3 omegadot values, 3 vdot values, num_links q_double_dot values
|
||||
// (existing contents of output array are replaced)
|
||||
// stepVelocities must have been called first.
|
||||
|
||||
// calcAccelerationDeltasMultiDof must have been called first.
|
||||
void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output,
|
||||
btAlignedObjectArray<btScalar> &scratch_r,
|
||||
btAlignedObjectArray<btVector3> &scratch_v) const;
|
||||
|
||||
@@ -39,6 +39,12 @@ subject to the following restrictions:
|
||||
#include <new> //for placement new
|
||||
#endif //BT_USE_PLACEMENT_NEW
|
||||
|
||||
// The register keyword is deprecated in C++11 so don't use it.
|
||||
#if __cplusplus > 199711L
|
||||
#define BT_REGISTER
|
||||
#else
|
||||
#define BT_REGISTER register
|
||||
#endif
|
||||
|
||||
///The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods
|
||||
///It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data
|
||||
@@ -211,7 +217,7 @@ protected:
|
||||
|
||||
SIMD_FORCE_INLINE void resize(int newsize, const T& fillData=T())
|
||||
{
|
||||
const register int curSize = size();
|
||||
const BT_REGISTER int curSize = size();
|
||||
|
||||
if (newsize < curSize)
|
||||
{
|
||||
@@ -238,7 +244,7 @@ protected:
|
||||
}
|
||||
SIMD_FORCE_INLINE T& expandNonInitializing( )
|
||||
{
|
||||
const register int sz = size();
|
||||
const BT_REGISTER int sz = size();
|
||||
if( sz == capacity() )
|
||||
{
|
||||
reserve( allocSize(size()) );
|
||||
@@ -251,7 +257,7 @@ protected:
|
||||
|
||||
SIMD_FORCE_INLINE T& expand( const T& fillValue=T())
|
||||
{
|
||||
const register int sz = size();
|
||||
const BT_REGISTER int sz = size();
|
||||
if( sz == capacity() )
|
||||
{
|
||||
reserve( allocSize(size()) );
|
||||
@@ -267,7 +273,7 @@ protected:
|
||||
|
||||
SIMD_FORCE_INLINE void push_back(const T& _Val)
|
||||
{
|
||||
const register int sz = size();
|
||||
const BT_REGISTER int sz = size();
|
||||
if( sz == capacity() )
|
||||
{
|
||||
reserve( allocSize(size()) );
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
|
||||
|
||||
/**@brief Set from an array
|
||||
* @param m A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation */
|
||||
* @param m A pointer to a 16 element array (12 rotation(row major padded on the right by 1), and 3 translation */
|
||||
void setFromOpenGLMatrix(const btScalar *m)
|
||||
{
|
||||
m_basis.setFromOpenGLSubMatrix(m);
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Fill an array representation
|
||||
* @param m A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation */
|
||||
* @param m A pointer to a 16 element array (12 rotation(row major padded on the right by 1), and 3 translation */
|
||||
void getOpenGLMatrix(btScalar *m) const
|
||||
{
|
||||
m_basis.getOpenGLSubMatrix(m);
|
||||
|
||||
Reference in New Issue
Block a user