| btCollisionObject.h | | btCollisionObject.h | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 69 | |
| //without destroying the continuous interpolated motion (which uses
this interpolation velocities) | | //without destroying the continuous interpolated motion (which uses
this interpolation velocities) | |
| btVector3 m_interpolationLinearVelocity; | | btVector3 m_interpolationLinearVelocity; | |
| btVector3 m_interpolationAngularVelocity; | | btVector3 m_interpolationAngularVelocity; | |
| | | | |
| btVector3 m_anisotropicFriction; | | btVector3 m_anisotropicFriction; | |
| int m_hasAnisotropicFriction; | | int m_hasAnisotropicFriction; | |
| btScalar m_contactProcessingThreshold; | | btScalar m_contactProcessingThreshold; | |
| | | | |
| btBroadphaseProxy* m_broadphaseHandle; | | btBroadphaseProxy* m_broadphaseHandle; | |
| btCollisionShape* m_collisionShape; | | btCollisionShape* m_collisionShape; | |
|
| | | ///m_extensionPointer is used by some internal low-level Bullet exte | |
| | | nsions. | |
| | | void* m_extensionPointer; | |
| | | | |
| ///m_rootCollisionShape is temporarily used to store the original co
llision shape | | ///m_rootCollisionShape is temporarily used to store the original co
llision shape | |
| ///The m_collisionShape might be temporarily replaced by a child col
lision shape during collision detection purposes | | ///The m_collisionShape might be temporarily replaced by a child col
lision shape during collision detection purposes | |
| ///If it is NULL, the m_collisionShape is not temporarily replaced. | | ///If it is NULL, the m_collisionShape is not temporarily replaced. | |
| btCollisionShape* m_rootCollisionShape; | | btCollisionShape* m_rootCollisionShape; | |
| | | | |
| int m_collisionFlags; | | int m_collisionFlags; | |
| | | | |
| int m_islandTag1; | | int m_islandTag1; | |
| int m_companionId; | | int m_companionId; | |
| | | | |
| skipping to change at line 128 | | skipping to change at line 130 | |
| CF_NO_CONTACT_RESPONSE = 4, | | CF_NO_CONTACT_RESPONSE = 4, | |
| CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle m
aterial (friction/restitution) | | CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle m
aterial (friction/restitution) | |
| CF_CHARACTER_OBJECT = 16, | | CF_CHARACTER_OBJECT = 16, | |
| CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing | | CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing | |
| CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/S
PU processing | | CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/S
PU processing | |
| }; | | }; | |
| | | | |
| enum CollisionObjectTypes | | enum CollisionObjectTypes | |
| { | | { | |
| CO_COLLISION_OBJECT =1, | | CO_COLLISION_OBJECT =1, | |
|
| CO_RIGID_BODY, | | CO_RIGID_BODY=2, | |
| ///CO_GHOST_OBJECT keeps track of all objects overlapping it
s AABB and that pass its collision filter | | ///CO_GHOST_OBJECT keeps track of all objects overlapping it
s AABB and that pass its collision filter | |
| ///It is useful for collision sensors, explosion objects, ch
aracter controller etc. | | ///It is useful for collision sensors, explosion objects, ch
aracter controller etc. | |
|
| CO_GHOST_OBJECT, | | CO_GHOST_OBJECT=4, | |
| CO_SOFT_BODY, | | CO_SOFT_BODY=8, | |
| CO_HF_FLUID | | CO_HF_FLUID=16, | |
| | | CO_USER_TYPE=32 | |
| }; | | }; | |
| | | | |
| SIMD_FORCE_INLINE bool mergesSimulationIslands() const | | SIMD_FORCE_INLINE bool mergesSimulationIslands() const | |
| { | | { | |
| ///static objects, kinematic and object without contact resp
onse don't merge islands | | ///static objects, kinematic and object without contact resp
onse don't merge islands | |
| return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATI
C_OBJECT | CF_NO_CONTACT_RESPONSE) )==0); | | return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATI
C_OBJECT | CF_NO_CONTACT_RESPONSE) )==0); | |
| } | | } | |
| | | | |
| const btVector3& getAnisotropicFriction() const | | const btVector3& getAnisotropicFriction() const | |
| { | | { | |
| | | | |
| skipping to change at line 222 | | skipping to change at line 225 | |
| return m_rootCollisionShape; | | return m_rootCollisionShape; | |
| } | | } | |
| | | | |
| ///Avoid using this internal API call | | ///Avoid using this internal API call | |
| ///internalSetTemporaryCollisionShape is used to temporary replace t
he actual collision shape by a child collision shape. | | ///internalSetTemporaryCollisionShape is used to temporary replace t
he actual collision shape by a child collision shape. | |
| void internalSetTemporaryCollisionShape(btCollisionShape* collisi
onShape) | | void internalSetTemporaryCollisionShape(btCollisionShape* collisi
onShape) | |
| { | | { | |
| m_collisionShape = collisionShape; | | m_collisionShape = collisionShape; | |
| } | | } | |
| | | | |
|
| | | ///Avoid using this internal API call, the extension pointer is used | |
| | | by some Bullet extensions. | |
| | | ///If you need to store your own user pointer, use 'setUserPointer/g | |
| | | etUserPointer' instead. | |
| | | void* internalGetExtensionPointer() const | |
| | | { | |
| | | return m_extensionPointer; | |
| | | } | |
| | | ///Avoid using this internal API call, the extension pointer is used | |
| | | by some Bullet extensions | |
| | | ///If you need to store your own user pointer, use 'setUserPointer/g | |
| | | etUserPointer' instead. | |
| | | void internalSetExtensionPointer(void* pointer) | |
| | | { | |
| | | m_extensionPointer = pointer; | |
| | | } | |
| | | | |
| SIMD_FORCE_INLINE int getActivationState() const { return
m_activationState1;} | | SIMD_FORCE_INLINE int getActivationState() const { return
m_activationState1;} | |
| | | | |
| void setActivationState(int newState); | | void setActivationState(int newState); | |
| | | | |
| void setDeactivationTime(btScalar time) | | void setDeactivationTime(btScalar time) | |
| { | | { | |
| m_deactivationTime = time; | | m_deactivationTime = time; | |
| } | | } | |
| btScalar getDeactivationTime() const | | btScalar getDeactivationTime() const | |
| { | | { | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 25 lines changed or added | |
|
| btCollisionWorld.h | | btCollisionWorld.h | |
| | | | |
| skipping to change at line 260 | | skipping to change at line 260 | |
| } else | | } else | |
| { | | { | |
| ///need to transform normal into worldspace | | ///need to transform normal into worldspace | |
| m_hitNormalWorld = m_collisionObject->getWor
ldTransform().getBasis()*rayResult.m_hitNormalLocal; | | m_hitNormalWorld = m_collisionObject->getWor
ldTransform().getBasis()*rayResult.m_hitNormalLocal; | |
| } | | } | |
| m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_ray
ToWorld,rayResult.m_hitFraction); | | m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_ray
ToWorld,rayResult.m_hitFraction); | |
| return rayResult.m_hitFraction; | | return rayResult.m_hitFraction; | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| | | struct AllHitsRayResultCallback : public RayResultCallback | |
| | | { | |
| | | AllHitsRayResultCallback(const btVector3& rayFromWorld | |
| | | ,const btVector3& rayToWorld) | |
| | | :m_rayFromWorld(rayFromWorld), | |
| | | m_rayToWorld(rayToWorld) | |
| | | { | |
| | | } | |
| | | | |
| | | btAlignedObjectArray<btCollisionObject*> m_co | |
| | | llisionObjects; | |
| | | | |
| | | btVector3 m_rayFromWorld;//used to calculate hitPointW | |
| | | orld from hitFraction | |
| | | btVector3 m_rayToWorld; | |
| | | | |
| | | btAlignedObjectArray<btVector3> m_hitNormalWorld; | |
| | | btAlignedObjectArray<btVector3> m_hitPointWorld; | |
| | | btAlignedObjectArray<btScalar> m_hitFractions; | |
| | | | |
| | | virtual btScalar addSingleResult(LocalRayResult& rayR | |
| | | esult,bool normalInWorldSpace) | |
| | | { | |
| | | m_collisionObject = rayResult.m_collisionObject; | |
| | | m_collisionObjects.push_back(rayResult.m_collisionOb | |
| | | ject); | |
| | | btVector3 hitNormalWorld; | |
| | | if (normalInWorldSpace) | |
| | | { | |
| | | hitNormalWorld = rayResult.m_hitNormalLocal; | |
| | | } else | |
| | | { | |
| | | ///need to transform normal into worldspace | |
| | | hitNormalWorld = m_collisionObject->getWorld | |
| | | Transform().getBasis()*rayResult.m_hitNormalLocal; | |
| | | } | |
| | | m_hitNormalWorld.push_back(hitNormalWorld); | |
| | | btVector3 hitPointWorld; | |
| | | hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayTo | |
| | | World,rayResult.m_hitFraction); | |
| | | m_hitPointWorld.push_back(hitPointWorld); | |
| | | m_hitFractions.push_back(rayResult.m_hitFraction); | |
| | | return m_closestHitFraction; | |
| | | } | |
| | | }; | |
| | | | |
| struct LocalConvexResult | | struct LocalConvexResult | |
| { | | { | |
| LocalConvexResult(btCollisionObject* hitCollisionObject, | | LocalConvexResult(btCollisionObject* hitCollisionObject, | |
| LocalShapeInfo* localShapeInfo, | | LocalShapeInfo* localShapeInfo, | |
| const btVector3& hitNormalLocal, | | const btVector3& hitNormalLocal, | |
| const btVector3& hitPointLocal, | | const btVector3& hitPointLocal, | |
| btScalar hitFraction | | btScalar hitFraction | |
| ) | | ) | |
| :m_hitCollisionObject(hitCollisionObject), | | :m_hitCollisionObject(hitCollisionObject), | |
| m_localShapeInfo(localShapeInfo), | | m_localShapeInfo(localShapeInfo), | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 46 lines changed or added | |
|
| btCylinderShape.h | | btCylinderShape.h | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 101 | |
| int getUpAxis() const | | int getUpAxis() const | |
| { | | { | |
| return m_upAxis; | | return m_upAxis; | |
| } | | } | |
| | | | |
| virtual btScalar getRadius() const | | virtual btScalar getRadius() const | |
| { | | { | |
| return getHalfExtentsWithMargin().getX(); | | return getHalfExtentsWithMargin().getX(); | |
| } | | } | |
| | | | |
|
| | | virtual void setLocalScaling(const btVector3& scaling) | |
| | | { | |
| | | btVector3 oldMargin(getMargin(),getMargin(),getMargin()); | |
| | | btVector3 implicitShapeDimensionsWithMargin = m_implicitShap | |
| | | eDimensions+oldMargin; | |
| | | btVector3 unScaledImplicitShapeDimensionsWithMargin = implic | |
| | | itShapeDimensionsWithMargin / m_localScaling; | |
| | | | |
| | | btConvexInternalShape::setLocalScaling(scaling); | |
| | | | |
| | | m_implicitShapeDimensions = (unScaledImplicitShapeDimensions | |
| | | WithMargin * m_localScaling) - oldMargin; | |
| | | | |
| | | } | |
| | | | |
| //debugging | | //debugging | |
| virtual const char* getName()const | | virtual const char* getName()const | |
| { | | { | |
| return "CylinderY"; | | return "CylinderY"; | |
| } | | } | |
| | | | |
| virtual int calculateSerializeBufferSize() const; | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | | ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | |
| virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | | virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 155 | |
| }; | | }; | |
| | | | |
| class btCylinderShapeZ : public btCylinderShape | | class btCylinderShapeZ : public btCylinderShape | |
| { | | { | |
| public: | | public: | |
| btCylinderShapeZ (const btVector3& halfExtents); | | btCylinderShapeZ (const btVector3& halfExtents); | |
| | | | |
| virtual btVector3 localGetSupportingVertexWithoutMargin(const
btVector3& vec)const; | | virtual btVector3 localGetSupportingVertexWithoutMargin(const
btVector3& vec)const; | |
| virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co
nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; | | virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co
nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; | |
| | | | |
|
| virtual int getUpAxis() const | | | |
| { | | | |
| return 2; | | | |
| } | | | |
| //debugging | | //debugging | |
| virtual const char* getName()const | | virtual const char* getName()const | |
| { | | { | |
| return "CylinderZ"; | | return "CylinderZ"; | |
| } | | } | |
| | | | |
| virtual btScalar getRadius() const | | virtual btScalar getRadius() const | |
| { | | { | |
| return getHalfExtentsWithMargin().getX(); | | return getHalfExtentsWithMargin().getX(); | |
| } | | } | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 15 lines changed or added | |
|
| btDispatcher.h | | btDispatcher.h | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| m_dispatchFunc(DISPATCH_DISCRETE), | | m_dispatchFunc(DISPATCH_DISCRETE), | |
| m_timeOfImpact(btScalar(1.)), | | m_timeOfImpact(btScalar(1.)), | |
| m_useContinuous(false), | | m_useContinuous(false), | |
| m_debugDraw(0), | | m_debugDraw(0), | |
| m_enableSatConvex(false), | | m_enableSatConvex(false), | |
| m_enableSPU(true), | | m_enableSPU(true), | |
| m_useEpa(true), | | m_useEpa(true), | |
| m_allowedCcdPenetration(btScalar(0.04)), | | m_allowedCcdPenetration(btScalar(0.04)), | |
| m_useConvexConservativeDistanceUtil(false), | | m_useConvexConservativeDistanceUtil(false), | |
| m_convexConservativeDistanceThreshold(0.0f), | | m_convexConservativeDistanceThreshold(0.0f), | |
|
| | | m_convexMaxDistanceUseCPT(false), | |
| m_stackAllocator(0) | | m_stackAllocator(0) | |
| { | | { | |
| | | | |
| } | | } | |
| btScalar m_timeStep; | | btScalar m_timeStep; | |
| int m_stepCount; | | int m_stepCount; | |
| int m_dispatchFunc; | | int m_dispatchFunc; | |
| mutable btScalar m_timeOfImpact; | | mutable btScalar m_timeOfImpact; | |
| bool m_useContinuous; | | bool m_useContinuous; | |
| class btIDebugDraw* m_debugDraw; | | class btIDebugDraw* m_debugDraw; | |
| bool m_enableSatConvex; | | bool m_enableSatConvex; | |
| bool m_enableSPU; | | bool m_enableSPU; | |
| bool m_useEpa; | | bool m_useEpa; | |
| btScalar m_allowedCcdPenetration; | | btScalar m_allowedCcdPenetration; | |
| bool m_useConvexConservativeDistanceUtil; | | bool m_useConvexConservativeDistanceUtil; | |
| btScalar m_convexConservativeDistanceThreshold; | | btScalar m_convexConservativeDistanceThreshold; | |
|
| | | bool m_convexMaxDistanceUseCPT; | |
| btStackAlloc* m_stackAllocator; | | btStackAlloc* m_stackAllocator; | |
| }; | | }; | |
| | | | |
| ///The btDispatcher interface class can be used in combination with broadph
ase to dispatch calculations for overlapping pairs. | | ///The btDispatcher interface class can be used in combination with broadph
ase to dispatch calculations for overlapping pairs. | |
| ///For example for pairwise collision detection, calculating contact points
stored in btPersistentManifold or user callbacks (game logic). | | ///For example for pairwise collision detection, calculating contact points
stored in btPersistentManifold or user callbacks (game logic). | |
| class btDispatcher | | class btDispatcher | |
| { | | { | |
| | | | |
| public: | | public: | |
| virtual ~btDispatcher() ; | | virtual ~btDispatcher() ; | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 2 lines changed or added | |
|
| btGeneric6DofSpringConstraint.h | | btGeneric6DofSpringConstraint.h | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| btScalar m_springStiffness[6]; | | btScalar m_springStiffness[6]; | |
| btScalar m_springDamping[6]; // between 0 and 1 (1 == no damp
ing) | | btScalar m_springDamping[6]; // between 0 and 1 (1 == no damp
ing) | |
| void internalUpdateSprings(btConstraintInfo2* info); | | void internalUpdateSprings(btConstraintInfo2* info); | |
| public: | | public: | |
| btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const
btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenc
eFrameA); | | btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const
btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenc
eFrameA); | |
| void enableSpring(int index, bool onOff); | | void enableSpring(int index, bool onOff); | |
| void setStiffness(int index, btScalar stiffness); | | void setStiffness(int index, btScalar stiffness); | |
| void setDamping(int index, btScalar damping); | | void setDamping(int index, btScalar damping); | |
| void setEquilibriumPoint(); // set the current constraint position/o
rientation as an equilibrium point for all DOF | | void setEquilibriumPoint(); // set the current constraint position/o
rientation as an equilibrium point for all DOF | |
| void setEquilibriumPoint(int index); // set the current constraint
position/orientation as an equilibrium point for given DOF | | void setEquilibriumPoint(int index); // set the current constraint
position/orientation as an equilibrium point for given DOF | |
|
| | | void setEquilibriumPoint(int index, btScalar val); | |
| virtual void getInfo2 (btConstraintInfo2* info); | | virtual void getInfo2 (btConstraintInfo2* info); | |
| }; | | }; | |
| | | | |
| #endif // GENERIC_6DOF_SPRING_CONSTRAINT_H | | #endif // GENERIC_6DOF_SPRING_CONSTRAINT_H | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 1 lines changed or added | |
|
| btHingeConstraint.h | | btHingeConstraint.h | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 90 | |
| | | | |
| btScalar m_accMotorImpulse; | | btScalar m_accMotorImpulse; | |
| | | | |
| int m_flags; | | int m_flags; | |
| btScalar m_normalCFM; | | btScalar m_normalCFM; | |
| btScalar m_stopCFM; | | btScalar m_stopCFM; | |
| btScalar m_stopERP; | | btScalar m_stopERP; | |
| | | | |
| public: | | public: | |
| | | | |
|
| btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3
& pivotInA,const btVector3& pivotInB, btVector3& axisInA,btVector3& axisInB
, bool useReferenceFrameA = false); | | btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3
& pivotInA,const btVector3& pivotInB, const btVector3& axisInA,const btVect
or3& axisInB, bool useReferenceFrameA = false); | |
| | | | |
|
| btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVecto
r3& axisInA, bool useReferenceFrameA = false); | | btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,const b
tVector3& axisInA, bool useReferenceFrameA = false); | |
| | | | |
| btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransfo
rm& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false)
; | | btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransfo
rm& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false)
; | |
| | | | |
| btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool
useReferenceFrameA = false); | | btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool
useReferenceFrameA = false); | |
| | | | |
| virtual void buildJacobian(); | | virtual void buildJacobian(); | |
| | | | |
| virtual void getInfo1 (btConstraintInfo1* info); | | virtual void getInfo1 (btConstraintInfo1* info); | |
| | | | |
| void getInfo1NonVirtual(btConstraintInfo1* info); | | void getInfo1NonVirtual(btConstraintInfo1* info); | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btIDebugDraw.h | | btIDebugDraw.h | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| virtual ~btIDebugDraw() {}; | | virtual ~btIDebugDraw() {}; | |
| | | | |
| virtual void drawLine(const btVector3& from,const btVector3& to,c
onst btVector3& color)=0; | | virtual void drawLine(const btVector3& from,const btVector3& to,c
onst btVector3& color)=0; | |
| | | | |
| virtual void drawLine(const btVector3& from,const btVector3& to,
const btVector3& fromColor, const btVector3& toColor) | | virtual void drawLine(const btVector3& from,const btVector3& to,
const btVector3& fromColor, const btVector3& toColor) | |
| { | | { | |
| (void) toColor; | | (void) toColor; | |
| drawLine (from, to, fromColor); | | drawLine (from, to, fromColor); | |
| } | | } | |
| | | | |
|
| void drawSphere(btScalar radius, const btTransform& transform, co
nst btVector3& color) | | virtual void drawSphere(btScalar radius, const btTransform& trans
form, const btVector3& color) | |
| { | | { | |
| btVector3 start = transform.getOrigin(); | | btVector3 start = transform.getOrigin(); | |
| | | | |
| const btVector3 xoffs = transform.getBasis() * btVector3(rad
ius,0,0); | | const btVector3 xoffs = transform.getBasis() * btVector3(rad
ius,0,0); | |
| const btVector3 yoffs = transform.getBasis() * btVector3(0,r
adius,0); | | const btVector3 yoffs = transform.getBasis() * btVector3(0,r
adius,0); | |
| const btVector3 zoffs = transform.getBasis() * btVector3(0,0
,radius); | | const btVector3 zoffs = transform.getBasis() * btVector3(0,0
,radius); | |
| | | | |
| // XY | | // XY | |
| drawLine(start-xoffs, start+yoffs, color); | | drawLine(start-xoffs, start+yoffs, color); | |
| drawLine(start+yoffs, start+xoffs, color); | | drawLine(start+yoffs, start+xoffs, color); | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| btKinematicCharacterController.h | | btKinematicCharacterController.h | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| ///Interaction between btKinematicCharacterController and dynamic rigid bod
ies needs to be explicity implemented by the user. | | ///Interaction between btKinematicCharacterController and dynamic rigid bod
ies needs to be explicity implemented by the user. | |
| class btKinematicCharacterController : public btCharacterControllerInterfac
e | | class btKinematicCharacterController : public btCharacterControllerInterfac
e | |
| { | | { | |
| protected: | | protected: | |
| | | | |
| btScalar m_halfHeight; | | btScalar m_halfHeight; | |
| | | | |
| btPairCachingGhostObject* m_ghostObject; | | btPairCachingGhostObject* m_ghostObject; | |
| btConvexShape* m_convexShape;//is also in m_ghostObject, but it nee
ds to be convex, so we store it here to avoid upcast | | btConvexShape* m_convexShape;//is also in m_ghostObject, but it nee
ds to be convex, so we store it here to avoid upcast | |
| | | | |
|
| | | btScalar m_verticalVelocity; | |
| | | btScalar m_verticalOffset; | |
| btScalar m_fallSpeed; | | btScalar m_fallSpeed; | |
| btScalar m_jumpSpeed; | | btScalar m_jumpSpeed; | |
| btScalar m_maxJumpHeight; | | btScalar m_maxJumpHeight; | |
|
| | | btScalar m_maxSlopeRadians; // Slope angle that is set (used for ret | |
| | | urning the exact value) | |
| | | btScalar m_maxSlopeCosine; // Cosine equivalent of m_maxSlopeRadian | |
| | | s (calculated once when set, for optimization) | |
| | | btScalar m_gravity; | |
| | | | |
| btScalar m_turnAngle; | | btScalar m_turnAngle; | |
| | | | |
| btScalar m_stepHeight; | | btScalar m_stepHeight; | |
| | | | |
| btScalar m_addedMargin;//@todo: remove this and fix the code | | btScalar m_addedMargin;//@todo: remove this and fix the code | |
| | | | |
| ///this is the desired walk direction, set by the user | | ///this is the desired walk direction, set by the user | |
| btVector3 m_walkDirection; | | btVector3 m_walkDirection; | |
| btVector3 m_normalizedDirection; | | btVector3 m_normalizedDirection; | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 73 | |
| btVector3 m_currentPosition; | | btVector3 m_currentPosition; | |
| btScalar m_currentStepOffset; | | btScalar m_currentStepOffset; | |
| btVector3 m_targetPosition; | | btVector3 m_targetPosition; | |
| | | | |
| ///keep track of the contact manifolds | | ///keep track of the contact manifolds | |
| btManifoldArray m_manifoldArray; | | btManifoldArray m_manifoldArray; | |
| | | | |
| bool m_touchingContact; | | bool m_touchingContact; | |
| btVector3 m_touchingNormal; | | btVector3 m_touchingNormal; | |
| | | | |
|
| | | bool m_wasOnGround; | |
| | | bool m_wasJumping; | |
| bool m_useGhostObjectSweepTest; | | bool m_useGhostObjectSweepTest; | |
| bool m_useWalkDirection; | | bool m_useWalkDirection; | |
| btScalar m_velocityTimeInterval; | | btScalar m_velocityTimeInterval; | |
| int m_upAxis; | | int m_upAxis; | |
| | | | |
| static btVector3* getUpAxisDirections(); | | static btVector3* getUpAxisDirections(); | |
| | | | |
| btVector3 computeReflectionDirection (const btVector3& direction, co
nst btVector3& normal); | | btVector3 computeReflectionDirection (const btVector3& direction, co
nst btVector3& normal); | |
| btVector3 parallelComponent (const btVector3& direction, const btVec
tor3& normal); | | btVector3 parallelComponent (const btVector3& direction, const btVec
tor3& normal); | |
| btVector3 perpindicularComponent (const btVector3& direction, const
btVector3& normal); | | btVector3 perpindicularComponent (const btVector3& direction, const
btVector3& normal); | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 116 | |
| { | | { | |
| if (axis < 0) | | if (axis < 0) | |
| axis = 0; | | axis = 0; | |
| if (axis > 2) | | if (axis > 2) | |
| axis = 2; | | axis = 2; | |
| m_upAxis = axis; | | m_upAxis = axis; | |
| } | | } | |
| | | | |
| /// This should probably be called setPositionIncrementPerSimulatorS
tep. | | /// This should probably be called setPositionIncrementPerSimulatorS
tep. | |
| /// This is neither a direction nor a velocity, but the amount to | | /// This is neither a direction nor a velocity, but the amount to | |
|
| /// increment the position each simulation iteration, regardless | | /// increment the position each simulation iteration, regardless | |
| /// of dt. | | /// of dt. | |
| /// This call will reset any velocity set by setVelocityForTimeInter
val(). | | /// This call will reset any velocity set by setVelocityForTimeInter
val(). | |
| virtual void setWalkDirection(const btVector3& walkDirection); | | virtual void setWalkDirection(const btVector3& walkDirection); | |
| | | | |
| /// Caller provides a velocity with which the character should move
for | | /// Caller provides a velocity with which the character should move
for | |
|
| /// the given time period. After the time period, velocity is res | | /// the given time period. After the time period, velocity is r | |
| et | | eset | |
| /// to zero. | | /// to zero. | |
| /// This call will reset any walk direction set by setWalkDirection(
). | | /// This call will reset any walk direction set by setWalkDirection(
). | |
| /// Negative time intervals will result in no motion. | | /// Negative time intervals will result in no motion. | |
| virtual void setVelocityForTimeInterval(const btVector3& velocity, | | virtual void setVelocityForTimeInterval(const btVector3& velocity, | |
| btScalar timeInterval); | | btScalar timeInterval); | |
| | | | |
| void reset (); | | void reset (); | |
| void warp (const btVector3& origin); | | void warp (const btVector3& origin); | |
| | | | |
| void preStep ( btCollisionWorld* collisionWorld); | | void preStep ( btCollisionWorld* collisionWorld); | |
| void playerStep ( btCollisionWorld* collisionWorld, btScalar dt); | | void playerStep ( btCollisionWorld* collisionWorld, btScalar dt); | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 139 | |
| void reset (); | | void reset (); | |
| void warp (const btVector3& origin); | | void warp (const btVector3& origin); | |
| | | | |
| void preStep ( btCollisionWorld* collisionWorld); | | void preStep ( btCollisionWorld* collisionWorld); | |
| void playerStep ( btCollisionWorld* collisionWorld, btScalar dt); | | void playerStep ( btCollisionWorld* collisionWorld, btScalar dt); | |
| | | | |
| void setFallSpeed (btScalar fallSpeed); | | void setFallSpeed (btScalar fallSpeed); | |
| void setJumpSpeed (btScalar jumpSpeed); | | void setJumpSpeed (btScalar jumpSpeed); | |
| void setMaxJumpHeight (btScalar maxJumpHeight); | | void setMaxJumpHeight (btScalar maxJumpHeight); | |
| bool canJump () const; | | bool canJump () const; | |
|
| | | | |
| void jump (); | | void jump (); | |
| | | | |
|
| | | void setGravity(btScalar gravity); | |
| | | btScalar getGravity() const; | |
| | | | |
| | | /// The max slope determines the maximum angle that the controller c | |
| | | an walk up. | |
| | | /// The slope angle is measured in radians. | |
| | | void setMaxSlope(btScalar slopeRadians); | |
| | | btScalar getMaxSlope() const; | |
| | | | |
| btPairCachingGhostObject* getGhostObject(); | | btPairCachingGhostObject* getGhostObject(); | |
| void setUseGhostSweepTest(bool useGhostObjectSweepTest) | | void setUseGhostSweepTest(bool useGhostObjectSweepTest) | |
| { | | { | |
| m_useGhostObjectSweepTest = useGhostObjectSweepTest; | | m_useGhostObjectSweepTest = useGhostObjectSweepTest; | |
| } | | } | |
| | | | |
| bool onGround () const; | | bool onGround () const; | |
| }; | | }; | |
| | | | |
| #endif // KINEMATIC_CHARACTER_CONTROLLER_H | | #endif // KINEMATIC_CHARACTER_CONTROLLER_H | |
| | | | |
End of changes. 7 change blocks. |
| 5 lines changed or deleted | | 24 lines changed or added | |
|
| btManifoldPoint.h | | btManifoldPoint.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | |
| 3. This notice may not be removed or altered from any source distribution. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
| #ifndef MANIFOLD_CONTACT_POINT_H | | #ifndef MANIFOLD_CONTACT_POINT_H | |
| #define MANIFOLD_CONTACT_POINT_H | | #define MANIFOLD_CONTACT_POINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btTransformUtil.h" | | #include "LinearMath/btTransformUtil.h" | |
| | | | |
|
| | | // Don't change following order of parameters | |
| | | ATTRIBUTE_ALIGNED16(struct) PfxConstraintRow { | |
| | | btScalar mNormal[3]; | |
| | | btScalar mRhs; | |
| | | btScalar mJacDiagInv; | |
| | | btScalar mLowerLimit; | |
| | | btScalar mUpperLimit; | |
| | | btScalar mAccumImpulse; | |
| | | }; | |
| | | | |
| /// ManifoldContactPoint collects and maintains persistent contactpoints. | | /// ManifoldContactPoint collects and maintains persistent contactpoints. | |
| /// used to improve stability and performance of rigidbody dynamics respons
e. | | /// used to improve stability and performance of rigidbody dynamics respons
e. | |
| class btManifoldPoint | | class btManifoldPoint | |
| { | | { | |
| public: | | public: | |
| btManifoldPoint() | | btManifoldPoint() | |
| :m_userPersistentData(0), | | :m_userPersistentData(0), | |
| m_appliedImpulse(0.f), | | m_appliedImpulse(0.f), | |
| m_lateralFrictionInitialized(false), | | m_lateralFrictionInitialized(false), | |
| m_appliedImpulseLateral1(0.f), | | m_appliedImpulseLateral1(0.f), | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 71 | |
| m_appliedImpulse(0.f), | | m_appliedImpulse(0.f), | |
| m_lateralFrictionInitialized(false), | | m_lateralFrictionInitialized(false), | |
| m_appliedImpulseLateral1(0.f), | | m_appliedImpulseLateral1(0.f), | |
| m_appliedImpulseLateral2(0.f), | | m_appliedImpulseLateral2(0.f), | |
| m_contactMotion1(0.f), | | m_contactMotion1(0.f), | |
| m_contactMotion2(0.f), | | m_contactMotion2(0.f), | |
| m_contactCFM1(0.f), | | m_contactCFM1(0.f), | |
| m_contactCFM2(0.f), | | m_contactCFM2(0.f), | |
| m_lifeTime(0) | | m_lifeTime(0) | |
| { | | { | |
|
| | | mConstraintRow[0].mAccumImpulse = 0.f; | |
| | | mConstraintRow[1].mAccumImpulse = 0.f; | |
| | | mConstraintRow[2].mAccumImpulse = 0.f; | |
| } | | } | |
| | | | |
| btVector3 m_localPointA; | | btVector3 m_localPointA; | |
| btVector3 m_localPointB; | | btVector3 m_localPointB; | |
| btVector3 m_positionWorldOnB; | | btVector3 m_positionWorldOnB; | |
| ///m_positionWorldOnA is redundant information, see
getPositionWorldOnA(), but for clarity | | ///m_positionWorldOnA is redundant information, see
getPositionWorldOnA(), but for clarity | |
| btVector3 m_positionWorldOnA; | | btVector3 m_positionWorldOnA; | |
| btVector3 m_normalWorldOnB; | | btVector3 m_normalWorldOnB; | |
| | | | |
| btScalar m_distance1; | | btScalar m_distance1; | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 109 | |
| btScalar m_contactMotion1; | | btScalar m_contactMotion1; | |
| btScalar m_contactMotion2; | | btScalar m_contactMotion2; | |
| btScalar m_contactCFM1; | | btScalar m_contactCFM1; | |
| btScalar m_contactCFM2; | | btScalar m_contactCFM2; | |
| | | | |
| int m_lifeTime;//lifetim
e of the contactpoint in frames | | int m_lifeTime;//lifetim
e of the contactpoint in frames | |
| | | | |
| btVector3 m_lateralFrictionDir1; | | btVector3 m_lateralFrictionDir1; | |
| btVector3 m_lateralFrictionDir2; | | btVector3 m_lateralFrictionDir2; | |
| | | | |
|
| | | PfxConstraintRow mConstraintRow[3]; | |
| | | | |
| btScalar getDistance() const | | btScalar getDistance() const | |
| { | | { | |
| return m_distance1; | | return m_distance1; | |
| } | | } | |
| int getLifeTime() const | | int getLifeTime() const | |
| { | | { | |
| return m_lifeTime; | | return m_lifeTime; | |
| } | | } | |
| | | | |
| const btVector3& getPositionWorldOnA() const { | | const btVector3& getPositionWorldOnA() const { | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 15 lines changed or added | |
|
| btMinMax.h | | btMinMax.h | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | |
| 3. This notice may not be removed or altered from any source distribution. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
| #ifndef GEN_MINMAX_H | | #ifndef GEN_MINMAX_H | |
| #define GEN_MINMAX_H | | #define GEN_MINMAX_H | |
| | | | |
|
| | | #include "LinearMath/btScalar.h" | |
| | | | |
| template <class T> | | template <class T> | |
| SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b) | | SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b) | |
| { | | { | |
| return a < b ? a : b ; | | return a < b ? a : b ; | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
| SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b) | | SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b) | |
| { | | { | |
| return a > b ? a : b; | | return a > b ? a : b; | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
|
| SIMD_FORCE_INLINE const T& GEN_clamped(const T& a, const T& lb, const T& ub
) | | SIMD_FORCE_INLINE const T& btClamped(const T& a, const T& lb, const T& ub) | |
| { | | { | |
| return a < lb ? lb : (ub < a ? ub : a); | | return a < lb ? lb : (ub < a ? ub : a); | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
| SIMD_FORCE_INLINE void btSetMin(T& a, const T& b) | | SIMD_FORCE_INLINE void btSetMin(T& a, const T& b) | |
| { | | { | |
| if (b < a) | | if (b < a) | |
| { | | { | |
| a = b; | | a = b; | |
| | | | |
| skipping to change at line 55 | | skipping to change at line 57 | |
| template <class T> | | template <class T> | |
| SIMD_FORCE_INLINE void btSetMax(T& a, const T& b) | | SIMD_FORCE_INLINE void btSetMax(T& a, const T& b) | |
| { | | { | |
| if (a < b) | | if (a < b) | |
| { | | { | |
| a = b; | | a = b; | |
| } | | } | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
|
| SIMD_FORCE_INLINE void GEN_clamp(T& a, const T& lb, const T& ub) | | SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub) | |
| { | | { | |
| if (a < lb) | | if (a < lb) | |
| { | | { | |
| a = lb; | | a = lb; | |
| } | | } | |
| else if (ub < a) | | else if (ub < a) | |
| { | | { | |
| a = ub; | | a = ub; | |
| } | | } | |
| } | | } | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 4 lines changed or added | |
|
| btPersistentManifold.h | | btPersistentManifold.h | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| | | | |
| #define MANIFOLD_CACHE_SIZE 4 | | #define MANIFOLD_CACHE_SIZE 4 | |
| | | | |
| ///btPersistentManifold is a contact point cache, it stays persistent as lo
ng as objects are overlapping in the broadphase. | | ///btPersistentManifold is a contact point cache, it stays persistent as lo
ng as objects are overlapping in the broadphase. | |
| ///Those contact points are created by the collision narrow phase. | | ///Those contact points are created by the collision narrow phase. | |
| ///The cache can be empty, or hold 1,2,3 or 4 points. Some collision algori
thms (GJK) might only add one point at a time. | | ///The cache can be empty, or hold 1,2,3 or 4 points. Some collision algori
thms (GJK) might only add one point at a time. | |
| ///updates/refreshes old contact points, and throw them away if necessary (
distance becomes too large) | | ///updates/refreshes old contact points, and throw them away if necessary (
distance becomes too large) | |
| ///reduces the cache to 4 points, when more then 4 points are added, using
following rules: | | ///reduces the cache to 4 points, when more then 4 points are added, using
following rules: | |
| ///the contact point with deepest penetration is always kept, and it tries
to maximuze the area covered by the points | | ///the contact point with deepest penetration is always kept, and it tries
to maximuze the area covered by the points | |
| ///note that some pairs of objects might have more then one contact manifol
d. | | ///note that some pairs of objects might have more then one contact manifol
d. | |
|
| ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject | | | |
| | | ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject | |
| | | //ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject | |
| { | | { | |
| | | | |
| btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]; | | btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]; | |
| | | | |
| /// this two body pointers can point to the physics rigidbody class. | | /// this two body pointers can point to the physics rigidbody class. | |
| /// void* will allow any rigidbody class | | /// void* will allow any rigidbody class | |
| void* m_body0; | | void* m_body0; | |
| void* m_body1; | | void* m_body1; | |
|
| | | | |
| int m_cachedPoints; | | int m_cachedPoints; | |
| | | | |
| btScalar m_contactBreakingThreshold; | | btScalar m_contactBreakingThreshold; | |
| btScalar m_contactProcessingThreshold; | | btScalar m_contactProcessingThreshold; | |
| | | | |
| /// sort cached points so most isolated points come first | | /// sort cached points so most isolated points come first | |
| int sortCachedPoints(const btManifoldPoint& pt); | | int sortCachedPoints(const btManifoldPoint& pt); | |
| | | | |
| int findContactPoint(const btManifoldPoint* unUsed, int
numUnused,const btManifoldPoint& pt); | | int findContactPoint(const btManifoldPoint* unUsed, int
numUnused,const btManifoldPoint& pt); | |
| | | | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 75 | |
| | | | |
| /// sort cached points so most isolated points come first | | /// sort cached points so most isolated points come first | |
| int sortCachedPoints(const btManifoldPoint& pt); | | int sortCachedPoints(const btManifoldPoint& pt); | |
| | | | |
| int findContactPoint(const btManifoldPoint* unUsed, int
numUnused,const btManifoldPoint& pt); | | int findContactPoint(const btManifoldPoint* unUsed, int
numUnused,const btManifoldPoint& pt); | |
| | | | |
| public: | | public: | |
| | | | |
| BT_DECLARE_ALIGNED_ALLOCATOR(); | | BT_DECLARE_ALIGNED_ALLOCATOR(); | |
| | | | |
|
| | | int m_companionIdA; | |
| | | int m_companionIdB; | |
| | | | |
| int m_index1a; | | int m_index1a; | |
| | | | |
| btPersistentManifold(); | | btPersistentManifold(); | |
| | | | |
| btPersistentManifold(void* body0,void* body1,int , btScalar contactB
reakingThreshold,btScalar contactProcessingThreshold) | | btPersistentManifold(void* body0,void* body1,int , btScalar contactB
reakingThreshold,btScalar contactProcessingThreshold) | |
| : btTypedObject(BT_PERSISTENT_MANIFOLD_TYPE), | | : btTypedObject(BT_PERSISTENT_MANIFOLD_TYPE), | |
| m_body0(body0),m_body1(body1),m_cachedPoints(0), | | m_body0(body0),m_body1(body1),m_cachedPoints(0), | |
| m_contactBreakingThreshold(contactBreakingThreshold), | | m_contactBreakingThreshold(contactBreakingThreshold), | |
| m_contactProcessingThreshold(contactProcessingThreshold) | | m_contactProcessingThreshold(contactProcessingThreshold) | |
| { | | { | |
| | | | |
| skipping to change at line 139 | | skipping to change at line 145 | |
| { | | { | |
| clearUserCache(m_pointCache[index]); | | clearUserCache(m_pointCache[index]); | |
| | | | |
| int lastUsedIndex = getNumContacts() - 1; | | int lastUsedIndex = getNumContacts() - 1; | |
| // m_pointCache[index] = m_pointCache[lastUsedIndex]; | | // m_pointCache[index] = m_pointCache[lastUsedIndex]; | |
| if(index != lastUsedIndex) | | if(index != lastUsedIndex) | |
| { | | { | |
| m_pointCache[index] = m_pointCache[lastUsedIndex]; | | m_pointCache[index] = m_pointCache[lastUsedIndex]; | |
| //get rid of duplicated userPersistentData pointer | | //get rid of duplicated userPersistentData pointer | |
| m_pointCache[lastUsedIndex].m_userPersistentData = 0
; | | m_pointCache[lastUsedIndex].m_userPersistentData = 0
; | |
|
| | | m_pointCache[lastUsedIndex].mConstraintRow[0].mAccum | |
| | | Impulse = 0.f; | |
| | | m_pointCache[lastUsedIndex].mConstraintRow[1].mAccum | |
| | | Impulse = 0.f; | |
| | | m_pointCache[lastUsedIndex].mConstraintRow[2].mAccum | |
| | | Impulse = 0.f; | |
| | | | |
| m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f; | | m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f; | |
| m_pointCache[lastUsedIndex].m_lateralFrictionInitial
ized = false; | | m_pointCache[lastUsedIndex].m_lateralFrictionInitial
ized = false; | |
| m_pointCache[lastUsedIndex].m_appliedImpulseLateral1
= 0.f; | | m_pointCache[lastUsedIndex].m_appliedImpulseLateral1
= 0.f; | |
| m_pointCache[lastUsedIndex].m_appliedImpulseLateral2
= 0.f; | | m_pointCache[lastUsedIndex].m_appliedImpulseLateral2
= 0.f; | |
| m_pointCache[lastUsedIndex].m_lifeTime = 0; | | m_pointCache[lastUsedIndex].m_lifeTime = 0; | |
| } | | } | |
| | | | |
| btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0
); | | btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0
); | |
| m_cachedPoints--; | | m_cachedPoints--; | |
| } | | } | |
| void replaceContactPoint(const btManifoldPoint& newPoint,int insertI
ndex) | | void replaceContactPoint(const btManifoldPoint& newPoint,int insertI
ndex) | |
| { | | { | |
| btAssert(validContactDistance(newPoint)); | | btAssert(validContactDistance(newPoint)); | |
| | | | |
| #define MAINTAIN_PERSISTENCY 1 | | #define MAINTAIN_PERSISTENCY 1 | |
| #ifdef MAINTAIN_PERSISTENCY | | #ifdef MAINTAIN_PERSISTENCY | |
| int lifeTime = m_pointCache[insertIndex].getLifeTime(); | | int lifeTime = m_pointCache[insertIndex].getLifeTime(); | |
|
| btScalar appliedImpulse = m_pointCache[insertIndex].m | | btScalar appliedImpulse = m_pointCache[insertIndex].m | |
| _appliedImpulse; | | ConstraintRow[0].mAccumImpulse; | |
| btScalar appliedLateralImpulse1 = m_pointCache[insert | | btScalar appliedLateralImpulse1 = m_pointCache[insert | |
| Index].m_appliedImpulseLateral1; | | Index].mConstraintRow[1].mAccumImpulse; | |
| btScalar appliedLateralImpulse2 = m_pointCache[insert | | btScalar appliedLateralImpulse2 = m_pointCache[insert | |
| Index].m_appliedImpulseLateral2; | | Index].mConstraintRow[2].mAccumImpulse; | |
| | | // bool isLateralFrictionInitialized = m_pointCache[insertIndex | |
| | | ].m_lateralFrictionInitialized; | |
| | | | |
| btAssert(lifeTime>=0); | | btAssert(lifeTime>=0); | |
| void* cache = m_pointCache[insertIndex].m_userPersistentData
; | | void* cache = m_pointCache[insertIndex].m_userPersistentData
; | |
| | | | |
| m_pointCache[insertIndex] = newPoint; | | m_pointCache[insertIndex] = newPoint; | |
| | | | |
| m_pointCache[insertIndex].m_userPersistentData = cache; | | m_pointCache[insertIndex].m_userPersistentData = cache; | |
| m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; | | m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; | |
| m_pointCache[insertIndex].m_appliedImpulseLateral1 = applied
LateralImpulse1; | | m_pointCache[insertIndex].m_appliedImpulseLateral1 = applied
LateralImpulse1; | |
| m_pointCache[insertIndex].m_appliedImpulseLateral2 = applied
LateralImpulse2; | | m_pointCache[insertIndex].m_appliedImpulseLateral2 = applied
LateralImpulse2; | |
| | | | |
|
| | | m_pointCache[insertIndex].mConstraintRow[0].mAccumImpulse = | |
| | | appliedImpulse; | |
| | | m_pointCache[insertIndex].mConstraintRow[1].mAccumImpulse = | |
| | | appliedLateralImpulse1; | |
| | | m_pointCache[insertIndex].mConstraintRow[2].mAccumImpulse = | |
| | | appliedLateralImpulse2; | |
| | | | |
| m_pointCache[insertIndex].m_lifeTime = lifeTime; | | m_pointCache[insertIndex].m_lifeTime = lifeTime; | |
| #else | | #else | |
| clearUserCache(m_pointCache[insertIndex]); | | clearUserCache(m_pointCache[insertIndex]); | |
| m_pointCache[insertIndex] = newPoint; | | m_pointCache[insertIndex] = newPoint; | |
| | | | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| bool validContactDistance(const btManifoldPoint& pt) const | | bool validContactDistance(const btManifoldPoint& pt) const | |
| { | | { | |
| | | | |
End of changes. 6 change blocks. |
| 7 lines changed or deleted | | 29 lines changed or added | |
|
| btQuickprof.h | | btQuickprof.h | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| | | | |
| // Credits: The Clock class was inspired by the Timer classes in | | // Credits: The Clock class was inspired by the Timer classes in | |
| // Ogre (www.ogre3d.org). | | // Ogre (www.ogre3d.org). | |
| | | | |
| #ifndef QUICK_PROF_H | | #ifndef QUICK_PROF_H | |
| #define QUICK_PROF_H | | #define QUICK_PROF_H | |
| | | | |
| //To disable built-in profiling, please comment out next line | | //To disable built-in profiling, please comment out next line | |
| //#define BT_NO_PROFILE 1 | | //#define BT_NO_PROFILE 1 | |
| #ifndef BT_NO_PROFILE | | #ifndef BT_NO_PROFILE | |
|
| | | #include <stdio.h>//@todo remove this, backwards compatibility | |
| #include "btScalar.h" | | #include "btScalar.h" | |
| #include "btAlignedAllocator.h" | | #include "btAlignedAllocator.h" | |
| #include <new> | | #include <new> | |
| | | | |
|
| //if you don't need btClock, you can comment next line | | | |
| #define USE_BT_CLOCK 1 | | #define USE_BT_CLOCK 1 | |
| | | | |
| #ifdef USE_BT_CLOCK | | #ifdef USE_BT_CLOCK | |
|
| #ifdef __CELLOS_LV2__ | | | |
| #include <sys/sys_time.h> | | | |
| #include <sys/time_util.h> | | | |
| #include <stdio.h> | | | |
| #endif | | | |
| | | | |
| #if defined (SUNOS) || defined (__SUNOS__) | | | |
| #include <stdio.h> | | | |
| #endif | | | |
| | | | |
| #if defined(WIN32) || defined(_WIN32) | | | |
| | | | |
| #define USE_WINDOWS_TIMERS | | | |
| #define WIN32_LEAN_AND_MEAN | | | |
| #define NOWINRES | | | |
| #define NOMCX | | | |
| #define NOIME | | | |
| #ifdef _XBOX | | | |
| #include <Xtl.h> | | | |
| #else | | | |
| #include <windows.h> | | | |
| #endif | | | |
| #include <time.h> | | | |
| | | | |
| #else | | | |
| #include <sys/time.h> | | | |
| #endif | | | |
| | | | |
| #define mymin(a,b) (a > b ? a : b) | | | |
| | | | |
| ///The btClock is a portable basic clock that measures accurate time in sec
onds, use for profiling. | | ///The btClock is a portable basic clock that measures accurate time in sec
onds, use for profiling. | |
| class btClock | | class btClock | |
| { | | { | |
| public: | | public: | |
|
| btClock() | | btClock(); | |
| { | | | |
| #ifdef USE_WINDOWS_TIMERS | | | |
| QueryPerformanceFrequency(&mClockFrequency); | | | |
| #endif | | | |
| reset(); | | | |
| } | | | |
| | | | |
| ~btClock() | | | |
| { | | | |
| } | | | |
| | | | |
|
| /// Resets the initial reference time. | | btClock(const btClock& other); | |
| void reset() | | btClock& operator=(const btClock& other); | |
| { | | | |
| #ifdef USE_WINDOWS_TIMERS | | | |
| QueryPerformanceCounter(&mStartTime); | | | |
| mStartTick = GetTickCount(); | | | |
| mPrevElapsedTime = 0; | | | |
| #else | | | |
| #ifdef __CELLOS_LV2__ | | | |
| | | | |
|
| typedef uint64_t ClockSize; | | ~btClock(); | |
| ClockSize newTime; | | | |
| //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory | | | |
| "); | | | |
| SYS_TIMEBASE_GET( newTime ); | | | |
| mStartTime = newTime; | | | |
| #else | | | |
| gettimeofday(&mStartTime, 0); | | | |
| #endif | | | |
| | | | |
|
| #endif | | /// Resets the initial reference time. | |
| } | | void reset(); | |
| | | | |
| /// Returns the time in ms since the last call to reset or since | | /// Returns the time in ms since the last call to reset or since | |
| /// the btClock was created. | | /// the btClock was created. | |
|
| unsigned long int getTimeMilliseconds() | | unsigned long int getTimeMilliseconds(); | |
| { | | | |
| #ifdef USE_WINDOWS_TIMERS | | | |
| LARGE_INTEGER currentTime; | | | |
| QueryPerformanceCounter(¤tTime); | | | |
| LONGLONG elapsedTime = currentTime.QuadPart - | | | |
| mStartTime.QuadPart; | | | |
| | | | |
| // Compute the number of millisecond ticks elapsed. | | | |
| unsigned long msecTicks = (unsigned long)(1000 * elapsedTime | | | |
| / | | | |
| mClockFrequency.QuadPart); | | | |
| | | | |
| // Check for unexpected leaps in the Win32 performance count | | | |
| er. | | | |
| // (This is caused by unexpected data across the PCI to ISA | | | |
| // bridge, aka south bridge. See Microsoft KB274323.) | | | |
| unsigned long elapsedTicks = GetTickCount() - mStartTick; | | | |
| signed long msecOff = (signed long)(msecTicks - elapsedTicks | | | |
| ); | | | |
| if (msecOff < -100 || msecOff > 100) | | | |
| { | | | |
| // Adjust the starting time forwards. | | | |
| LONGLONG msecAdjustment = mymin(msecOff * | | | |
| mClockFrequency.QuadPart / 1000, elapsedTime | | | |
| - | | | |
| mPrevElapsedTime); | | | |
| mStartTime.QuadPart += msecAdjustment; | | | |
| elapsedTime -= msecAdjustment; | | | |
| | | | |
| // Recompute the number of millisecond ticks elapsed | | | |
| . | | | |
| msecTicks = (unsigned long)(1000 * elapsedTime / | | | |
| mClockFrequency.QuadPart); | | | |
| } | | | |
| | | | |
| // Store the current elapsed time for adjustments next time. | | | |
| mPrevElapsedTime = elapsedTime; | | | |
| | | | |
| return msecTicks; | | | |
| #else | | | |
| | | | |
| #ifdef __CELLOS_LV2__ | | | |
| uint64_t freq=sys_time_get_timebase_frequency(); | | | |
| double dFreq=((double) freq) / 1000.0; | | | |
| typedef uint64_t ClockSize; | | | |
| ClockSize newTime; | | | |
| SYS_TIMEBASE_GET( newTime ); | | | |
| //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory | | | |
| "); | | | |
| | | | |
| return (unsigned long int)((double(newTime-mStartTime)) / dF | | | |
| req); | | | |
| #else | | | |
| | | | |
| struct timeval currentTime; | | | |
| gettimeofday(¤tTime, 0); | | | |
| return (currentTime.tv_sec - mStartTime.tv_sec) * 1000 + | | | |
| (currentTime.tv_usec - mStartTime.tv_usec) / 1000; | | | |
| #endif //__CELLOS_LV2__ | | | |
| #endif | | | |
| } | | | |
| | | | |
| /// Returns the time in us since the last call to reset or since | | /// Returns the time in us since the last call to reset or since | |
| /// the Clock was created. | | /// the Clock was created. | |
|
| unsigned long int getTimeMicroseconds() | | unsigned long int getTimeMicroseconds(); | |
| { | | | |
| #ifdef USE_WINDOWS_TIMERS | | | |
| LARGE_INTEGER currentTime; | | | |
| QueryPerformanceCounter(¤tTime); | | | |
| LONGLONG elapsedTime = currentTime.QuadPart - | | | |
| mStartTime.QuadPart; | | | |
| | | | |
| // Compute the number of millisecond ticks elapsed. | | | |
| unsigned long msecTicks = (unsigned long)(1000 * elapsedTime | | | |
| / | | | |
| mClockFrequency.QuadPart); | | | |
| | | | |
| // Check for unexpected leaps in the Win32 performance count | | | |
| er. | | | |
| // (This is caused by unexpected data across the PCI to ISA | | | |
| // bridge, aka south bridge. See Microsoft KB274323.) | | | |
| unsigned long elapsedTicks = GetTickCount() - mStartTick; | | | |
| signed long msecOff = (signed long)(msecTicks - elapsedTicks | | | |
| ); | | | |
| if (msecOff < -100 || msecOff > 100) | | | |
| { | | | |
| // Adjust the starting time forwards. | | | |
| LONGLONG msecAdjustment = mymin(msecOff * | | | |
| mClockFrequency.QuadPart / 1000, elapsedTime | | | |
| - | | | |
| mPrevElapsedTime); | | | |
| mStartTime.QuadPart += msecAdjustment; | | | |
| elapsedTime -= msecAdjustment; | | | |
| } | | | |
| | | | |
| // Store the current elapsed time for adjustments next time. | | | |
| mPrevElapsedTime = elapsedTime; | | | |
| | | | |
| // Convert to microseconds. | | | |
| unsigned long usecTicks = (unsigned long)(1000000 * elapsedT | | | |
| ime / | | | |
| mClockFrequency.QuadPart); | | | |
| | | | |
| return usecTicks; | | | |
| #else | | | |
| | | | |
| #ifdef __CELLOS_LV2__ | | | |
| uint64_t freq=sys_time_get_timebase_frequency(); | | | |
| double dFreq=((double) freq)/ 1000000.0; | | | |
| typedef uint64_t ClockSize; | | | |
| ClockSize newTime; | | | |
| //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory | | | |
| "); | | | |
| SYS_TIMEBASE_GET( newTime ); | | | |
| | | | |
| return (unsigned long int)((double(newTime-mStartTime)) / dF | | | |
| req); | | | |
| #else | | | |
| | | | |
| struct timeval currentTime; | | | |
| gettimeofday(¤tTime, 0); | | | |
| return (currentTime.tv_sec - mStartTime.tv_sec) * 1000000 + | | | |
| (currentTime.tv_usec - mStartTime.tv_usec); | | | |
| #endif//__CELLOS_LV2__ | | | |
| #endif | | | |
| } | | | |
| | | | |
| private: | | private: | |
|
| #ifdef USE_WINDOWS_TIMERS | | struct btClockData* m_data; | |
| LARGE_INTEGER mClockFrequency; | | | |
| DWORD mStartTick; | | | |
| LONGLONG mPrevElapsedTime; | | | |
| LARGE_INTEGER mStartTime; | | | |
| #else | | | |
| #ifdef __CELLOS_LV2__ | | | |
| uint64_t mStartTime; | | | |
| #else | | | |
| struct timeval mStartTime; | | | |
| #endif | | | |
| #endif //__CELLOS_LV2__ | | | |
| | | | |
| }; | | }; | |
| | | | |
| #endif //USE_BT_CLOCK | | #endif //USE_BT_CLOCK | |
| | | | |
| ///A node in the Profile Hierarchy Tree | | ///A node in the Profile Hierarchy Tree | |
| class CProfileNode { | | class CProfileNode { | |
| | | | |
| public: | | public: | |
| CProfileNode( const char * name, CProfileNode * parent ); | | CProfileNode( const char * name, CProfileNode * parent ); | |
| ~CProfileNode( void ); | | ~CProfileNode( void ); | |
| | | | |
End of changes. 10 change blocks. |
| 200 lines changed or deleted | | 10 lines changed or added | |
|
| btRigidBody.h | | btRigidBody.h | |
| | | | |
| skipping to change at line 183 | | skipping to change at line 183 | |
| void setupRigidBody(const btRigidBodyConstructionInfo& constructi
onInfo); | | void setupRigidBody(const btRigidBodyConstructionInfo& constructi
onInfo); | |
| | | | |
| public: | | public: | |
| | | | |
| void proceedToTransform(const btTransform& newTra
ns); | | void proceedToTransform(const btTransform& newTra
ns); | |
| | | | |
| ///to keep collision detection and dynamics separate we don't store
a rigidbody pointer | | ///to keep collision detection and dynamics separate we don't store
a rigidbody pointer | |
| ///but a rigidbody is derived from btCollisionObject, so we can safe
ly perform an upcast | | ///but a rigidbody is derived from btCollisionObject, so we can safe
ly perform an upcast | |
| static const btRigidBody* upcast(const btCollisionObject* colO
bj) | | static const btRigidBody* upcast(const btCollisionObject* colO
bj) | |
| { | | { | |
|
| if (colObj->getInternalType()==btCollisionObject::CO_RIGID_B
ODY) | | if (colObj->getInternalType()&btCollisionObject::CO_RIGID_BO
DY) | |
| return (const btRigidBody*)colObj; | | return (const btRigidBody*)colObj; | |
| return 0; | | return 0; | |
| } | | } | |
| static btRigidBody* upcast(btCollisionObject* colObj) | | static btRigidBody* upcast(btCollisionObject* colObj) | |
| { | | { | |
|
| if (colObj->getInternalType()==btCollisionObject::CO_RIGID_B
ODY) | | if (colObj->getInternalType()&btCollisionObject::CO_RIGID_BO
DY) | |
| return (btRigidBody*)colObj; | | return (btRigidBody*)colObj; | |
| return 0; | | return 0; | |
| } | | } | |
| | | | |
| /// continuous collision detection needs prediction | | /// continuous collision detection needs prediction | |
| void predictIntegratedTransform(btScalar step, bt
Transform& predictedTransform) ; | | void predictIntegratedTransform(btScalar step, bt
Transform& predictedTransform) ; | |
| | | | |
| void saveKinematicState(btScalar step); | | void saveKinematicState(btScalar step); | |
| | | | |
| void applyGravity(); | | void applyGravity(); | |
| | | | |
| skipping to change at line 506 | | skipping to change at line 506 | |
| void setFlags(int flags) | | void setFlags(int flags) | |
| { | | { | |
| m_rigidbodyFlags = flags; | | m_rigidbodyFlags = flags; | |
| } | | } | |
| | | | |
| int getFlags() const | | int getFlags() const | |
| { | | { | |
| return m_rigidbodyFlags; | | return m_rigidbodyFlags; | |
| } | | } | |
| | | | |
|
| | | const btVector3& getDeltaLinearVelocity() const | |
| | | { | |
| | | return m_deltaLinearVelocity; | |
| | | } | |
| | | | |
| | | const btVector3& getDeltaAngularVelocity() const | |
| | | { | |
| | | return m_deltaAngularVelocity; | |
| | | } | |
| | | | |
| | | const btVector3& getPushVelocity() const | |
| | | { | |
| | | return m_pushVelocity; | |
| | | } | |
| | | | |
| | | const btVector3& getTurnVelocity() const | |
| | | { | |
| | | return m_turnVelocity; | |
| | | } | |
| | | | |
| //////////////////////////////////////////////// | | //////////////////////////////////////////////// | |
| ///some internal methods, don't use them | | ///some internal methods, don't use them | |
| | | | |
| btVector3& internalGetDeltaLinearVelocity() | | btVector3& internalGetDeltaLinearVelocity() | |
| { | | { | |
| return m_deltaLinearVelocity; | | return m_deltaLinearVelocity; | |
| } | | } | |
| | | | |
| btVector3& internalGetDeltaAngularVelocity() | | btVector3& internalGetDeltaAngularVelocity() | |
| { | | { | |
| | | | |
| skipping to change at line 574 | | skipping to change at line 594 | |
| m_turnVelocity += angularComponent*(impulseMagnitude
*m_angularFactor); | | m_turnVelocity += angularComponent*(impulseMagnitude
*m_angularFactor); | |
| } | | } | |
| } | | } | |
| | | | |
| void internalWritebackVelocity() | | void internalWritebackVelocity() | |
| { | | { | |
| if (m_inverseMass) | | if (m_inverseMass) | |
| { | | { | |
| setLinearVelocity(getLinearVelocity()+ m_deltaLinear
Velocity); | | setLinearVelocity(getLinearVelocity()+ m_deltaLinear
Velocity); | |
| setAngularVelocity(getAngularVelocity()+m_deltaAngul
arVelocity); | | setAngularVelocity(getAngularVelocity()+m_deltaAngul
arVelocity); | |
|
| m_deltaLinearVelocity.setZero(); | | //m_deltaLinearVelocity.setZero(); | |
| m_deltaAngularVelocity .setZero(); | | //m_deltaAngularVelocity .setZero(); | |
| //m_originalBody->setCompanionId(-1); | | //m_originalBody->setCompanionId(-1); | |
| } | | } | |
| } | | } | |
| | | | |
| void internalWritebackVelocity(btScalar timeStep); | | void internalWritebackVelocity(btScalar timeStep); | |
| | | | |
| /////////////////////////////////////////////// | | /////////////////////////////////////////////// | |
| | | | |
| virtual int calculateSerializeBufferSize() const; | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 24 lines changed or added | |
|
| btScalar.h | | btScalar.h | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| #pragma unmanaged | | #pragma unmanaged | |
| #endif | | #endif | |
| | | | |
| #include <math.h> | | #include <math.h> | |
| #include <stdlib.h>//size_t for MSVC 6.0 | | #include <stdlib.h>//size_t for MSVC 6.0 | |
| #include <cstdlib> | | #include <cstdlib> | |
| #include <cfloat> | | #include <cfloat> | |
| #include <float.h> | | #include <float.h> | |
| | | | |
| /* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/ | | /* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/ | |
|
| #define BT_BULLET_VERSION 276 | | #define BT_BULLET_VERSION 277 | |
| | | | |
| inline int btGetVersion() | | inline int btGetVersion() | |
| { | | { | |
| return BT_BULLET_VERSION; | | return BT_BULLET_VERSION; | |
| } | | } | |
| | | | |
| #if defined(DEBUG) || defined (_DEBUG) | | #if defined(DEBUG) || defined (_DEBUG) | |
| #define BT_DEBUG | | #define BT_DEBUG | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 92 | | skipping to change at line 92 | |
| #endif | | #endif | |
| //btFullAssert is optional, slows down a lot | | //btFullAssert is optional, slows down a lot | |
| #define btFullAssert(x) | | #define btFullAssert(x) | |
| | | | |
| #define btLikely(_c) _c | | #define btLikely(_c) _c | |
| #define btUnlikely(_c) _c | | #define btUnlikely(_c) _c | |
| | | | |
| #else | | #else | |
| | | | |
| #if defined (__CELLOS_LV2__) | | #if defined (__CELLOS_LV2__) | |
|
| #define SIMD_FORCE_INLINE inline | | #define SIMD_FORCE_INLINE inline __attribute__((always_inlin
e)) | |
| #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16
))) | | #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16
))) | |
| #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64
))) | | #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64
))) | |
| #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (1
28))) | | #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (1
28))) | |
| #ifndef assert | | #ifndef assert | |
| #include <assert.h> | | #include <assert.h> | |
| #endif | | #endif | |
| #ifdef BT_DEBUG | | #ifdef BT_DEBUG | |
|
| #define btAssert assert | | #ifdef __SPU__ | |
| | | #include <spu_printf.h> | |
| | | #define printf spu_printf | |
| | | #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n | |
| | | ", __LINE__);spu_hcmpeq(0,0);}} | |
| | | #else | |
| | | #define btAssert assert | |
| | | #endif | |
| | | | |
| #else | | #else | |
| #define btAssert(x) | | #define btAssert(x) | |
| #endif | | #endif | |
| //btFullAssert is optional, slows down a lot | | //btFullAssert is optional, slows down a lot | |
| #define btFullAssert(x) | | #define btFullAssert(x) | |
| | | | |
| #define btLikely(_c) _c | | #define btLikely(_c) _c | |
| #define btUnlikely(_c) _c | | #define btUnlikely(_c) _c | |
| | | | |
| #else | | #else | |
| | | | |
| skipping to change at line 238 | | skipping to change at line 245 | |
| | | | |
| SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) | | SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) | |
| { | | { | |
| #ifdef USE_APPROXIMATION | | #ifdef USE_APPROXIMATION | |
| double x, z, tempf; | | double x, z, tempf; | |
| unsigned long *tfptr = ((unsigned long *)&tempf) + 1; | | unsigned long *tfptr = ((unsigned long *)&tempf) + 1; | |
| | | | |
| tempf = y; | | tempf = y; | |
| *tfptr = (0xbfcdd90a - *tfptr)>>1; /* estimate of 1/sqrt(y) */ | | *tfptr = (0xbfcdd90a - *tfptr)>>1; /* estimate of 1/sqrt(y) */ | |
| x = tempf; | | x = tempf; | |
|
| z = y*btScalar(0.5); /* hoist out the | | z = y*btScalar(0.5); | |
| x = (btScalar(1.5)*x)-(x*x)*(x*z); /* iteration formula
*/ | | x = (btScalar(1.5)*x)-(x*x)*(x*z); /* iteration formula
*/ | |
| x = (btScalar(1.5)*x)-(x*x)*(x*z); | | x = (btScalar(1.5)*x)-(x*x)*(x*z); | |
| x = (btScalar(1.5)*x)-(x*x)*(x*z); | | x = (btScalar(1.5)*x)-(x*x)*(x*z); | |
| x = (btScalar(1.5)*x)-(x*x)*(x*z); | | x = (btScalar(1.5)*x)-(x*x)*(x*z); | |
| x = (btScalar(1.5)*x)-(x*x)*(x*z); | | x = (btScalar(1.5)*x)-(x*x)*(x*z); | |
| return x*y; | | return x*y; | |
| #else | | #else | |
| return sqrtf(y); | | return sqrtf(y); | |
| #endif | | #endif | |
| } | | } | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 12 lines changed or added | |
|
| btSequentialImpulseConstraintSolver.h | | btSequentialImpulseConstraintSolver.h | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| | | | |
| void resolveSingleConstraintRowGeneric(btRigidBody& body1,btRigid
Body& body2,const btSolverConstraint& contactConstraint); | | void resolveSingleConstraintRowGeneric(btRigidBody& body1,btRigid
Body& body2,const btSolverConstraint& contactConstraint); | |
| | | | |
| void resolveSingleConstraintRowGenericSIMD(btRigidBody& body1,btR
igidBody& body2,const btSolverConstraint& contactConstraint); | | void resolveSingleConstraintRowGenericSIMD(btRigidBody& body1,btR
igidBody& body2,const btSolverConstraint& contactConstraint); | |
| | | | |
| void resolveSingleConstraintRowLowerLimit(btRigidBody& body1,btRi
gidBody& body2,const btSolverConstraint& contactConstraint); | | void resolveSingleConstraintRowLowerLimit(btRigidBody& body1,btRi
gidBody& body2,const btSolverConstraint& contactConstraint); | |
| | | | |
| void resolveSingleConstraintRowLowerLimitSIMD(btRigidBody& body1,
btRigidBody& body2,const btSolverConstraint& contactConstraint); | | void resolveSingleConstraintRowLowerLimitSIMD(btRigidBody& body1,
btRigidBody& body2,const btSolverConstraint& contactConstraint); | |
| | | | |
| protected: | | protected: | |
|
| static btRigidBody& getFixedBody() | | static btRigidBody& getFixedBody(); | |
| { | | | |
| static btRigidBody s_fixed(0, 0,0); | | | |
| s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btS | | | |
| calar(0.),btScalar(0.))); | | | |
| return s_fixed; | | | |
| } | | | |
| virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisi
onObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int num
Manifolds,btTypedConstraint** constraints,int numConstraints,const btContac
tSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc)
; | | virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisi
onObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int num
Manifolds,btTypedConstraint** constraints,int numConstraints,const btContac
tSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc)
; | |
| virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** b
odies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,b
tTypedConstraint** constraints,int numConstraints,const btContactSolverInfo
& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | | virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** b
odies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,b
tTypedConstraint** constraints,int numConstraints,const btContactSolverInfo
& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | |
| btScalar solveSingleIteration(int iteration, btCollisionObject** bod
ies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btT
ypedConstraint** constraints,int numConstraints,const btContactSolverInfo&
infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | | btScalar solveSingleIteration(int iteration, btCollisionObject** bod
ies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btT
ypedConstraint** constraints,int numConstraints,const btContactSolverInfo&
infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | |
| | | | |
| virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bo
dies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btT
ypedConstraint** constraints,int numConstraints,const btContactSolverInfo&
infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | | virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bo
dies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btT
ypedConstraint** constraints,int numConstraints,const btContactSolverInfo&
infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | |
| virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject
** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifold
s,btTypedConstraint** constraints,int numConstraints,const btContactSolverI
nfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | | virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject
** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifold
s,btTypedConstraint** constraints,int numConstraints,const btContactSolverI
nfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); | |
| | | | |
| public: | | public: | |
| | | | |
| btSequentialImpulseConstraintSolver(); | | btSequentialImpulseConstraintSolver(); | |
| | | | |
End of changes. 1 change blocks. |
| 7 lines changed or deleted | | 2 lines changed or added | |
|
| btSerializer.h | | btSerializer.h | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 116 | |
| #endif | | #endif | |
| | | | |
| #define BT_COLLISIONOBJECT_CODE MAKE_ID('C','O','B','J') | | #define BT_COLLISIONOBJECT_CODE MAKE_ID('C','O','B','J') | |
| #define BT_RIGIDBODY_CODE MAKE_ID('R','B','D','Y') | | #define BT_RIGIDBODY_CODE MAKE_ID('R','B','D','Y') | |
| #define BT_CONSTRAINT_CODE MAKE_ID('C','O','N','S') | | #define BT_CONSTRAINT_CODE MAKE_ID('C','O','N','S') | |
| #define BT_BOXSHAPE_CODE MAKE_ID('B','O','X','S') | | #define BT_BOXSHAPE_CODE MAKE_ID('B','O','X','S') | |
| #define BT_QUANTIZED_BVH_CODE MAKE_ID('Q','B','V','H') | | #define BT_QUANTIZED_BVH_CODE MAKE_ID('Q','B','V','H') | |
| #define BT_TRIANLGE_INFO_MAP MAKE_ID('T','M','A','P') | | #define BT_TRIANLGE_INFO_MAP MAKE_ID('T','M','A','P') | |
| #define BT_SHAPE_CODE MAKE_ID('S','H','A','P') | | #define BT_SHAPE_CODE MAKE_ID('S','H','A','P') | |
| #define BT_ARRAY_CODE MAKE_ID('A','R','A','Y') | | #define BT_ARRAY_CODE MAKE_ID('A','R','A','Y') | |
|
| | | #define BT_DNA_CODE MAKE_ID('D','N','A','1') | |
| | | | |
| struct btPointerUid | | struct btPointerUid | |
| { | | { | |
| union | | union | |
| { | | { | |
| void* m_ptr; | | void* m_ptr; | |
| int m_uniqueIds[2]; | | int m_uniqueIds[2]; | |
| }; | | }; | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 165 | |
| virtual void* findPointer(void* oldPtr) | | virtual void* findPointer(void* oldPtr) | |
| { | | { | |
| void** ptr = m_chunkP.find(oldPtr); | | void** ptr = m_chunkP.find(oldPtr); | |
| if (ptr && *ptr) | | if (ptr && *ptr) | |
| return *ptr; | | return *ptr; | |
| return 0; | | return 0; | |
| } | | } | |
| | | | |
| void writeDNA() | | void writeDNA() | |
| { | | { | |
|
| unsigned char* dnaTarget = m_buffer+m_currentSize; | | btChunk* dnaChunk = allocate(m_dnaLength,1); | |
| memcpy(dnaTarget,m_dna,m_dnaLength); | | memcpy(dnaChunk->m_oldPtr,m_dna,m_dnaLength); | |
| m_currentSize += m_dnaLength; | | finalizeChunk(dnaChunk,"DNA1",BT_DNA_CODE, m_dna); | |
| } | | } | |
| | | | |
| int getReverseType(const char *type) const | | int getReverseType(const char *type) const | |
| { | | { | |
| | | | |
| btHashString key(type); | | btHashString key(type); | |
| const int* valuePtr = mTypeLookup.find(key); | | const int* valuePtr = mTypeLookup.find(key); | |
| if (valuePtr) | | if (valuePtr) | |
| return *valuePtr; | | return *valuePtr; | |
| | | | |
| | | | |
| skipping to change at line 431 | | skipping to change at line 432 | |
| if (littleEndian) | | if (littleEndian) | |
| { | | { | |
| m_buffer[8]='v'; | | m_buffer[8]='v'; | |
| } else | | } else | |
| { | | { | |
| m_buffer[8]='V'; | | m_buffer[8]='V'; | |
| } | | } | |
| | | | |
| m_buffer[9] = '2'; | | m_buffer[9] = '2'; | |
| m_buffer[10] = '7'; | | m_buffer[10] = '7'; | |
|
| m_buffer[11] = '6'; | | m_buffer[11] = '7'; | |
| | | | |
| } | | } | |
| | | | |
| virtual void finishSerialization() | | virtual void finishSerialization() | |
| { | | { | |
| writeDNA(); | | writeDNA(); | |
| | | | |
| mTypes.clear(); | | mTypes.clear(); | |
| mStructs.clear(); | | mStructs.clear(); | |
| mTlens.clear(); | | mTlens.clear(); | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 5 lines changed or added | |
|
| btSoftBody.h | | btSoftBody.h | |
| | | | |
| skipping to change at line 591 | | skipping to change at line 591 | |
| static inline btScalar rayFromToTriangle(const btVector3& r
ayFrom, | | static inline btScalar rayFromToTriangle(const btVector3& r
ayFrom, | |
| const btVector3& rayTo, | | const btVector3& rayTo, | |
| const btVector3& rayNormalizedDirection, | | const btVector3& rayNormalizedDirection, | |
| const btVector3& a, | | const btVector3& a, | |
| const btVector3& b, | | const btVector3& b, | |
| const btVector3& c, | | const btVector3& c, | |
| btScalar maxt=SIMD_INFINITY); | | btScalar maxt=SIMD_INFINITY); | |
| }; | | }; | |
| | | | |
| // | | // | |
|
| // Typedef's | | // Typedefs | |
| // | | // | |
| | | | |
| typedef void
(*psolver_t)(btSoftBody*,btScalar,btScalar); | | typedef void
(*psolver_t)(btSoftBody*,btScalar,btScalar); | |
| typedef void
(*vsolver_t)(btSoftBody*,btScalar); | | typedef void
(*vsolver_t)(btSoftBody*,btScalar); | |
| typedef btAlignedObjectArray<Cluster*> tClusterArray; | | typedef btAlignedObjectArray<Cluster*> tClusterArray; | |
| typedef btAlignedObjectArray<Note> tNoteArray; | | typedef btAlignedObjectArray<Note> tNoteArray; | |
| typedef btAlignedObjectArray<Node> tNodeArray; | | typedef btAlignedObjectArray<Node> tNodeArray; | |
| typedef btAlignedObjectArray<btDbvtNode*> tLeafArray; | | typedef btAlignedObjectArray<btDbvtNode*> tLeafArray; | |
| typedef btAlignedObjectArray<Link> tLinkArray; | | typedef btAlignedObjectArray<Link> tLinkArray; | |
| typedef btAlignedObjectArray<Face> tFaceArray; | | typedef btAlignedObjectArray<Face> tFaceArray; | |
| | | | |
| skipping to change at line 641 | | skipping to change at line 641 | |
| bool m_bUpdateRtCst; // Update ru
ntime constants | | bool m_bUpdateRtCst; // Update ru
ntime constants | |
| btDbvt m_ndbvt; // N
odes tree | | btDbvt m_ndbvt; // N
odes tree | |
| btDbvt m_fdbvt; // F
aces tree | | btDbvt m_fdbvt; // F
aces tree | |
| btDbvt m_cdbvt; // C
lusters tree | | btDbvt m_cdbvt; // C
lusters tree | |
| tClusterArray m_clusters; // Clusters | | tClusterArray m_clusters; // Clusters | |
| | | | |
| btAlignedObjectArray<bool>m_clusterConnectivity;//cluster connectivi
ty, for self-collision | | btAlignedObjectArray<bool>m_clusterConnectivity;//cluster connectivi
ty, for self-collision | |
| | | | |
| btTransform m_initialWorldTransform; | | btTransform m_initialWorldTransform; | |
| | | | |
|
| | | btVector3 m_windVelocity; | |
| // | | // | |
| // Api | | // Api | |
| // | | // | |
| | | | |
| /* ctor
*/ | | /* ctor
*/ | |
| btSoftBody( btSoftBodyWorldInfo* worldInfo,int node_count, | | btSoftBody( btSoftBodyWorldInfo* worldInfo,int node_count, | |
| const btVector3* x, | | const btVector3* x, | |
| const btScalar* m); | | const btScalar* m); | |
| /* dtor
*/ | | /* dtor
*/ | |
| virtual ~btSoftBody(); | | virtual ~btSoftBody(); | |
| | | | |
| skipping to change at line 829 | | skipping to change at line 830 | |
| static void solveCommonConstraints(btSoftBody**
bodies,int count,int iterations); | | static void solveCommonConstraints(btSoftBody**
bodies,int count,int iterations); | |
| /* solveClusters
*/ | | /* solveClusters
*/ | |
| static void solveClusters(const btAlignedObjectA
rray<btSoftBody*>& bodies); | | static void solveClusters(const btAlignedObjectA
rray<btSoftBody*>& bodies); | |
| /* integrateMotion
*/ | | /* integrateMotion
*/ | |
| void integrateMotion(); | | void integrateMotion(); | |
| /* defaultCollisionHandlers
*/ | | /* defaultCollisionHandlers
*/ | |
| void defaultCollisionHandler(btCollisionO
bject* pco); | | void defaultCollisionHandler(btCollisionO
bject* pco); | |
| void defaultCollisionHandler(btSoftBody*
psb); | | void defaultCollisionHandler(btSoftBody*
psb); | |
| | | | |
| // | | // | |
|
| | | // Functionality to deal with new accelerated solvers. | |
| | | // | |
| | | | |
| | | /** | |
| | | * Set a wind velocity for interaction with the air. | |
| | | */ | |
| | | void setWindVelocity( const btVector3 &velocity ); | |
| | | | |
| | | /** | |
| | | * Return the wind velocity for interaction with the air. | |
| | | */ | |
| | | const btVector3& getWindVelocity(); | |
| | | | |
| | | // | |
| // Cast | | // Cast | |
| // | | // | |
| | | | |
| static const btSoftBody* upcast(const btCollisionObject* colO
bj) | | static const btSoftBody* upcast(const btCollisionObject* colO
bj) | |
| { | | { | |
| if (colObj->getInternalType()==CO_SOFT_BODY) | | if (colObj->getInternalType()==CO_SOFT_BODY) | |
| return (const btSoftBody*)colObj; | | return (const btSoftBody*)colObj; | |
| return 0; | | return 0; | |
| } | | } | |
| static btSoftBody* upcast(btCollisionObject* co
lObj) | | static btSoftBody* upcast(btCollisionObject* co
lObj) | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 16 lines changed or added | |
|
| btSoftRigidDynamicsWorld.h | | btSoftRigidDynamicsWorld.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| */ | | */ | |
| | | | |
| #ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H | | #ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H | |
| #define BT_SOFT_RIGID_DYNAMICS_WORLD_H | | #define BT_SOFT_RIGID_DYNAMICS_WORLD_H | |
| | | | |
| #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" | | #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" | |
| #include "btSoftBody.h" | | #include "btSoftBody.h" | |
| | | | |
| typedef btAlignedObjectArray<btSoftBody*> btSoftBodyArray; | | typedef btAlignedObjectArray<btSoftBody*> btSoftBodyArray; | |
| | | | |
|
| | | class btSoftBodySolver; | |
| | | | |
| class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld | | class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld | |
| { | | { | |
| | | | |
| btSoftBodyArray m_softBodies; | | btSoftBodyArray m_softBodies; | |
| int m_drawFlags; | | int m_drawFlags; | |
| bool m_drawNodeTree; | | bool m_drawNodeTree; | |
| bool m_drawFaceTree; | | bool m_drawFaceTree; | |
| bool m_drawClusterTree; | | bool m_drawClusterTree; | |
| btSoftBodyWorldInfo m_sbi; | | btSoftBodyWorldInfo m_sbi; | |
|
| | | ///Solver classes that encapsulate multiple soft bodies for solving | |
| | | btSoftBodySolver *m_softBodySolver; | |
| | | bool m_ownsSolver; | |
| | | | |
| protected: | | protected: | |
| | | | |
| virtual void predictUnconstraintMotion(btScalar timeStep); | | virtual void predictUnconstraintMotion(btScalar timeStep); | |
| | | | |
| virtual void internalSingleStepSimulation( btScalar timeStep); | | virtual void internalSingleStepSimulation( btScalar timeStep); | |
| | | | |
|
| void updateSoftBodies(); | | void solveSoftBodiesConstraints( btScalar timeStep ); | |
| | | | |
| void solveSoftBodiesConstraints(); | | | |
| | | | |
| public: | | public: | |
| | | | |
|
| btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterf
ace* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguratio
n* collisionConfiguration); | | btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterf
ace* pairCache,btConstraintSolver* constraintSolver, btCollisionConfigurati
on* collisionConfiguration, btSoftBodySolver *softBodySolver = 0 ); | |
| | | | |
| virtual ~btSoftRigidDynamicsWorld(); | | virtual ~btSoftRigidDynamicsWorld(); | |
| | | | |
| virtual void debugDrawWorld(); | | virtual void debugDrawWorld(); | |
| | | | |
| void addSoftBody(btSoftBody* body,short int collisionFilterGroup=
btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphase
Proxy::AllFilter); | | void addSoftBody(btSoftBody* body,short int collisionFilterGroup=
btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphase
Proxy::AllFilter); | |
| | | | |
| void removeSoftBody(btSoftBody* body); | | void removeSoftBody(btSoftBody* body); | |
| | | | |
| ///removeCollisionObject will first check if it is a rigid body, if
so call removeRigidBody otherwise call btDiscreteDynamicsWorld::removeColli
sionObject | | ///removeCollisionObject will first check if it is a rigid body, if
so call removeRigidBody otherwise call btDiscreteDynamicsWorld::removeColli
sionObject | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 7 lines changed or added | |
|
| btTransformUtil.h | | btTransformUtil.h | |
| | | | |
| skipping to change at line 178 | | skipping to change at line 178 | |
| btQuaternion toOrnB = transB.getRotation(); | | btQuaternion toOrnB = transB.getRotation(); | |
| | | | |
| if (m_separatingDistance>0.f) | | if (m_separatingDistance>0.f) | |
| { | | { | |
| | | | |
| btVector3 linVelA,angVelA,linVelB,angVelB; | | btVector3 linVelA,angVelA,linVelB,angVelB; | |
| btTransformUtil::calculateVelocityQuaternion(m_posA,
toPosA,m_ornA,toOrnA,btScalar(1.),linVelA,angVelA); | | btTransformUtil::calculateVelocityQuaternion(m_posA,
toPosA,m_ornA,toOrnA,btScalar(1.),linVelA,angVelA); | |
| btTransformUtil::calculateVelocityQuaternion(m_posB,
toPosB,m_ornB,toOrnB,btScalar(1.),linVelB,angVelB); | | btTransformUtil::calculateVelocityQuaternion(m_posB,
toPosB,m_ornB,toOrnB,btScalar(1.),linVelB,angVelB); | |
| btScalar maxAngularProjectedVelocity = angVelA.lengt
h() * m_boundingRadiusA + angVelB.length() * m_boundingRadiusB; | | btScalar maxAngularProjectedVelocity = angVelA.lengt
h() * m_boundingRadiusA + angVelB.length() * m_boundingRadiusB; | |
| btVector3 relLinVel = (linVelB-linVelA); | | btVector3 relLinVel = (linVelB-linVelA); | |
|
| btScalar relLinVelocLength = (linVelB-linVelA).dot(m
_separatingNormal); | | btScalar relLinVelocLength = relLinVel.dot(m_separat
ingNormal); | |
| if (relLinVelocLength<0.f) | | if (relLinVelocLength<0.f) | |
| { | | { | |
| relLinVelocLength = 0.f; | | relLinVelocLength = 0.f; | |
| } | | } | |
| | | | |
| btScalar projectedMotion = maxAngularProjecte
dVelocity +relLinVelocLength; | | btScalar projectedMotion = maxAngularProjecte
dVelocity +relLinVelocLength; | |
| m_separatingDistance -= projectedMotion; | | m_separatingDistance -= projectedMotion; | |
| } | | } | |
| | | | |
| m_posA = toPosA; | | m_posA = toPosA; | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| btTypedConstraint.h | | btTypedConstraint.h | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| #if 1 | | #if 1 | |
| #define btAssertConstrParams(_par) btAssert(_par) | | #define btAssertConstrParams(_par) btAssert(_par) | |
| #else | | #else | |
| #define btAssertConstrParams(_par) | | #define btAssertConstrParams(_par) | |
| #endif | | #endif | |
| | | | |
| ///TypedConstraint is the baseclass for Bullet constraints and vehicles | | ///TypedConstraint is the baseclass for Bullet constraints and vehicles | |
| class btTypedConstraint : public btTypedObject | | class btTypedConstraint : public btTypedObject | |
| { | | { | |
| int m_userConstraintType; | | int m_userConstraintType; | |
|
| int m_userConstraintId; | | | |
| | | union | |
| | | { | |
| | | int m_userConstraintId; | |
| | | void* m_userConstraintPtr; | |
| | | }; | |
| | | | |
| bool m_needsFeedback; | | bool m_needsFeedback; | |
| | | | |
| btTypedConstraint& operator=(btTypedConstraint& other) | | btTypedConstraint& operator=(btTypedConstraint& other) | |
| { | | { | |
| btAssert(0); | | btAssert(0); | |
| (void) other; | | (void) other; | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| protected: | | protected: | |
| btRigidBody& m_rbA; | | btRigidBody& m_rbA; | |
| btRigidBody& m_rbB; | | btRigidBody& m_rbB; | |
| btScalar m_appliedImpulse; | | btScalar m_appliedImpulse; | |
| btScalar m_dbgDrawSize; | | btScalar m_dbgDrawSize; | |
| | | | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
| btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppL
im, btScalar vel, btScalar timeFact); | | btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppL
im, btScalar vel, btScalar timeFact); | |
| | | | |
|
| static btRigidBody& getFixedBody() | | static btRigidBody& getFixedBody(); | |
| { | | | |
| static btRigidBody s_fixed(0, 0,0); | | | |
| s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btS | | | |
| calar(0.),btScalar(0.))); | | | |
| return s_fixed; | | | |
| } | | | |
| | | | |
| public: | | public: | |
| | | | |
| virtual ~btTypedConstraint() {}; | | virtual ~btTypedConstraint() {}; | |
| btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA); | | btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA); | |
| btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA,btRig
idBody& rbB); | | btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA,btRig
idBody& rbB); | |
| | | | |
| struct btConstraintInfo1 { | | struct btConstraintInfo1 { | |
| int m_numConstraintRows,nub; | | int m_numConstraintRows,nub; | |
| }; | | }; | |
| | | | |
| skipping to change at line 119 | | skipping to change at line 120 | |
| // lo and hi limits for variables (set to -/+ infinity on en
try). | | // lo and hi limits for variables (set to -/+ infinity on en
try). | |
| btScalar *m_lowerLimit,*m_upperLimit; | | btScalar *m_lowerLimit,*m_upperLimit; | |
| | | | |
| // findex vector for variables. see the LCP solver interface
for a | | // findex vector for variables. see the LCP solver interface
for a | |
| // description of what this does. this is set to -1 on entry
. | | // description of what this does. this is set to -1 on entry
. | |
| // note that the returned indexes are relative to the first
index of | | // note that the returned indexes are relative to the first
index of | |
| // the constraint. | | // the constraint. | |
| int *findex; | | int *findex; | |
| // number of solver iterations | | // number of solver iterations | |
| int m_numIterations; | | int m_numIterations; | |
|
| | | | |
| | | //damping of the velocity | |
| | | btScalar m_damping; | |
| }; | | }; | |
| | | | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
| virtual void buildJacobian() {}; | | virtual void buildJacobian() {}; | |
| | | | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
| virtual void setupSolverConstraint(btConstraintArray& ca, int sol
verBodyA,int solverBodyB, btScalar timeStep) | | virtual void setupSolverConstraint(btConstraintArray& ca, int sol
verBodyA,int solverBodyB, btScalar timeStep) | |
| { | | { | |
| (void)ca; | | (void)ca; | |
| (void)solverBodyA; | | (void)solverBodyA; | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 155 | |
| { | | { | |
| m_appliedImpulse = appliedImpulse; | | m_appliedImpulse = appliedImpulse; | |
| } | | } | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
| btScalar internalGetAppliedImpulse() | | btScalar internalGetAppliedImpulse() | |
| { | | { | |
| return m_appliedImpulse; | | return m_appliedImpulse; | |
| } | | } | |
| | | | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
|
| virtual void solveConstraintObsolete(btRigidBody& bodyA,btRigidBo
dy& bodyB,btScalar timeStep) {}; | | virtual void solveConstraintObsolete(btRigidBody& /*bodyA*/,btRig
idBody& /*bodyB*/,btScalar /*timeStep*/) {}; | |
| | | | |
| const btRigidBody& getRigidBodyA() const | | const btRigidBody& getRigidBodyA() const | |
| { | | { | |
| return m_rbA; | | return m_rbA; | |
| } | | } | |
| const btRigidBody& getRigidBodyB() const | | const btRigidBody& getRigidBodyB() const | |
| { | | { | |
| return m_rbB; | | return m_rbB; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 191 | | skipping to change at line 195 | |
| void setUserConstraintId(int uid) | | void setUserConstraintId(int uid) | |
| { | | { | |
| m_userConstraintId = uid; | | m_userConstraintId = uid; | |
| } | | } | |
| | | | |
| int getUserConstraintId() const | | int getUserConstraintId() const | |
| { | | { | |
| return m_userConstraintId; | | return m_userConstraintId; | |
| } | | } | |
| | | | |
|
| | | void setUserConstraintPtr(void* ptr) | |
| | | { | |
| | | m_userConstraintPtr = ptr; | |
| | | } | |
| | | | |
| | | void* getUserConstraintPtr() | |
| | | { | |
| | | return m_userConstraintPtr; | |
| | | } | |
| | | | |
| int getUid() const | | int getUid() const | |
| { | | { | |
| return m_userConstraintId; | | return m_userConstraintId; | |
| } | | } | |
| | | | |
| bool needsFeedback() const | | bool needsFeedback() const | |
| { | | { | |
| return m_needsFeedback; | | return m_needsFeedback; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 254 | | skipping to change at line 268 | |
| // returns angle in range [-SIMD_2_PI, SIMD_2_PI], closest to one of the li
mits | | // returns angle in range [-SIMD_2_PI, SIMD_2_PI], closest to one of the li
mits | |
| // all arguments should be normalized angles (i.e. in range [-SIMD_PI, SIMD
_PI]) | | // all arguments should be normalized angles (i.e. in range [-SIMD_PI, SIMD
_PI]) | |
| SIMD_FORCE_INLINE btScalar btAdjustAngleToLimits(btScalar angleInRadians, b
tScalar angleLowerLimitInRadians, btScalar angleUpperLimitInRadians) | | SIMD_FORCE_INLINE btScalar btAdjustAngleToLimits(btScalar angleInRadians, b
tScalar angleLowerLimitInRadians, btScalar angleUpperLimitInRadians) | |
| { | | { | |
| if(angleLowerLimitInRadians >= angleUpperLimitInRadians) | | if(angleLowerLimitInRadians >= angleUpperLimitInRadians) | |
| { | | { | |
| return angleInRadians; | | return angleInRadians; | |
| } | | } | |
| else if(angleInRadians < angleLowerLimitInRadians) | | else if(angleInRadians < angleLowerLimitInRadians) | |
| { | | { | |
|
| btScalar diffLo = btNormalizeAngle(angleLowerLimitInRadians
- angleInRadians); // this is positive | | btScalar diffLo = btFabs(btNormalizeAngle(angleLowerLimitInR
adians - angleInRadians)); | |
| btScalar diffHi = btFabs(btNormalizeAngle(angleUpperLimitInR
adians - angleInRadians)); | | btScalar diffHi = btFabs(btNormalizeAngle(angleUpperLimitInR
adians - angleInRadians)); | |
| return (diffLo < diffHi) ? angleInRadians : (angleInRadians
+ SIMD_2_PI); | | return (diffLo < diffHi) ? angleInRadians : (angleInRadians
+ SIMD_2_PI); | |
| } | | } | |
| else if(angleInRadians > angleUpperLimitInRadians) | | else if(angleInRadians > angleUpperLimitInRadians) | |
| { | | { | |
|
| btScalar diffHi = btNormalizeAngle(angleInRadians - angleUpp
erLimitInRadians); // this is positive | | btScalar diffHi = btFabs(btNormalizeAngle(angleInRadians - a
ngleUpperLimitInRadians)); | |
| btScalar diffLo = btFabs(btNormalizeAngle(angleInRadians - a
ngleLowerLimitInRadians)); | | btScalar diffLo = btFabs(btNormalizeAngle(angleInRadians - a
ngleLowerLimitInRadians)); | |
| return (diffLo < diffHi) ? (angleInRadians - SIMD_2_PI) : an
gleInRadians; | | return (diffLo < diffHi) ? (angleInRadians - SIMD_2_PI) : an
gleInRadians; | |
| } | | } | |
| else | | else | |
| { | | { | |
| return angleInRadians; | | return angleInRadians; | |
| } | | } | |
| } | | } | |
| | | | |
| ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | | ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | |
| | | | |
End of changes. 7 change blocks. |
| 11 lines changed or deleted | | 24 lines changed or added | |
|
| btVector3.h | | btVector3.h | |
| | | | |
| skipping to change at line 141 | | skipping to change at line 141 | |
| } | | } | |
| | | | |
| /**@brief Return the distance squared between the ends of this and anothe
r vector | | /**@brief Return the distance squared between the ends of this and anothe
r vector | |
| * This is symantically treating the vector like a point */ | | * This is symantically treating the vector like a point */ | |
| SIMD_FORCE_INLINE btScalar distance2(const btVector3& v) const; | | SIMD_FORCE_INLINE btScalar distance2(const btVector3& v) const; | |
| | | | |
| /**@brief Return the distance between the ends of this and another vector | | /**@brief Return the distance between the ends of this and another vector | |
| * This is symantically treating the vector like a point */ | | * This is symantically treating the vector like a point */ | |
| SIMD_FORCE_INLINE btScalar distance(const btVector3& v) const; | | SIMD_FORCE_INLINE btScalar distance(const btVector3& v) const; | |
| | | | |
|
| | | SIMD_FORCE_INLINE btVector3& safeNormalize() | |
| | | { | |
| | | btVector3 absVec = this->absolute(); | |
| | | int maxIndex = absVec.maxAxis(); | |
| | | if (absVec[maxIndex]>0) | |
| | | { | |
| | | *this /= absVec[maxIndex]; | |
| | | return *this /= length(); | |
| | | } | |
| | | setValue(1,0,0); | |
| | | return *this; | |
| | | } | |
| | | | |
| /**@brief Normalize this vector | | /**@brief Normalize this vector | |
| * x^2 + y^2 + z^2 = 1 */ | | * x^2 + y^2 + z^2 = 1 */ | |
| SIMD_FORCE_INLINE btVector3& normalize() | | SIMD_FORCE_INLINE btVector3& normalize() | |
| { | | { | |
| return *this /= length(); | | return *this /= length(); | |
| } | | } | |
| | | | |
| /**@brief Return a normalized version of this vector */ | | /**@brief Return a normalized version of this vector */ | |
| SIMD_FORCE_INLINE btVector3 normalized() const; | | SIMD_FORCE_INLINE btVector3 normalized() const; | |
| | | | |
|
| /**@brief Rotate this vector | | /**@brief Return a rotated version of this vector | |
| * @param wAxis The axis to rotate about | | * @param wAxis The axis to rotate about | |
| * @param angle The angle to rotate by */ | | * @param angle The angle to rotate by */ | |
|
| SIMD_FORCE_INLINE btVector3 rotate( const btVector3& wAxis, const bt
Scalar angle ); | | SIMD_FORCE_INLINE btVector3 rotate( const btVector3& wAxis, const bt
Scalar angle ) const; | |
| | | | |
| /**@brief Return the angle between this and another vector | | /**@brief Return the angle between this and another vector | |
| * @param v The other vector */ | | * @param v The other vector */ | |
| SIMD_FORCE_INLINE btScalar angle(const btVector3& v) const | | SIMD_FORCE_INLINE btScalar angle(const btVector3& v) const | |
| { | | { | |
| btScalar s = btSqrt(length2() * v.length2()); | | btScalar s = btSqrt(length2() * v.length2()); | |
| btFullAssert(s != btScalar(0.0)); | | btFullAssert(s != btScalar(0.0)); | |
| return btAcos(dot(v) / s); | | return btAcos(dot(v) / s); | |
| } | | } | |
| /**@brief Return a vector will the absolute values of each element */ | | /**@brief Return a vector will the absolute values of each element */ | |
| | | | |
| skipping to change at line 467 | | skipping to change at line 480 | |
| SIMD_FORCE_INLINE btScalar btVector3::distance(const btVector3& v) const | | SIMD_FORCE_INLINE btScalar btVector3::distance(const btVector3& v) const | |
| { | | { | |
| return (v - *this).length(); | | return (v - *this).length(); | |
| } | | } | |
| | | | |
| SIMD_FORCE_INLINE btVector3 btVector3::normalized() const | | SIMD_FORCE_INLINE btVector3 btVector3::normalized() const | |
| { | | { | |
| return *this / length(); | | return *this / length(); | |
| } | | } | |
| | | | |
|
| SIMD_FORCE_INLINE btVector3 btVector3::rotate( const btVector3& wAxis, cons
t btScalar angle ) | | SIMD_FORCE_INLINE btVector3 btVector3::rotate( const btVector3& wAxis, cons
t btScalar angle ) const | |
| { | | { | |
| // wAxis must be a unit lenght vector | | // wAxis must be a unit lenght vector | |
| | | | |
| btVector3 o = wAxis * wAxis.dot( *this ); | | btVector3 o = wAxis * wAxis.dot( *this ); | |
| btVector3 x = *this - o; | | btVector3 x = *this - o; | |
| btVector3 y; | | btVector3 y; | |
| | | | |
| y = wAxis.cross( *this ); | | y = wAxis.cross( *this ); | |
| | | | |
| return ( o + x * btCos( angle ) + y * btSin( angle ) ); | | return ( o + x * btCos( angle ) + y * btSin( angle ) ); | |
| | | | |
| skipping to change at line 640 | | skipping to change at line 653 | |
| { | | { | |
| | | | |
| btVector3 swappedVec; | | btVector3 swappedVec; | |
| for (int i=0;i<4;i++) | | for (int i=0;i<4;i++) | |
| { | | { | |
| btSwapScalarEndian(vector[i],swappedVec[i]); | | btSwapScalarEndian(vector[i],swappedVec[i]); | |
| } | | } | |
| vector = swappedVec; | | vector = swappedVec; | |
| } | | } | |
| | | | |
|
| SIMD_FORCE_INLINE void btPlaneSpace1 (const btVector3& n, btVector3& p, btV | | template <class T> | |
| ector3& q) | | SIMD_FORCE_INLINE void btPlaneSpace1 (const T& n, T& p, T& q) | |
| { | | { | |
|
| if (btFabs(n.z()) > SIMDSQRT12) { | | if (btFabs(n[2]) > SIMDSQRT12) { | |
| // choose p in y-z plane | | // choose p in y-z plane | |
| btScalar a = n[1]*n[1] + n[2]*n[2]; | | btScalar a = n[1]*n[1] + n[2]*n[2]; | |
| btScalar k = btRecipSqrt (a); | | btScalar k = btRecipSqrt (a); | |
|
| p.setValue(0,-n[2]*k,n[1]*k); | | p[0] = 0; | |
| | | p[1] = -n[2]*k; | |
| | | p[2] = n[1]*k; | |
| // set q = n x p | | // set q = n x p | |
|
| q.setValue(a*k,-n[0]*p[2],n[0]*p[1]); | | q[0] = a*k; | |
| | | q[1] = -n[0]*p[2]; | |
| | | q[2] = n[0]*p[1]; | |
| } | | } | |
| else { | | else { | |
| // choose p in x-y plane | | // choose p in x-y plane | |
|
| btScalar a = n.x()*n.x() + n.y()*n.y(); | | btScalar a = n[0]*n[0] + n[1]*n[1]; | |
| btScalar k = btRecipSqrt (a); | | btScalar k = btRecipSqrt (a); | |
|
| p.setValue(-n.y()*k,n.x()*k,0); | | p[0] = -n[1]*k; | |
| | | p[1] = n[0]*k; | |
| | | p[2] = 0; | |
| // set q = n x p | | // set q = n x p | |
|
| q.setValue(-n.z()*p.y(),n.z()*p.x(),a*k); | | q[0] = -n[2]*p[1]; | |
| | | q[1] = n[2]*p[0]; | |
| | | q[2] = a*k; | |
| } | | } | |
| } | | } | |
| | | | |
| struct btVector3FloatData | | struct btVector3FloatData | |
| { | | { | |
| float m_floats[4]; | | float m_floats[4]; | |
| }; | | }; | |
| | | | |
| struct btVector3DoubleData | | struct btVector3DoubleData | |
| { | | { | |
| | | | |
End of changes. 11 change blocks. |
| 11 lines changed or deleted | | 32 lines changed or added | |
|