diff --git a/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp b/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp index 4cc00afb9..b9dbe03ac 100644 --- a/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp +++ b/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp @@ -170,7 +170,7 @@ void SpuContactResult::writeDoubleBufferedManifold(btPersistentManifold* lsManif //no, the swapBuffers does the wait } -void SpuContactResult::addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,float depth) +void SpuContactResult::addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,btScalar depth) { //spu_printf("*** SpuContactResult::addContactPoint: depth = %f\n",depth); diff --git a/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.h b/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.h index f19975ebb..bcacd4d43 100644 --- a/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.h +++ b/Extras/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.h @@ -1,58 +1,58 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -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. -*/ - -#ifndef SPU_CONTACT_RESULT2_H -#define SPU_CONTACT_RESULT2_H - - -#ifndef WIN32 -#include -#endif - - - -#include "../SpuDoubleBuffer.h" - - -#include "LinearMath/btTransform.h" -#include "LinearMath/btPoint3.h" - - -#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" -#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h" - -struct SpuCollisionPairInput -{ - ppu_address_t m_collisionShapes[2]; - void* m_spuCollisionShapes[2]; - - ppu_address_t m_persistentManifoldPtr; - btVector3 m_primitiveDimensions0; - btVector3 m_primitiveDimensions1; - int m_shapeType0; - int m_shapeType1; - float m_collisionMargin0; - float m_collisionMargin1; - - btTransform m_worldTransform0; - btTransform m_worldTransform1; - - bool m_isSwapped; - bool m_useEpa; -}; - +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +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. +*/ + +#ifndef SPU_CONTACT_RESULT2_H +#define SPU_CONTACT_RESULT2_H + + +#ifndef WIN32 +#include +#endif + + + +#include "../SpuDoubleBuffer.h" + + +#include "LinearMath/btTransform.h" +#include "LinearMath/btPoint3.h" + + +#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" +#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h" + +struct SpuCollisionPairInput +{ + ppu_address_t m_collisionShapes[2]; + void* m_spuCollisionShapes[2]; + + ppu_address_t m_persistentManifoldPtr; + btVector3 m_primitiveDimensions0; + btVector3 m_primitiveDimensions1; + int m_shapeType0; + int m_shapeType1; + float m_collisionMargin0; + float m_collisionMargin1; + + btTransform m_worldTransform0; + btTransform m_worldTransform1; + + bool m_isSwapped; + bool m_useEpa; +}; + struct SpuClosestPointInput { SpuClosestPointInput() @@ -68,46 +68,46 @@ struct SpuClosestPointInput struct SpuConvexPolyhedronVertexData* m_convexVertexData[2]; }; - -///SpuContactResult exports the contact points using double-buffered DMA transfers, only when needed -///So when an existing contact point is duplicated, no transfer/refresh is performed. -class SpuContactResult : public btDiscreteCollisionDetectorInterface::Result -{ - btTransform m_rootWorldTransform0; - btTransform m_rootWorldTransform1; - ppu_address_t m_manifoldAddress; - - btPersistentManifold* m_spuManifold; - bool m_RequiresWriteBack; - btScalar m_combinedFriction; - btScalar m_combinedRestitution; - - bool m_isSwapped; - - DoubleBuffer g_manifoldDmaExport; - - public: - SpuContactResult(); - virtual ~SpuContactResult(); - - btPersistentManifold* GetSpuManifold() const - { - return m_spuManifold; - } - - virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1); - - void setContactInfo(btPersistentManifold* spuManifold, ppu_address_t manifoldAddress,const btTransform& worldTrans0,const btTransform& worldTrans1, btScalar restitution0,btScalar restitution1, btScalar friction0,btScalar friction01, bool isSwapped); - - - void writeDoubleBufferedManifold(btPersistentManifold* lsManifold, btPersistentManifold* mmManifold); - - virtual void addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,float depth); - - void flush(); -}; - - - -#endif //SPU_CONTACT_RESULT2_H - + +///SpuContactResult exports the contact points using double-buffered DMA transfers, only when needed +///So when an existing contact point is duplicated, no transfer/refresh is performed. +class SpuContactResult : public btDiscreteCollisionDetectorInterface::Result +{ + btTransform m_rootWorldTransform0; + btTransform m_rootWorldTransform1; + ppu_address_t m_manifoldAddress; + + btPersistentManifold* m_spuManifold; + bool m_RequiresWriteBack; + btScalar m_combinedFriction; + btScalar m_combinedRestitution; + + bool m_isSwapped; + + DoubleBuffer g_manifoldDmaExport; + + public: + SpuContactResult(); + virtual ~SpuContactResult(); + + btPersistentManifold* GetSpuManifold() const + { + return m_spuManifold; + } + + virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1); + + void setContactInfo(btPersistentManifold* spuManifold, ppu_address_t manifoldAddress,const btTransform& worldTrans0,const btTransform& worldTrans1, btScalar restitution0,btScalar restitution1, btScalar friction0,btScalar friction01, bool isSwapped); + + + void writeDoubleBufferedManifold(btPersistentManifold* lsManifold, btPersistentManifold* mmManifold); + + virtual void addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,btScalar depth); + + void flush(); +}; + + + +#endif //SPU_CONTACT_RESULT2_H + diff --git a/Extras/MayaPlugin/rigidBodyArrayNode.cpp b/Extras/MayaPlugin/rigidBodyArrayNode.cpp index 23f36e48a..ded39d815 100644 --- a/Extras/MayaPlugin/rigidBodyArrayNode.cpp +++ b/Extras/MayaPlugin/rigidBodyArrayNode.cpp @@ -492,7 +492,12 @@ void rigidBodyArrayNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) m_rigid_bodies[i]->set_transform(newpos, newrot); - hInitPos.set3Float(ipos[0] + mtranslation.x, ipos[1] + mtranslation.y, ipos[2] + mtranslation.z); + float3 &ihpos=hInitPos.asFloat3(); + //hInitPos.set3Float(ipos[0] + mtranslation.x, ipos[1] + mtranslation.y, ipos[2] + mtranslation.z); + ihpos[0] = ipos[0] + mtranslation.x; + ihpos[1] = ipos[1] + mtranslation.y; + ihpos[2] = ipos[2] + mtranslation.z; + hInitPosArray.next(); } diff --git a/Extras/MayaPlugin/rigidBodyNode.cpp b/Extras/MayaPlugin/rigidBodyNode.cpp index 92527f22f..20116ed0a 100644 --- a/Extras/MayaPlugin/rigidBodyNode.cpp +++ b/Extras/MayaPlugin/rigidBodyNode.cpp @@ -447,8 +447,20 @@ void rigidBodyNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) MVector newipos(ipos[0] + deltapos.x, ipos[1] + deltapos.y, ipos[2] + deltapos.z); MEulerRotation newirot((iquat * deltarot).asEulerRotation()); - hInitPos.set3Float(newipos.x, newipos.y, newipos.z); - hInitRot.set3Float(rad2deg(newirot.x), rad2deg(newirot.y), rad2deg(newirot.z)); + float3 &ihpos = hInitPos.asFloat3(); + //hInitPos.set3Float(newipos.x, newipos.y, newipos.z); + //for Maya 8.5 + ihpos[0] = newipos.x; + ihpos[1] = newipos.y; + ihpos[2] = newipos.z; + + float3 &ihrot = hInitRot.asFloat3(); + //hInitRot.set3Float(rad2deg(newirot.x), rad2deg(newirot.y), rad2deg(newirot.z)); + //for Maya 8.5 + ihrot[0] = rad2deg(newirot.x); + ihrot[1] = rad2deg(newirot.y); + ihrot[2] = rad2deg(newirot.z); + m_rigid_body->set_transform(vec3f(mtranslation.x, mtranslation.y, mtranslation.z), quatf(mrotation.w, mrotation.x, mrotation.y, mrotation.z)); diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.h b/src/BulletCollision/BroadphaseCollision/btDbvt.h index 87dd75e16..f35c4c1d5 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -62,7 +62,7 @@ subject to the following restrictions: // Specific methods implementation //SSE gives errors on a MSVC 7.1 -#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400) +#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION)) #define DBVT_SELECT_IMPL DBVT_IMPL_SSE #define DBVT_MERGE_IMPL DBVT_IMPL_SSE #define DBVT_INT0_IMPL DBVT_IMPL_SSE diff --git a/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp b/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp index 9276b7117..fbfc17290 100644 --- a/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp +++ b/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp @@ -226,9 +226,9 @@ void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[]) a = btScalar(j)*(2*M__PI/m) + A[i0]; if (a > M__PI) a -= 2*M__PI; btScalar maxdiff=1e9,diff; -#if defined(DEBUG) || defined (_DEBUG) - *iret = i0; // iret is not allowed to keep this value -#endif + + *iret = i0; // iret is not allowed to keep this value, but it sometimes does, when diff=#QNAN0 + for (i=0; i