ColladaConverter.h   ColladaConverter.h 
skipping to change at line 131 skipping to change at line 131
/* Currently we assume that there is only a single physics and visua l scene */ /* Currently we assume that there is only a single physics and visua l scene */
class domPhysics_scene* getDefaultPhysicsScene (); class domPhysics_scene* getDefaultPhysicsScene ();
class domVisual_scene* getDefaultVisualScene (); class domVisual_scene* getDefaultVisualScene ();
void buildShapeNew(btCollisionShape* shape, void* domTechniqueCommon , const char* shapeName, bool isChild=false,const btTransform& childTrans=b tTransform::getIdentity()); void buildShapeNew(btCollisionShape* shape, void* domTechniqueCommon , const char* shapeName, bool isChild=false,const btTransform& childTrans=b tTransform::getIdentity());
void addConvexHull (btCollisionShape* shape, const char* nodeName); void addConvexHull (btCollisionShape* shape, const char* nodeName);
void addConvexMesh (btCollisionShape* shape, const char* nodeName); void addConvexMesh (btCollisionShape* shape, const char* nodeName);
void addConcaveMesh(btCollisionShape* shape, const char* nodeName); void addConcaveMesh(btCollisionShape* shape, const char* nodeName);
void addScaledConcaveMesh(btCollisionShape* shape, const char* nodeN
ame);
void addGimpactMesh(btCollisionShape* shape, const char* nodeName);
void addConcaveMeshInternal(class btStridingMeshInterface* meshIn
terface , const char* nodeName);
class domNode* addNode (btRigidBody* body, const char* nodeNam e, const char* shapeName); class domNode* addNode (btRigidBody* body, const char* nodeNam e, const char* shapeName);
class domRigid_constraint* addConstraint (btTypedConstraint* co nstraint, const char* constraintName); class domRigid_constraint* addConstraint (btTypedConstraint* co nstraint, const char* constraintName);
class domInstance_rigid_constraint* addConstraintInstance (btTypedCo nstraint* constraint, const char* constraintName); class domInstance_rigid_constraint* addConstraintInstance (btTypedCo nstraint* constraint, const char* constraintName);
void addMaterial (btRigidBody* body, const char* nodeName); void addMaterial (btRigidBody* body, const char* nodeName);
class domRigid_body* addRigidBody (btRigidBody* body, const char* n odeName, const char* shapeName); class domRigid_body* addRigidBody (btRigidBody* body, const char* n odeName, const char* shapeName);
class domInstance_rigid_body* addRigidBodyInstance (btRigidBody* bo dy, const char* nodeName); class domInstance_rigid_body* addRigidBodyInstance (btRigidBody* bo dy, const char* nodeName);
void updateRigidBodyPosition (btRigidBody* body, class domNode* node ); void updateRigidBodyPosition (btRigidBody* body, class domNode* node );
void updateRigidBodyVelocity (btRigidBody* body); void updateRigidBodyVelocity (btRigidBody* body);
void updateConstraint (btTypedConstraint* constraint, class domRigid _constraint* rigidConstraint); void updateConstraint (btTypedConstraint* constraint, class domRigid _constraint* rigidConstraint);
skipping to change at line 206 skipping to change at line 211
virtual btRigidBody* createRigidBody(bool isDynamic, virtual btRigidBody* createRigidBody(bool isDynamic,
float mass, float mass,
const btTransform& startTransform, const btTransform& startTransform,
btCollisionShape* shape); btCollisionShape* shape);
virtual int getNumRigidBodies (); virtual int getNumRigidBodies ();
virtual btRigidBody* getRigidBody (int i); virtual btRigidBody* getRigidBody (int i);
virtual int getNumConstraints (); virtual int getNumConstraints ();
virtual btTypedConstraint* getConstraint (int i); virtual btTypedConstraint* getConstraint (int i);
virtual void setGravity(const btVector3& gravity); virtual void setGravity(const btVector3& gravity);
virtual btVector3 getGravity (); virtual btVector3 getGravity ();
virtual void setCameraInfo(const btVector3& up, int forwardAxis) virtual void setCameraInfo(const btVector3& up, int forwardAxis);
{
};
virtual btCollisionShape* createPlaneShape(const btVector3& planeNor mal,btScalar planeConstant); virtual btCollisionShape* createPlaneShape(const btVector3& planeNor mal,btScalar planeConstant);
virtual btCollisionShape* createBoxShape(const btVector3& halfExtent s); virtual btCollisionShape* createBoxShape(const btVector3& halfExtent s);
virtual btCollisionShape* createSphereShape(btScalar radius); virtual btCollisionShape* createSphereShape(btScalar radius);
virtual btCollisionShape* createCylinderShapeY(btScalar radius,btSca lar height); virtual btCollisionShape* createCylinderShapeY(btScalar radius,btSca lar height);
virtual class btTriangleMesh* createTriangleMeshContainer(); virtual class btTriangleMesh* createTriangleMeshContainer();
virtual btCollisionShape* createBvhTriangleMeshShape(btTriangleMesh* trimesh); virtual btCollisionShape* createBvhTriangleMeshShape(btTriangleMesh* trimesh);
virtual btCollisionShape* createConvexTriangleMeshShape(btTriangleMe sh* trimesh); virtual btCollisionShape* createConvexTriangleMeshShape(btTriangleMe sh* trimesh);
virtual btCollisionShape* createGimpactShape(btTriangleMesh* trimesh );
virtual class btConvexHullShape* createConvexHullShape(); virtual class btConvexHullShape* createConvexHullShape();
virtual class btCompoundShape* createCompoundShape(); virtual class btCompoundShape* createCompoundShape();
int getNumCollisionShapes() const; int getNumCollisionShapes() const;
btCollisionShape* getCollisionShape(int shapeIndex); btCollisionShape* getCollisionShape(int shapeIndex);
void deleteAllocatedCollisionShapes(); void deleteAllocatedCollisionShapes();
void deleteShape(btCollisionShape* shape); void deleteShape(btCollisionShape* shape);
char* getLastFileName(); char* getLastFileName();
 End of changes. 3 change blocks. 
3 lines changed or deleted 9 lines changed or added


 DemoApplication.h   DemoApplication.h 
skipping to change at line 81 skipping to change at line 81
float m_ShootBoxInitialSpeed; float m_ShootBoxInitialSpeed;
bool m_stepping; bool m_stepping;
bool m_singleStep; bool m_singleStep;
bool m_idle; bool m_idle;
int m_lastKey; int m_lastKey;
void showProfileInfo(float& xOffset,float& yStart, float yIncr); void showProfileInfo(float& xOffset,float& yStart, float yIncr);
void renderscene(int pass); void renderscene(int pass);
GL_ShapeDrawer m_shapeDrawer; GL_ShapeDrawer* m_shapeDrawer;
bool m_enableshadows; bool m_enableshadows;
btVector3 m_sundirection; btVector3 m_sundirection;
public: public:
DemoApplication(); DemoApplication();
virtual ~DemoApplication(); virtual ~DemoApplication();
btDynamicsWorld* getDynamicsWorld() btDynamicsWorld* getDynamicsWorld()
{ {
return m_dynamicsWorld; return m_dynamicsWorld;
} }
virtual void setDrawClusters(bool drawClusters) virtual void setDrawClusters(bool drawClusters)
{ {
} }
void overrideGLShapeDrawer (GL_ShapeDrawer* shapeDrawer);
void setOrthographicProjection(); void setOrthographicProjection();
void resetPerspectiveProjection(); void resetPerspectiveProjection();
bool setTexturing(bool enable) { return(m_shapeDrawer.enableTextu re(enable)); } bool setTexturing(bool enable) { return(m_shapeDrawer->enableText ure(enable)); }
bool setShadows(bool enable) { bool p=m_enableshadows;m_enablesha dows=enable;return(p); } bool setShadows(bool enable) { bool p=m_enableshadows;m_enablesha dows=enable;return(p); }
bool getTexturing() const bool getTexturing() const
{ {
return m_shapeDrawer.hasTextureEnabled(); return m_shapeDrawer->hasTextureEnabled();
} }
bool getShadows() const bool getShadows() const
{ {
return m_enableshadows; return m_enableshadows;
} }
int getDebugMode() int getDebugMode()
{ {
return m_debugMode ; return m_debugMode ;
} }
skipping to change at line 173 skipping to change at line 175
float getCameraDistance(); float getCameraDistance();
void setCameraDistance(float dist); void setCameraDistance(float dist);
void moveAndDisplay(); void moveAndDisplay();
virtual void clientMoveAndDisplay() = 0; virtual void clientMoveAndDisplay() = 0;
virtual void clientResetScene(); virtual void clientResetScene();
///Demo functions ///Demo functions
virtual void setShootBoxShape ();
void shootBox(const btVector3& destination); void shootBox(const btVector3& destination);
btVector3 getRayTo(int x,int y); btVector3 getRayTo(int x,int y);
btRigidBody* localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape); btRigidBody* localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape);
///callback methods by glut ///callback methods by glut
virtual void keyboardCallback(unsigned char key, int x, int y); virtual void keyboardCallback(unsigned char key, int x, int y);
 End of changes. 5 change blocks. 
3 lines changed or deleted 6 lines changed or added


 GLDebugDrawer.h   GLDebugDrawer.h 
skipping to change at line 14 skipping to change at line 14
#include "LinearMath/btIDebugDraw.h" #include "LinearMath/btIDebugDraw.h"
class GLDebugDrawer : public btIDebugDraw class GLDebugDrawer : public btIDebugDraw
{ {
int m_debugMode; int m_debugMode;
public: public:
GLDebugDrawer(); GLDebugDrawer();
virtual void drawLine(const btVector3& from,const btVector3& to,c
onst btVector3& fromColor, const btVector3& toColor);
virtual void drawLine(const btVector3& from,const btVector3& to,c onst btVector3& color); virtual void drawLine(const btVector3& from,const btVector3& to,c onst btVector3& color);
virtual void drawSphere (const btVector3& p, btScalar radius, con
st btVector3& color);
virtual void drawBox (const btVector3& boxMin, const btVector3& b
oxMax, const btVector3& color, btScalar alpha);
virtual void drawTriangle(const btVector3& a,const btVector3& b,c onst btVector3& c,const btVector3& color,btScalar alpha); virtual void drawTriangle(const btVector3& a,const btVector3& b,c onst btVector3& c,const btVector3& color,btScalar alpha);
virtual void drawContactPoint(const btVector3& PointOnB,const btV ector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color); virtual void drawContactPoint(const btVector3& PointOnB,const btV ector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color);
virtual void reportErrorWarning(const char* warningString); virtual void reportErrorWarning(const char* warningString);
virtual void draw3dText(const btVector3& location,const char* tex tString); virtual void draw3dText(const btVector3& location,const char* tex tString);
virtual void setDebugMode(int debugMode); virtual void setDebugMode(int debugMode);
 End of changes. 2 change blocks. 
0 lines changed or deleted 8 lines changed or added


 GL_ShapeDrawer.h   GL_ShapeDrawer.h 
skipping to change at line 28 skipping to change at line 28
class btCollisionShape; class btCollisionShape;
class btShapeHull; class btShapeHull;
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "BulletCollision/CollisionShapes/btShapeHull.h" #include "BulletCollision/CollisionShapes/btShapeHull.h"
/// OpenGL shape drawing /// OpenGL shape drawing
class GL_ShapeDrawer class GL_ShapeDrawer
{ {
protected:
struct ShapeCache struct ShapeCache
{ {
struct Edge { btVector3 n[2];int v[2]; }; struct Edge { btVector3 n[2];int v[2]; };
ShapeCache(btConvexShape* s) : m_shapehull(s) {} ShapeCache(btConvexShape* s) : m_shapehull(s) {}
btShapeHull m_shapehull; btShapeHull m_shapehull;
btAlignedObjectArray<Edge> m_edges; btAlignedObjectArray<Edge> m_edges;
}; };
//clean-up memory of dynamically created shape hulls //clean-up memory of dynamically created shape hulls
btAlignedObjectArray<ShapeCache*> m_shapecaches; btAlignedObjectArray<ShapeCache*> m_shapecaches;
unsigned int m_texturehan dle; unsigned int m_texturehan dle;
bool m_te xtureenabled; bool m_te xtureenabled;
bool m_te xtureinitialized; bool m_te xtureinitialized;
private:
ShapeCache* cach e(btConvexShape*); ShapeCache* cach e(btConvexShape*);
public: public:
GL_ShapeDrawer(); GL_ShapeDrawer();
virtual ~GL_ShapeDrawer(); virtual ~GL_ShapeDrawer();
///drawOpenGL might allocate temporary memoty, stores pointe r in shape userpointer ///drawOpenGL might allocate temporary memoty, stores pointe r in shape userpointer
void drawOpenGL(btScalar* m, const btCollisionSha virtual void drawOpenGL(btScalar* m, const btColl
pe* shape, const btVector3& color,int debugMode,const btVector3& worl isionShape* shape, const btVector3& color,int debugMode,const btVecto
dBoundsMin,const btVector3& worldBoundsMax); r3& worldBoundsMin,const btVector3& worldBoundsMax);
void drawShadow(btScalar* m, const btVector3& ext virtual void drawShadow(btScalar* m, const btVect
rusion,const btCollisionShape* shape,const btVector3& worldBoundsMin,const or3& extrusion,const btCollisionShape* shape,const btVector3& worldBoundsMi
btVector3& worldBoundsMax); n,const btVector3& worldBoundsMax);
bool enableTexture(bool enable) { bool p=m_textur eenabled;m_textureenabled=enable;return(p); } bool enableTexture(bool enable) { bool p=m_textur eenabled;m_textureenabled=enable;return(p); }
bool hasTextureEnabled() const bool hasTextureEnabled() const
{ {
return m_textureenabled; return m_textureenabled;
} }
static void drawCylinder(float radius,float half Height, int upAxis); static void drawCylinder(float radius,float half Height, int upAxis);
static void drawCoordSystem(); static void drawCoordSystem();
 End of changes. 4 change blocks. 
8 lines changed or deleted 8 lines changed or added


 OPC_IceHook.h   OPC_IceHook.h 
skipping to change at line 57 skipping to change at line 57
#include ".\Ice\IcePreprocessor.h" #include ".\Ice\IcePreprocessor.h"
#undef ICECORE_API #undef ICECORE_API
#define ICECORE_API OPCODE_API #define ICECORE_API OPCODE_API
#include ".\Ice\IceTypes.h" #include ".\Ice\IceTypes.h"
#include ".\Ice\IceFPU.h" #include ".\Ice\IceFPU.h"
#include ".\Ice\IceMemoryMacros.h" #include ".\Ice\IceMemoryMacros.h"
namespace Opcode
{
namespace IceCore namespace IceCore
{ {
#include ".\Ice\IceAllocator.h" #include ".\Ice\IceAllocator.h"
#include ".\Ice\IceUtils.h" #include ".\Ice\IceUtils.h"
#include ".\Ice\IceBitArray.h" #include ".\Ice\IceBitArray.h"
#include ".\Ice\IceContainer.h" #include ".\Ice\IceContainer.h"
#include ".\Ice\IcePairs.h" #include ".\Ice\IcePairs.h"
#include ".\Ice\IceRevisitedRadix.h" #include ".\Ice\IceRevisitedRadix.h"
#include ".\Ice\IceRandom.h" #include ".\Ice\IceRandom.h"
#include ".\Ice\IceHashing.h" #include ".\Ice\IceHashing.h"
skipping to change at line 90 skipping to change at line 92
#include ".\Ice\IceIndexedTriangle.h" #include ".\Ice\IceIndexedTriangle.h"
#include ".\Ice\IceTriangle.h" #include ".\Ice\IceTriangle.h"
#include ".\Ice\IceTriList.h" #include ".\Ice\IceTriList.h"
#include ".\Ice\IceAABB.h" #include ".\Ice\IceAABB.h"
#include ".\Ice\IceOBB.h" #include ".\Ice\IceOBB.h"
#include ".\Ice\IceBoundingSphere.h" #include ".\Ice\IceBoundingSphere.h"
#include ".\Ice\IceSegment.h" #include ".\Ice\IceSegment.h"
#include ".\Ice\IceLSS.h" #include ".\Ice\IceLSS.h"
} }
using namespace IceMaths; using namespace IceMaths;
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 SpuDoubleBuffer.h   SpuDoubleBuffer.h 
skipping to change at line 63 skipping to change at line 63
this->m_frontBuffer = &this->m_buffer0[0]; this->m_frontBuffer = &this->m_buffer0[0];
this->m_backBuffer = &this->m_buffer1[0]; this->m_backBuffer = &this->m_buffer1[0];
} }
template<class T, int size> template<class T, int size>
void void
DoubleBuffer<T,size>::backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag) DoubleBuffer<T,size>::backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag)
{ {
m_dmaPending = true; m_dmaPending = true;
m_dmaTag = tag; m_dmaTag = tag;
cellDmaLargeGet(m_backBuffer, ea, numBytes, tag, 0, 0); m_backBuffer = (T*)cellDmaLargeGetReadOnly(m_backBuffer, ea, numByte s, tag, 0, 0);
} }
template<class T, int size> template<class T, int size>
void void
DoubleBuffer<T,size>::backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag) DoubleBuffer<T,size>::backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag)
{ {
m_dmaPending = true; m_dmaPending = true;
m_dmaTag = tag; m_dmaTag = tag;
cellDmaLargePut(m_backBuffer, ea, numBytes, tag, 0, 0); cellDmaLargePut(m_backBuffer, ea, numBytes, tag, 0, 0);
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 SpuParallellSolverTask.h   SpuParallellSolverTask.h 
skipping to change at line 110 skipping to change at line 110
inline unsigned int spuHash(unsigned int k) { return k*2654435769u; } inline unsigned int spuHash(unsigned int k) { return k*2654435769u; }
inline unsigned int spuGetHashCellIndex(int x, int y, int z) inline unsigned int spuGetHashCellIndex(int x, int y, int z)
{ {
//int n = 0x8da6b343 * x + 0xd8163841 * y + 0xcb1ab31f * z; //int n = 0x8da6b343 * x + 0xd8163841 * y + 0xcb1ab31f * z;
int n = x ^ spuHash(y ^ spuHash (z)); int n = x ^ spuHash(y ^ spuHash (z));
return ((unsigned int)n) & (SPU_HASH_NUMCELLS-1); return ((unsigned int)n) & (SPU_HASH_NUMCELLS-1);
} }
ATTRIBUTE_ALIGNED16(struct) SpuSolverConstraint
{
BT_DECLARE_ALIGNED_ALLOCATOR();
uint16_t m_localOffsetBodyA;
uint16_t m_localOffsetBodyB;
uint16_t m_constraintType;
struct
{
uint16_t m_useLinear : 1;
uint16_t m_limit1 : 1;
uint16_t m_limit2 : 1;
uint16_t m_limit3 : 1;
uint16_t m_limit4 : 1;
uint16_t m_limit5 : 1;
uint16_t m_limit6 : 1;
uint16_t m_motor1 : 1;
uint16_t m_motor2 : 1;
uint16_t m_motor3 : 1;
uint16_t m_motor4 : 1;
uint16_t m_motor5 : 1;
uint16_t m_motor6 : 1;
} m_flags;
// Linear parts, used by all constraints
btQuadWordStorage m_relPos1;
btQuadWordStorage m_relPos2;
btQuadWordStorage m_jacdiagABInv; //Jacobian inverse m
ultiplied by gamma (damping) for each axis
btQuadWordStorage m_linearBias; //depth*tau/(dt*gamm
a) along each axis
// Joint-specific parts
union
{
struct
{
btQuadWordStorage m_frameAinW[3];
btQuadWordStorage m_frameBinW[3];
// For angular
btQuadWordStorage m_angJacdiagABInv;
//1/j
btQuadWordStorage m_angularBias;
//error/dt, in x/y. limit error*bias factor / (dt * relaxat
ion factor) in z
// For limit
float m_limitAccumulatedIm
pulse;
float m_limitJacFactor;
//limitSign*relaxation factor
// For motor
float m_motorVelocity;
float m_motorImpulse;
} hinge;
struct
{
btQuadWordStorage m_swingAxis;
btQuadWordStorage m_twistAxis;
float m_swingError;
float m_swingJacInv;
float m_swingLimitImpulse;
float m_twistError;
float m_twistJacInv;
float m_twistLimitImpulse;
} conetwist;
};
};
ATTRIBUTE_ALIGNED16(struct) SpuSolverDataDesc ATTRIBUTE_ALIGNED16(struct) SpuSolverDataDesc
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
SpuSolverHash* m_solverHash; SpuSolverHash* m_solverHash;
btSolverBody* m_solverBodyList; btSolverBody* m_solverBodyList;
btSolverConstraint* m_solverInternalConstraintList; btSolverConstraint* m_solverInternalCons
SpuSolverConstraint* m_solverConstraintList; traintList;
btSolverConstraint* m_solverConstraintLi
st;
uint32_t* m_solverBody OffsetList; uint32_t* m_solverBody OffsetList;
}; };
ATTRIBUTE_ALIGNED16(struct) SpuSolverTaskDesc ATTRIBUTE_ALIGNED16(struct) SpuSolverTaskDesc
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
uint32_t m_solverComm and; uint32_t m_solverComm and;
uint32_t m_taskId; uint32_t m_taskId;
SpuSolverDataDesc m_solverData; SpuSolverDataDesc m_solverData;
 End of changes. 2 change blocks. 
78 lines changed or deleted 4 lines changed or added


 btAlignedAllocator.h   btAlignedAllocator.h 
skipping to change at line 41 skipping to change at line 41
btAlignedFreeInternal(ptr,__LINE__,__FILE__) btAlignedFreeInternal(ptr,__LINE__,__FILE__)
void* btAlignedAllocInternal (size_t size, int alignment,int line,char* f ilename); void* btAlignedAllocInternal (size_t size, int alignment,int line,char* f ilename);
void btAlignedFreeInternal (void* ptr,int line,char* filename); void btAlignedFreeInternal (void* ptr,int line,char* filename);
#else #else
void* btAlignedAllocInternal (size_t size, int alignment); void* btAlignedAllocInternal (size_t size, int alignment);
void btAlignedFreeInternal (void* ptr); void btAlignedFreeInternal (void* ptr);
#define btAlignedAlloc(a,b) btAlignedAllocInternal(a,b) #define btAlignedAlloc(size,alignment) btAlignedAllocInternal(size,a lignment)
#define btAlignedFree(ptr) btAlignedFreeInternal(ptr) #define btAlignedFree(ptr) btAlignedFreeInternal(ptr)
#endif #endif
typedef int size_type; typedef int size_type;
typedef void *(btAlignedAllocFunc)(size_t size, int alignment); typedef void *(btAlignedAllocFunc)(size_t size, int alignment);
typedef void (btAlignedFreeFunc)(void *memblock); typedef void (btAlignedFreeFunc)(void *memblock);
typedef void *(btAllocFunc)(size_t size); typedef void *(btAllocFunc)(size_t size);
typedef void (btFreeFunc)(void *memblock); typedef void (btFreeFunc)(void *memblock);
void btAlignedAllocSetCustomAligned(btAlignedAllocFunc *allocFunc, btAligne dFreeFunc *freeFunc); ///The developer can let all Bullet memory allocations go through a custom memory allocator, using btAlignedAllocSetCustom
void btAlignedAllocSetCustom(btAllocFunc *allocFunc, btFreeFunc *freeFunc); void btAlignedAllocSetCustom(btAllocFunc *allocFunc, btFreeFunc *freeFunc);
///If the developer has already an custom aligned allocator, then btAligned
AllocSetCustomAligned can be used. The default aligned allocator pre-alloca
tes extra memory using the non-aligned allocator, and instruments it.
void btAlignedAllocSetCustomAligned(btAlignedAllocFunc *allocFunc, btAligne
dFreeFunc *freeFunc);
///The btAlignedAllocator is a portable class for aligned memory allocation s. ///The btAlignedAllocator is a portable class for aligned memory allocation s.
///Default implementations for unaligned and aligned allocations can be ove rridden by a custom allocator using btAlignedAllocSetCustom and btAlignedAl locSetCustomAligned. ///Default implementations for unaligned and aligned allocations can be ove rridden by a custom allocator using btAlignedAllocSetCustom and btAlignedAl locSetCustomAligned.
template < typename T , unsigned Alignment > template < typename T , unsigned Alignment >
class btAlignedAllocator { class btAlignedAllocator {
typedef btAlignedAllocator< T , Alignment > self_type; typedef btAlignedAllocator< T , Alignment > self_type;
public: public:
 End of changes. 3 change blocks. 
2 lines changed or deleted 7 lines changed or added


 btAlignedObjectArray.h   btAlignedObjectArray.h 
skipping to change at line 59 skipping to change at line 59
int m_capacity; int m_capacity;
T* m_data; T* m_data;
//PCK: added this line //PCK: added this line
bool m_ownsMemory; bool m_ownsMemory;
protected: protected:
SIMD_FORCE_INLINE int allocSize(int size) SIMD_FORCE_INLINE int allocSize(int size)
{ {
return (size ? size*2 : 1); return (size ? size*2 : 1);
} }
SIMD_FORCE_INLINE void copy(int start,int end, T* d est) SIMD_FORCE_INLINE void copy(int start,int end, T* d est) const
{ {
int i; int i;
for (i=start;i<end;++i) for (i=start;i<end;++i)
#ifdef BT_USE_PLACEMENT_NEW #ifdef BT_USE_PLACEMENT_NEW
new (&dest[i]) T(m_data[i]); new (&dest[i]) T(m_data[i]);
#else #else
dest[i] = m_data[i]; dest[i] = m_data[i];
#endif //BT_USE_PLACEMENT_NEW #endif //BT_USE_PLACEMENT_NEW
} }
skipping to change at line 118 skipping to change at line 118
btAlignedObjectArray() btAlignedObjectArray()
{ {
init(); init();
} }
~btAlignedObjectArray() ~btAlignedObjectArray()
{ {
clear(); clear();
} }
SIMD_FORCE_INLINE int capacity() const ///Generally it is best to avoid using the copy constructor
{ // return current length of allocated storage of an btAlignedObjectArray, and use a (const) reference to the array instea
return m_capacity; d.
btAlignedObjectArray(const btAlignedObjectArray& otherArray)
{
init();
int otherSize = otherArray.size();
resize (otherSize);
otherArray.copy(0, otherSize, m_data);
} }
/// return the number of elements in the array
SIMD_FORCE_INLINE int size() const SIMD_FORCE_INLINE int size() const
{ // return length of sequence {
return m_size; return m_size;
} }
SIMD_FORCE_INLINE const T& operator[](int n) const SIMD_FORCE_INLINE const T& operator[](int n) const
{ {
return m_data[n]; return m_data[n];
} }
SIMD_FORCE_INLINE T& operator[](int n) SIMD_FORCE_INLINE T& operator[](int n)
{ {
return m_data[n]; return m_data[n];
} }
///clear the array, deallocated memory. Generally it is bett er to use array.resize(0), to reduce performance overhead of run-time memor y (de)allocations.
SIMD_FORCE_INLINE void clear() SIMD_FORCE_INLINE void clear()
{ {
destroy(0,size()); destroy(0,size());
deallocate(); deallocate();
init(); init();
} }
SIMD_FORCE_INLINE void pop_back() SIMD_FORCE_INLINE void pop_back()
{ {
m_size--; m_size--;
m_data[m_size].~T(); m_data[m_size].~T();
} }
///resize changes the number of elements in the array. If th
e new size is larger, the new elements will be constructed using the option
al second argument.
///when the new number of elements is smaller, the destructo
r will be called, but memory will not be freed, to reduce performance overh
ead of run-time memory (de)allocations.
SIMD_FORCE_INLINE void resize(int newsize, const T& fillData=T()) SIMD_FORCE_INLINE void resize(int newsize, const T& fillData=T())
{ {
int curSize = size(); int curSize = size();
if (newsize < size()) if (newsize < size())
{ {
for(int i = curSize; i < newsize; i++) for(int i = curSize; i < newsize; i++)
{ {
m_data[i].~T(); m_data[i].~T();
} }
skipping to change at line 213 skipping to change at line 222
#ifdef BT_USE_PLACEMENT_NEW #ifdef BT_USE_PLACEMENT_NEW
new ( &m_data[m_size] ) T(_Val); new ( &m_data[m_size] ) T(_Val);
#else #else
m_data[size()] = _Val; m_data[size()] = _Val;
#endif //BT_USE_PLACEMENT_NEW #endif //BT_USE_PLACEMENT_NEW
m_size++; m_size++;
} }
/// return the pre-allocated (reserved) elements, this is at
least as large as the total number of elements,see size() and reserve()
SIMD_FORCE_INLINE int capacity() const
{
return m_capacity;
}
SIMD_FORCE_INLINE void reserve(int _Count) SIMD_FORCE_INLINE void reserve(int _Count)
{ // determine new minimum length of allocated storage { // determine new minimum length of allocated storage
if (capacity() < _Count) if (capacity() < _Count)
{ // not enough room, reallocate { // not enough room, reallocate
T* s = (T*)allocate(_Count); T* s = (T*)allocate(_Count);
copy(0, size(), s); copy(0, size(), s);
destroy(0,size()); destroy(0,size());
 End of changes. 7 change blocks. 
5 lines changed or deleted 27 lines changed or added


 btAxisSweep3.h   btAxisSweep3.h 
skipping to change at line 45 skipping to change at line 45
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
class btAxisSweep3Internal : public btBroadphaseInterface class btAxisSweep3Internal : public btBroadphaseInterface
{ {
protected: protected:
BP_FP_INT_TYPE m_bpHandleMask; BP_FP_INT_TYPE m_bpHandleMask;
BP_FP_INT_TYPE m_handleSentinel; BP_FP_INT_TYPE m_handleSentinel;
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR();
class Edge class Edge
{ {
public: public:
BP_FP_INT_TYPE m_pos; // low bit is min/ma x BP_FP_INT_TYPE m_pos; // low bit is min/ma x
BP_FP_INT_TYPE m_handle; BP_FP_INT_TYPE m_handle;
BP_FP_INT_TYPE IsMax() const {return static_cast<BP_FP_INT_T YPE>(m_pos & 1);} BP_FP_INT_TYPE IsMax() const {return static_cast<BP_FP_INT_T YPE>(m_pos & 1);}
}; };
public: public:
skipping to change at line 135 skipping to change at line 137
return m_numHandles; return m_numHandles;
} }
virtual void calculateOverlappingPairs(btDispatcher* dispatcher); virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& a abbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilt erMask,btDispatcher* dispatcher,void* multiSapProxy); BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& a abbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilt erMask,btDispatcher* dispatcher,void* multiSapProxy);
void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher); void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher);
void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,co nst btVector3& aabbMax,btDispatcher* dispatcher); void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,co nst btVector3& aabbMax,btDispatcher* dispatcher);
SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {ret urn m_pHandles + index;} SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {ret urn m_pHandles + index;}
void resetPool(); virtual void resetPool(btDispatcher* dispatcher);
void processAllOverlappingPairs(btOverlapCallback* callback); void processAllOverlappingPairs(btOverlapCallback* callback);
//Broadphase Interface //Broadphase Interface
virtual btBroadphaseProxy* createProxy( const btVector3& aabbM in, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collis ionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); virtual btBroadphaseProxy* createProxy( const btVector3& aabbM in, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collis ionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aa bbMin,const btVector3& aabbMax,btDispatcher* dispatcher); virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aa bbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, b tVector3& aabbMax ) const; virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, b tVector3& aabbMax ) const;
virtual void rayTest(const btVector3& rayFrom,const btVector3& ra yTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVecto r3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); virtual void rayTest(const btVector3& rayFrom,const btVector3& ra yTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVecto r3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
skipping to change at line 214 skipping to change at line 216
{ {
Edge* pEdge = m_pEdges[axis] + i; Edge* pEdge = m_pEdges[axis] + i;
Handle* pHandlePrev = getHandle(pEdge->m_handle); Handle* pHandlePrev = getHandle(pEdge->m_handle);
int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[ax is] : pHandlePrev->m_minEdges[axis]; int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[ax is] : pHandlePrev->m_minEdges[axis];
char beginOrEnd; char beginOrEnd;
beginOrEnd=pEdge->IsMax()?'E':'B'; beginOrEnd=pEdge->IsMax()?'E':'B';
printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_h andle,pEdge->m_pos,handleIndex); printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_h andle,pEdge->m_pos,handleIndex);
} }
if (checkCardinality) if (checkCardinality)
assert(numEdges == m_numHandles*2+1); btAssert(numEdges == m_numHandles*2+1);
} }
#endif //DEBUG_BROADPHASE #endif //DEBUG_BROADPHASE
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
btBroadphaseProxy* btAxisSweep3Internal<BP_FP_INT_TYPE>::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* use rPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatc her* dispatcher,void* multiSapProxy) btBroadphaseProxy* btAxisSweep3Internal<BP_FP_INT_TYPE>::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* use rPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatc her* dispatcher,void* multiSapProxy)
{ {
(void)shapeType; (void)shapeType;
BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr ,collisionFilterGroup,collisionFilterMask,dispatcher,multiSapProxy); BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr ,collisionFilterGroup,collisionFilterMask,dispatcher,multiSapProxy);
Handle* handle = getHandle(handleId); Handle* handle = getHandle(handleId);
skipping to change at line 332 skipping to change at line 334
m_ownsPairCache = true; m_ownsPairCache = true;
} }
if (!disableRaycastAccelerator) if (!disableRaycastAccelerator)
{ {
m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache ),16)) btNullPairCache(); m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache ),16)) btNullPairCache();
m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroa dphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache); m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroa dphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache);
m_raycastAccelerator->m_deferedcollide = true;//don't add/re move pairs m_raycastAccelerator->m_deferedcollide = true;//don't add/re move pairs
} }
//assert(bounds.HasVolume()); //btAssert(bounds.HasVolume());
// init bounds // init bounds
m_worldAabbMin = worldAabbMin; m_worldAabbMin = worldAabbMin;
m_worldAabbMax = worldAabbMax; m_worldAabbMax = worldAabbMax;
btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin; btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin;
BP_FP_INT_TYPE maxInt = m_handleSentinel; BP_FP_INT_TYPE maxInt = m_handleSentinel;
m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(ma xInt)) / aabbSize; m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(ma xInt)) / aabbSize;
skipping to change at line 437 skipping to change at line 439
btVector3 v = (point - m_worldAabbMin) * m_quantize; btVector3 v = (point - m_worldAabbMin) * m_quantize;
out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_ FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP _FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax); out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_ FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP _FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax);
out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_ FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP _FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax); out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_ FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP _FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax);
out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_ FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP _FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax); out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_ FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP _FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax);
#endif //OLD_CLAMPING_METHOD #endif //OLD_CLAMPING_METHOD
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle() BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
{ {
assert(m_firstFreeHandle); btAssert(m_firstFreeHandle);
BP_FP_INT_TYPE handle = m_firstFreeHandle; BP_FP_INT_TYPE handle = m_firstFreeHandle;
m_firstFreeHandle = getHandle(handle)->GetNextFree(); m_firstFreeHandle = getHandle(handle)->GetNextFree();
m_numHandles++; m_numHandles++;
return handle; return handle;
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle ) void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle )
{ {
assert(handle > 0 && handle < m_maxHandles); btAssert(handle > 0 && handle < m_maxHandles);
getHandle(handle)->SetNextFree(m_firstFreeHandle); getHandle(handle)->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle; m_firstFreeHandle = handle;
m_numHandles--; m_numHandles--;
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::addHandle(const btVect or3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilt erGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiS apProxy) BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::addHandle(const btVect or3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilt erGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiS apProxy)
{ {
skipping to change at line 562 skipping to change at line 564
#endif //DEBUG_BROADPHASE #endif //DEBUG_BROADPHASE
} }
// free the handle // free the handle
freeHandle(handle); freeHandle(handle);
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::resetPool() void btAxisSweep3Internal<BP_FP_INT_TYPE>::resetPool(btDispatcher* dispatch er)
{ {
if (m_numHandles == 0) if (m_numHandles == 0)
{ {
m_firstFreeHandle = 1; m_firstFreeHandle = 1;
{ {
for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_max Handles; i++) for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_max Handles; i++)
m_pHandles[i].SetNextFree(static_cast<BP_FP_ INT_TYPE>(i + 1)); m_pHandles[i].SetNextFree(static_cast<BP_FP_ INT_TYPE>(i + 1));
m_pHandles[m_maxHandles - 1].SetNextFree(0); m_pHandles[m_maxHandles - 1].SetNextFree(0);
} }
} }
skipping to change at line 613 skipping to change at line 615
btBroadphasePair& pair = overlappingPairArray[i]; btBroadphasePair& pair = overlappingPairArray[i];
bool isDuplicate = (pair == previousPair); bool isDuplicate = (pair == previousPair);
previousPair = pair; previousPair = pair;
bool needsRemoval = false; bool needsRemoval = false;
if (!isDuplicate) if (!isDuplicate)
{ {
///important to use an AABB test that is con sistent with the broadphase
bool hasOverlap = testAabbOverlap(pair.m_pPr oxy0,pair.m_pProxy1); bool hasOverlap = testAabbOverlap(pair.m_pPr oxy0,pair.m_pProxy1);
if (hasOverlap) if (hasOverlap)
{ {
needsRemoval = false;//callback->pro cessOverlap(pair); needsRemoval = false;//callback->pro cessOverlap(pair);
} else } else
{ {
needsRemoval = true; needsRemoval = true;
} }
} else } else
skipping to change at line 697 skipping to change at line 700
pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1]) pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1])
{ {
return false; return false;
} }
return true; return true;
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE hand le, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatc her) void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE hand le, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatc her)
{ {
// assert(bounds.IsFinite()); // btAssert(bounds.IsFinite());
//assert(bounds.HasVolume()); //btAssert(bounds.HasVolume());
Handle* pHandle = getHandle(handle); Handle* pHandle = getHandle(handle);
// quantize the new bounds // quantize the new bounds
BP_FP_INT_TYPE min[3], max[3]; BP_FP_INT_TYPE min[3], max[3];
quantize(min, aabbMin, 0); quantize(min, aabbMin, 0);
quantize(max, aabbMax, 1); quantize(max, aabbMax, 1);
// update changed edges // update changed edges
for (int axis = 0; axis < 3; axis++) for (int axis = 0; axis < 3; axis++)
 End of changes. 9 change blocks. 
8 lines changed or deleted 11 lines changed or added


 btBoxShape.h   btBoxShape.h 
skipping to change at line 156 skipping to change at line 156
halfExtents.z() * (1-((i&4)>>2)) - halfExten ts.z() * ((i&4)>>2)); halfExtents.z() * (1-((i&4)>>2)) - halfExten ts.z() * ((i&4)>>2));
} }
virtual void getPlaneEquation(btVector4& plane,int i) const virtual void getPlaneEquation(btVector4& plane,int i) const
{ {
btVector3 halfExtents = getHalfExtentsWithoutMargin(); btVector3 halfExtents = getHalfExtentsWithoutMargin();
switch (i) switch (i)
{ {
case 0: case 0:
plane.setValue(btScalar(1.),btScalar(0.),btScalar(0. plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.
)); ),-halfExtents.x());
plane[3] = -halfExtents.x();
break; break;
case 1: case 1:
plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0 plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0
.)); .),-halfExtents.x());
plane[3] = -halfExtents.x();
break; break;
case 2: case 2:
plane.setValue(btScalar(0.),btScalar(1.),btScalar(0. plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.
)); ),-halfExtents.y());
plane[3] = -halfExtents.y();
break; break;
case 3: case 3:
plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0 plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0
.)); .),-halfExtents.y());
plane[3] = -halfExtents.y();
break; break;
case 4: case 4:
plane.setValue(btScalar(0.),btScalar(0.),btScalar(1. plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.
)); ),-halfExtents.z());
plane[3] = -halfExtents.z();
break; break;
case 5: case 5:
plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1 plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1
.)); .),-halfExtents.z());
plane[3] = -halfExtents.z();
break; break;
default: default:
assert(0); btAssert(0);
} }
} }
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
//virtual void getEdge(int i,Edge& edge) const //virtual void getEdge(int i,Edge& edge) const
{ {
int edgeVert0 = 0; int edgeVert0 = 0;
int edgeVert1 = 0; int edgeVert1 = 0;
switch (i) switch (i)
skipping to change at line 301 skipping to change at line 295
case 3: case 3:
penetrationVector.setValue(btScalar(0.),btScalar(-1. ),btScalar(0.)); penetrationVector.setValue(btScalar(0.),btScalar(-1. ),btScalar(0.));
break; break;
case 4: case 4:
penetrationVector.setValue(btScalar(0.),btScalar(0.) ,btScalar(1.)); penetrationVector.setValue(btScalar(0.),btScalar(0.) ,btScalar(1.));
break; break;
case 5: case 5:
penetrationVector.setValue(btScalar(0.),btScalar(0.) ,btScalar(-1.)); penetrationVector.setValue(btScalar(0.),btScalar(0.) ,btScalar(-1.));
break; break;
default: default:
assert(0); btAssert(0);
} }
} }
}; };
#endif //OBB_BOX_MINKOWSKI_H #endif //OBB_BOX_MINKOWSKI_H
 End of changes. 8 change blocks. 
20 lines changed or deleted 14 lines changed or added


 btBroadphaseInterface.h   btBroadphaseInterface.h 
skipping to change at line 63 skipping to change at line 63
///calculateOverlappingPairs is optional: incremental algorithms (sw eep and prune) might do it during the set aabb ///calculateOverlappingPairs is optional: incremental algorithms (sw eep and prune) might do it during the set aabb
virtual void calculateOverlappingPairs(btDispatcher* dispatcher)= 0; virtual void calculateOverlappingPairs(btDispatcher* dispatcher)= 0;
virtual btOverlappingPairCache* getOverlappingPairCache()=0; virtual btOverlappingPairCache* getOverlappingPairCache()=0;
virtual const btOverlappingPairCache* getOverlappingPairCache() co nst =0; virtual const btOverlappingPairCache* getOverlappingPairCache() co nst =0;
///getAabb returns the axis aligned bounding box in the 'global' coo rdinate frame ///getAabb returns the axis aligned bounding box in the 'global' coo rdinate frame
///will add some transform later ///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax ) const =0; virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax ) const =0;
///reset broadphase internal structures, to ensure determinism/repro
ducability
virtual void resetPool(btDispatcher* dispatcher) {};
virtual void printStats() = 0; virtual void printStats() = 0;
}; };
#endif //BROADPHASE_INTERFACE_H #endif //BROADPHASE_INTERFACE_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 btBroadphaseProxy.h   btBroadphaseProxy.h 
skipping to change at line 71 skipping to change at line 71
MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE, MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE,
EMPTY_SHAPE_PROXYTYPE, EMPTY_SHAPE_PROXYTYPE,
STATIC_PLANE_PROXYTYPE, STATIC_PLANE_PROXYTYPE,
CUSTOM_CONCAVE_SHAPE_TYPE, CUSTOM_CONCAVE_SHAPE_TYPE,
CONCAVE_SHAPES_END_HERE, CONCAVE_SHAPES_END_HERE,
COMPOUND_SHAPE_PROXYTYPE, COMPOUND_SHAPE_PROXYTYPE,
SOFTBODY_SHAPE_PROXYTYPE, SOFTBODY_SHAPE_PROXYTYPE,
HFFLUID_SHAPE_PROXYTYPE,
HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE,
INVALID_SHAPE_PROXYTYPE, INVALID_SHAPE_PROXYTYPE,
MAX_BROADPHASE_COLLISION_TYPES MAX_BROADPHASE_COLLISION_TYPES
}; };
///The btBroadphaseProxy is the main class that can be used with the Bullet broadphases. ///The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
///It stores collision shape type information, collision filter information and a client object, typically a btCollisionObject or btRigidBody. ///It stores collision shape type information, collision filter information and a client object, typically a btCollisionObject or btRigidBody.
ATTRIBUTE_ALIGNED16(struct) btBroadphaseProxy ATTRIBUTE_ALIGNED16(struct) btBroadphaseProxy
{ {
skipping to change at line 184 skipping to change at line 185
: m_pProxy0(other.m_pProxy0), : m_pProxy0(other.m_pProxy0),
m_pProxy1(other.m_pProxy1), m_pProxy1(other.m_pProxy1),
m_algorithm(other.m_algorithm), m_algorithm(other.m_algorithm),
m_internalInfo1(other.m_internalInfo1) m_internalInfo1(other.m_internalInfo1)
{ {
} }
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1 ) btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1 )
{ {
//keep them sorted, so the std::set operations work //keep them sorted, so the std::set operations work
if (&proxy0 < &proxy1) if (proxy0.m_uniqueId < proxy1.m_uniqueId)
{ {
m_pProxy0 = &proxy0; m_pProxy0 = &proxy0;
m_pProxy1 = &proxy1; m_pProxy1 = &proxy1;
} }
else else
{ {
m_pProxy0 = &proxy1; m_pProxy0 = &proxy1;
m_pProxy1 = &proxy0; m_pProxy1 = &proxy0;
} }
skipping to change at line 223 skipping to change at line 224
(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 < b.m_pProxy1); (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 < b.m_pProxy1);
} }
*/ */
class btBroadphasePairSortPredicate class btBroadphasePairSortPredicate
{ {
public: public:
bool operator() ( const btBroadphasePair& a, const btBroadph asePair& b ) bool operator() ( const btBroadphasePair& a, const btBroadph asePair& b )
{ {
return a.m_pProxy0 > b.m_pProxy0 || const int uidA0 = a.m_pProxy0 ? a.m_pProxy0->m_uniqu
(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 > eId : -1;
b.m_pProxy1) || const int uidB0 = b.m_pProxy0 ? b.m_pProxy0->m_uniqu
eId : -1;
const int uidA1 = a.m_pProxy1 ? a.m_pProxy1->m_uniqu
eId : -1;
const int uidB1 = b.m_pProxy1 ? b.m_pProxy1->m_uniqu
eId : -1;
return uidA0 > uidB0 ||
(a.m_pProxy0 == b.m_pProxy0 && uidA1 > uidB1
) ||
(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 = = b.m_pProxy1 && a.m_algorithm > b.m_algorithm); (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 = = b.m_pProxy1 && a.m_algorithm > b.m_algorithm);
} }
}; };
SIMD_FORCE_INLINE bool operator==(const btBroadphasePair& a, const btBroadp hasePair& b) SIMD_FORCE_INLINE bool operator==(const btBroadphasePair& a, const btBroadp hasePair& b)
{ {
return (a.m_pProxy0 == b.m_pProxy0) && (a.m_pProxy1 == b.m_pProxy1) ; return (a.m_pProxy0 == b.m_pProxy0) && (a.m_pProxy1 == b.m_pProxy1) ;
} }
#endif //BROADPHASE_PROXY_H #endif //BROADPHASE_PROXY_H
 End of changes. 3 change blocks. 
5 lines changed or deleted 15 lines changed or added


 btCharacterControllerInterface.h   btCharacterControllerInterface.h 
skipping to change at line 20 skipping to change at line 20
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 CHARACTER_CONTROLLER_INTERFACE_H #ifndef CHARACTER_CONTROLLER_INTERFACE_H
#define CHARACTER_CONTROLLER_INTERFACE_H #define CHARACTER_CONTROLLER_INTERFACE_H
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "BulletDynamics/Dynamics/btActionInterface.h"
class btCollisionShape; class btCollisionShape;
class btRigidBody; class btRigidBody;
class btCollisionWorld; class btCollisionWorld;
class btCharacterControllerInterface class btCharacterControllerInterface : public btActionInterface
{ {
public: public:
btCharacterControllerInterface () {}; btCharacterControllerInterface () {};
virtual ~btCharacterControllerInterface () {}; virtual ~btCharacterControllerInterface () {};
virtual void setWalkDirection(const btVector3& walkDirection) = 0 ; virtual void setWalkDirection(const btVector3& walkDirection) = 0 ;
virtual void reset () = 0; virtual void reset () = 0;
virtual void warp (const btVector3& origin) = 0; virtual void warp (const btVector3& origin) = 0;
virtual void preStep ( btCollisionWorld* collisionWorld) = 0; virtual void preStep ( btCollisionWorld* collisionWorld) = 0;
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 btCollisionObject.h   btCollisionObject.h 
skipping to change at line 53 skipping to change at line 53
btTransform m_worldTransform; btTransform m_worldTransform;
///m_interpolationWorldTransform is used for CCD and interpolation ///m_interpolationWorldTransform is used for CCD and interpolation
///it can be either previous or future (predicted) transform ///it can be either previous or future (predicted) transform
btTransform m_interpolationWorldTransform; btTransform m_interpolationWorldTransform;
//those two are experimental: just added for bullet time effect, so you can still apply impulses (directly modifying velocities) //those two are experimental: just added for bullet time effect, so you can still apply impulses (directly modifying velocities)
//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;
bool m_hasAnisotropicFriction;
btScalar m_contactProcessingThreshold;
btBroadphaseProxy* m_broadphaseHandle; btBroadphaseProxy* m_broadphaseHandle;
btCollisionShape* m_collisionShape; btCollisionShape* m_collisionShape;
///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;
skipping to change at line 115 skipping to change at line 120
CF_KINEMATIC_OBJECT= 2, CF_KINEMATIC_OBJECT= 2,
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
}; };
enum CollisionObjectTypes enum CollisionObjectTypes
{ {
CO_COLLISION_OBJECT =1, CO_COLLISION_OBJECT =1,
CO_RIGID_BODY, CO_RIGID_BODY,
CO_SOFT_BODY,
///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,
CO_SOFT_BODY,
CO_HF_FLUID
}; };
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
{
return m_anisotropicFriction;
}
void setAnisotropicFriction(const btVector3& anisotropicFriction)
{
m_anisotropicFriction = anisotropicFriction;
m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) ||
(anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f);
}
bool hasAnisotropicFriction() const
{
return m_hasAnisotropicFriction;
}
///the constraint solver can discard solving contacts, if the distan
ce is above this threshold. 0 by default.
///Note that using contacts with positive distance can improve stabi
lity. It increases, however, the chance of colliding with degerate contacts
, such as 'interior' triangle edges
void setContactProcessingThreshold( btScalar contactProcessingThr
eshold)
{
m_contactProcessingThreshold = contactProcessingThreshold;
}
btScalar getContactProcessingThreshold() const
{
return m_contactProcessingThreshold;
}
SIMD_FORCE_INLINE bool isStaticObject() const { SIMD_FORCE_INLINE bool isStaticObject() const {
return (m_collisionFlags & CF_STATIC_OBJECT) != 0; return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
} }
SIMD_FORCE_INLINE bool isKinematicObject() const SIMD_FORCE_INLINE bool isKinematicObject() const
{ {
return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0; return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
} }
SIMD_FORCE_INLINE bool isStaticOrKinematicObject() const SIMD_FORCE_INLINE bool isStaticOrKinematicObject() const
 End of changes. 4 change blocks. 
2 lines changed or deleted 38 lines changed or added


 btCollisionWorld.h   btCollisionWorld.h 
skipping to change at line 130 skipping to change at line 130
btDispatcher* getDispatcher() btDispatcher* getDispatcher()
{ {
return m_dispatcher1; return m_dispatcher1;
} }
const btDispatcher* getDispatcher() const const btDispatcher* getDispatcher() const
{ {
return m_dispatcher1; return m_dispatcher1;
} }
void updateSingleAabb(btCollisionObject* colObj);
virtual void updateAabbs(); virtual void updateAabbs();
virtual void setDebugDrawer(btIDebugDraw* debugDrawer) virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
{ {
m_debugDrawer = debugDrawer; m_debugDrawer = debugDrawer;
} }
virtual btIDebugDraw* getDebugDrawer() virtual btIDebugDraw* getDebugDrawer()
{ {
return m_debugDrawer; return m_debugDrawer;
skipping to change at line 180 skipping to change at line 182
}; };
///RayResultCallback is used to report new raycast results ///RayResultCallback is used to report new raycast results
struct RayResultCallback struct RayResultCallback
{ {
btScalar m_closestHitFraction; btScalar m_closestHitFraction;
btCollisionObject* m_collisionObject; btCollisionObject* m_collisionObject;
short int m_collisionFilterGroup; short int m_collisionFilterGroup;
short int m_collisionFilterMask; short int m_collisionFilterMask;
//@BP Mod - Custom flags, currently used to enable backface culling o
n tri-meshes, see btRaycastCallback
unsigned int m_flags;
virtual ~RayResultCallback() virtual ~RayResultCallback()
{ {
} }
bool hasHit() const bool hasHit() const
{ {
return (m_collisionObject != 0); return (m_collisionObject != 0);
} }
RayResultCallback() RayResultCallback()
:m_closestHitFraction(btScalar(1.)), :m_closestHitFraction(btScalar(1.)),
m_collisionObject(0), m_collisionObject(0),
m_collisionFilterGroup(btBroadphaseProxy::DefaultFil ter), m_collisionFilterGroup(btBroadphaseProxy::DefaultFil ter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter) m_collisionFilterMask(btBroadphaseProxy::AllFilter),
//@BP Mod
m_flags(0)
{ {
} }
virtual bool needsCollision(btBroadphaseProxy* proxy0) const virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{ {
bool collides = (proxy0->m_collisionFilterGroup & m_ collisionFilterMask) != 0; bool collides = (proxy0->m_collisionFilterGroup & m_ collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & pro xy0->m_collisionFilterMask); collides = collides && (m_collisionFilterGroup & pro xy0->m_collisionFilterMask);
return collides; return collides;
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 8 lines changed or added


 btCompoundCollisionAlgorithm.h   btCompoundCollisionAlgorithm.h 
skipping to change at line 29 skipping to change at line 29
#include "btActivatingCollisionAlgorithm.h" #include "btActivatingCollisionAlgorithm.h"
#include "BulletCollision/BroadphaseCollision/btDispatcher.h" #include "BulletCollision/BroadphaseCollision/btDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
class btDispatcher; class btDispatcher;
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "btCollisionCreateFunc.h" #include "btCollisionCreateFunc.h"
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
class btDispatcher; class btDispatcher;
class btCollisionObject;
/// btCompoundCollisionAlgorithm supports collision between CompoundCollis ionShapes and other collision shapes /// btCompoundCollisionAlgorithm supports collision between CompoundCollis ionShapes and other collision shapes
class btCompoundCollisionAlgorithm : public btActivatingCollisionAlgorithm class btCompoundCollisionAlgorithm : public btActivatingCollisionAlgorithm
{ {
btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorith ms; btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorith ms;
bool m_isSwapped; bool m_isSwapped;
class btPersistentManifold* m_sharedManifold; class btPersistentManifold* m_sharedManifold;
bool m_ownsManifold; bool m_ownsManifold;
int m_compoundShapeRevision;//to keep track of changes, so that
childAlgorithm array can be updated
void removeChildAlgorithms();
void preallocateChildAlgorithms(btCollisionObject* body0,btCollis
ionObject* body1);
public: public:
btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstruction Info& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped); btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstruction Info& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
virtual ~btCompoundCollisionAlgorithm(); virtual ~btCompoundCollisionAlgorithm();
virtual void processCollision (btCollisionObject* body0,btCollisionO bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO ut); virtual void processCollision (btCollisionObject* body0,btCollisionO bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO ut);
btScalar calculateTimeOfImpact(btCollisionObject* body0,btCol lisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut); btScalar calculateTimeOfImpact(btCollisionObject* body0,btCol lisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
 End of changes. 2 change blocks. 
0 lines changed or deleted 9 lines changed or added


 btCompoundShape.h   btCompoundShape.h 
skipping to change at line 62 skipping to change at line 62
/// @todo: This aabb tree can also be use to speed up ray tests on btCompou ndShape, see http://code.google.com/p/bullet/issues/detail?id=25 /// @todo: This aabb tree can also be use to speed up ray tests on btCompou ndShape, see http://code.google.com/p/bullet/issues/detail?id=25
/// Currently, removal of child shapes is only supported when disabling the aabb tree (pass 'false' in the constructor of btCompoundShape) /// Currently, removal of child shapes is only supported when disabling the aabb tree (pass 'false' in the constructor of btCompoundShape)
ATTRIBUTE_ALIGNED16(class) btCompoundShape : public btCollisionShape ATTRIBUTE_ALIGNED16(class) btCompoundShape : public btCollisionShape
{ {
btAlignedObjectArray<btCompoundShapeChild> m_children; btAlignedObjectArray<btCompoundShapeChild> m_children;
btVector3 m_localAabbM in; btVector3 m_localAabbM in;
btVector3 m_localAabbM ax; btVector3 m_localAabbM ax;
btDbvt* m_dynamicAab bTree; btDbvt* m_dynamicAab bTree;
///increment m_updateRevision when adding/removing/replacing child s
hapes, so that some caches can be updated
int m_up
dateRevision;
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btCompoundShape(bool enableDynamicAabbTree = true); btCompoundShape(bool enableDynamicAabbTree = true);
virtual ~btCompoundShape(); virtual ~btCompoundShape();
void addChildShape(const btTransform& localTransform,btCollisionS hape* shape); void addChildShape(const btTransform& localTransform,btCollisionS hape* shape);
/// Remove all children shapes that contain the specified shape /// Remove all children shapes that contain the specified shape
skipping to change at line 153 skipping to change at line 156
return m_dynamicAabbTree; return m_dynamicAabbTree;
} }
///computes the exact moment of inertia and the transform from the c oordinate system defined by the principal axes of the moment of inertia ///computes the exact moment of inertia and the transform from the c oordinate system defined by the principal axes of the moment of inertia
///and the center of mass to the current coordinate system. "masses" points to an array of masses of the children. The resulting transform ///and the center of mass to the current coordinate system. "masses" points to an array of masses of the children. The resulting transform
///"principal" has to be applied inversely to all children transform s in order for the local coordinate system of the compound ///"principal" has to be applied inversely to all children transform s in order for the local coordinate system of the compound
///shape to be centered at the center of mass and to coincide with t he principal axes. This also necessitates a correction of the world transfo rm ///shape to be centered at the center of mass and to coincide with t he principal axes. This also necessitates a correction of the world transfo rm
///of the collision object by the principal transform. ///of the collision object by the principal transform.
void calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const; void calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const;
int getUpdateRevision() const
{
return m_updateRevision;
}
private: private:
btScalar m_collisionMargin; btScalar m_collisionMargin;
protected: protected:
btVector3 m_localScaling; btVector3 m_localScaling;
}; };
#endif //COMPOUND_SHAPE_H #endif //COMPOUND_SHAPE_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 10 lines changed or added


 btConeTwistConstraint.h   btConeTwistConstraint.h 
skipping to change at line 42 skipping to change at line 42
#endif #endif
btJacobianEntry m_jac[3]; //3 orthogonal linear constraints btJacobianEntry m_jac[3]; //3 orthogonal linear constraints
btTransform m_rbAFrame; btTransform m_rbAFrame;
btTransform m_rbBFrame; btTransform m_rbBFrame;
btScalar m_limitSoftness; btScalar m_limitSoftness;
btScalar m_biasFactor; btScalar m_biasFactor;
btScalar m_relaxationFactor; btScalar m_relaxationFactor;
btScalar m_damping;
btScalar m_swingSpan1; btScalar m_swingSpan1;
btScalar m_swingSpan2; btScalar m_swingSpan2;
btScalar m_twistSpan; btScalar m_twistSpan;
btScalar m_fixThresh;
btVector3 m_swingAxis; btVector3 m_swingAxis;
btVector3 m_twistAxis; btVector3 m_twistAxis;
btScalar m_kSwing; btScalar m_kSwing;
btScalar m_kTwist; btScalar m_kTwist;
btScalar m_twistLimitSign; btScalar m_twistLimitSign;
btScalar m_swingCorrection; btScalar m_swingCorrection;
btScalar m_twistCorrection; btScalar m_twistCorrection;
btScalar m_twistAngle;
btScalar m_accSwingLimitImpulse; btScalar m_accSwingLimitImpulse;
btScalar m_accTwistLimitImpulse; btScalar m_accTwistLimitImpulse;
bool m_angularOnly; bool m_angularOnly;
bool m_solveTwistLimit; bool m_solveTwistLimit;
bool m_solveSwingLimit; bool m_solveSwingLimit;
bool m_useSolveConstraintObsolete;
// not yet used...
btScalar m_swingLimitRatio;
btScalar m_twistLimitRatio;
btVector3 m_twistAxisA;
// motor
bool m_bMotorEnabled;
bool m_bNormalizedMotorStrength;
btQuaternion m_qTarget;
btScalar m_maxMotorImpulse;
btVector3 m_accMotorImpulse;
public: public:
btConeTwistConstraint(btRigidBody& rbA,btRigidBody& rbB,const btTran sform& rbAFrame, const btTransform& rbBFrame); btConeTwistConstraint(btRigidBody& rbA,btRigidBody& rbB,const btTran sform& rbAFrame, const btTransform& rbBFrame);
btConeTwistConstraint(btRigidBody& rbA,const btTransform& rbAFrame); btConeTwistConstraint(btRigidBody& rbA,const btTransform& rbAFrame);
btConeTwistConstraint(); btConeTwistConstraint();
virtual void buildJacobian(); virtual void buildJacobian();
virtual void solveConstraint(btScalar timeStep); virtual void getInfo1 (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info);
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep);
void updateRHS(btScalar timeStep); void updateRHS(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;
} }
void setAngularOnly(bool angularOnly) void setAngularOnly(bool angularOnly)
{ {
m_angularOnly = angularOnly; m_angularOnly = angularOnly;
} }
void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar void setLimit(int limitIndex,btScalar limitValue)
_twistSpan, btScalar _softness = 0.8f, btScalar _biasFactor = 0.3f, btScal {
ar _relaxationFactor = 1.0f) switch (limitIndex)
{
case 3:
{
m_twistSpan = limitValue;
break;
}
case 4:
{
m_swingSpan2 = limitValue;
break;
}
case 5:
{
m_swingSpan1 = limitValue;
break;
}
default:
{
}
};
}
void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar
_twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScala
r _relaxationFactor = 1.0f)
{ {
m_swingSpan1 = _swingSpan1; m_swingSpan1 = _swingSpan1;
m_swingSpan2 = _swingSpan2; m_swingSpan2 = _swingSpan2;
m_twistSpan = _twistSpan; m_twistSpan = _twistSpan;
m_limitSoftness = _softness; m_limitSoftness = _softness;
m_biasFactor = _biasFactor; m_biasFactor = _biasFactor;
m_relaxationFactor = _relaxationFactor; m_relaxationFactor = _relaxationFactor;
} }
skipping to change at line 120 skipping to change at line 169
inline int getSolveSwingLimit() inline int getSolveSwingLimit()
{ {
return m_solveTwistLimit; return m_solveTwistLimit;
} }
inline btScalar getTwistLimitSign() inline btScalar getTwistLimitSign()
{ {
return m_twistLimitSign; return m_twistLimitSign;
} }
void calcAngleInfo();
void calcAngleInfo2();
inline btScalar getSwingSpan1()
{
return m_swingSpan1;
}
inline btScalar getSwingSpan2()
{
return m_swingSpan2;
}
inline btScalar getTwistSpan()
{
return m_twistSpan;
}
inline btScalar getTwistAngle()
{
return m_twistAngle;
}
bool isPastSwingLimit() { return m_solveSwingLimit; }
void setDamping(btScalar damping) { m_damping = damping; }
void enableMotor(bool b) { m_bMotorEnabled = b; }
void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpuls
e = maxMotorImpulse; m_bNormalizedMotorStrength = false; }
void setMaxMotorImpulseNormalized(btScalar maxMotorImpulse) { m_maxM
otorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = true; }
btScalar getFixThresh() { return m_fixThresh; }
void setFixThresh(btScalar fixThresh) { m_fixThresh = fixThresh; }
// setMotorTarget:
// q: the desired rotation of bodyA wrt bodyB.
// note: if q violates the joint limits, the internal target is clam
ped to avoid conflicting impulses (very bad for stability)
// note: don't forget to enableMotor()
void setMotorTarget(const btQuaternion &q);
// same as above, but q is the desired rotation of frameA wrt frameB
in constraint space
void setMotorTargetInConstraintSpace(const btQuaternion &q);
btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLengt
h) const;
protected:
void init();
void computeConeLimitInfo(const btQuaternion& qCone, // in
btScalar& swingAngle, btVector3& vSwingAxis, btScalar& swing
Limit); // all outs
void computeTwistLimitInfo(const btQuaternion& qTwist, // in
btScalar& twistAngle, btVector3& vTwistAxis); // all outs
void adjustSwingAxisToUseEllipseNormal(btVector3& vSwingAxis) const;
}; };
#endif //CONETWISTCONSTRAINT_H #endif //CONETWISTCONSTRAINT_H
 End of changes. 7 change blocks. 
4 lines changed or deleted 111 lines changed or added


 btContactSolverInfo.h   btContactSolverInfo.h 
skipping to change at line 25 skipping to change at line 25
#ifndef CONTACT_SOLVER_INFO #ifndef CONTACT_SOLVER_INFO
#define CONTACT_SOLVER_INFO #define CONTACT_SOLVER_INFO
enum btSolverMode enum btSolverMode
{ {
SOLVER_RANDMIZE_ORDER = 1, SOLVER_RANDMIZE_ORDER = 1,
SOLVER_FRICTION_SEPARATE = 2, SOLVER_FRICTION_SEPARATE = 2,
SOLVER_USE_WARMSTARTING = 4, SOLVER_USE_WARMSTARTING = 4,
SOLVER_USE_FRICTION_WARMSTARTING = 8, SOLVER_USE_FRICTION_WARMSTARTING = 8,
SOLVER_CACHE_FRIENDLY = 16 SOLVER_USE_2_FRICTION_DIRECTIONS = 16,
SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32,
SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64,
SOLVER_CACHE_FRIENDLY = 128,
SOLVER_SIMD = 256, //enabled for Windows, the solver innerloop
is branchless SIMD, 40% faster than FPU/scalar version
SOLVER_CUDA = 512 //will be open sourced during Game Developer
s Conference 2009. Much faster.
}; };
struct btContactSolverInfoData struct btContactSolverInfoData
{ {
btScalar m_tau; btScalar m_tau;
btScalar m_damping; btScalar m_damping;
btScalar m_friction; btScalar m_friction;
btScalar m_timeStep; btScalar m_timeStep;
btScalar m_restitution; btScalar m_restitution;
int m_numIterations; int m_numIterations;
btScalar m_maxErrorReduction; btScalar m_maxErrorReduction;
btScalar m_sor; btScalar m_sor;
btScalar m_erp;//used as Baumgarte factor btScalar m_erp;//used as Baumgarte factor
btScalar m_erp2;//used in Split Impulse btScalar m_erp2;//used in Split Impulse
btScalar m_globalCfm;//constraint force mixing
int m_splitImpulse; int m_splitImpulse;
btScalar m_splitImpulsePenetrationThreshold; btScalar m_splitImpulsePenetrationThreshold;
btScalar m_linearSlop; btScalar m_linearSlop;
btScalar m_warmstartingFactor; btScalar m_warmstartingFactor;
int m_solverMode; int m_solverMode;
int m_restingContactRestitutionThreshold; int m_restingContactRestitutionThreshold;
}; };
skipping to change at line 64 skipping to change at line 70
inline btContactSolverInfo() inline btContactSolverInfo()
{ {
m_tau = btScalar(0.6); m_tau = btScalar(0.6);
m_damping = btScalar(1.0); m_damping = btScalar(1.0);
m_friction = btScalar(0.3); m_friction = btScalar(0.3);
m_restitution = btScalar(0.); m_restitution = btScalar(0.);
m_maxErrorReduction = btScalar(20.); m_maxErrorReduction = btScalar(20.);
m_numIterations = 10; m_numIterations = 10;
m_erp = btScalar(0.2); m_erp = btScalar(0.2);
m_erp2 = btScalar(0.1); m_erp2 = btScalar(0.1);
m_sor = btScalar(1.3); m_globalCfm = btScalar(0.);
m_sor = btScalar(1.);
m_splitImpulse = false; m_splitImpulse = false;
m_splitImpulsePenetrationThreshold = -0.02f; m_splitImpulsePenetrationThreshold = -0.02f;
m_linearSlop = btScalar(0.0); m_linearSlop = btScalar(0.0);
m_warmstartingFactor=btScalar(0.85); m_warmstartingFactor=btScalar(0.85);
m_solverMode = SOLVER_CACHE_FRIENDLY | SOLVER_RANDMIZE_ORDE R | SOLVER_USE_WARMSTARTING; m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD ;//SOLV ER_RANDMIZE_ORDER
m_restingContactRestitutionThreshold = 2;//resting contact l ifetime threshold to disable restitution m_restingContactRestitutionThreshold = 2;//resting contact l ifetime threshold to disable restitution
} }
}; };
#endif //CONTACT_SOLVER_INFO #endif //CONTACT_SOLVER_INFO
 End of changes. 4 change blocks. 
3 lines changed or deleted 12 lines changed or added


 btConvexConvexAlgorithm.h   btConvexConvexAlgorithm.h 
skipping to change at line 36 skipping to change at line 36
#include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUti l #include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUti l
class btConvexPenetrationDepthSolver; class btConvexPenetrationDepthSolver;
///Enabling USE_SEPDISTANCE_UTIL2 requires 100% reliable distance computati on. However, when using large size ratios GJK can be imprecise ///Enabling USE_SEPDISTANCE_UTIL2 requires 100% reliable distance computati on. However, when using large size ratios GJK can be imprecise
///so the distance is not conservative. In that case, enabling this USE_SEP DISTANCE_UTIL2 would result in failing/missing collisions. ///so the distance is not conservative. In that case, enabling this USE_SEP DISTANCE_UTIL2 would result in failing/missing collisions.
///Either improve GJK for large size ratios (testing a 100 units versus a 0 .1 unit object) or only enable the util ///Either improve GJK for large size ratios (testing a 100 units versus a 0 .1 unit object) or only enable the util
///for certain pairs that have a small size ratio ///for certain pairs that have a small size ratio
///#define USE_SEPDISTANCE_UTIL2 1 ///#define USE_SEPDISTANCE_UTIL2 1
///ConvexConvexAlgorithm collision algorithm implements time of impact, con ///The convexConvexAlgorithm collision algorithm implements time of impact,
vex closest points and penetration depth calculations. convex closest points and penetration depth calculations between two conve
x objects.
///Multiple contact points are calculated by perturbing the orientation of
the smallest object orthogonal to the separating normal.
///This idea was described by Gino van den Bergen in this forum topic http:
//www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=4&t=288&p=888#p888
class btConvexConvexAlgorithm : public btActivatingCollisionAlgorithm class btConvexConvexAlgorithm : public btActivatingCollisionAlgorithm
{ {
#ifdef USE_SEPDISTANCE_UTIL2 #ifdef USE_SEPDISTANCE_UTIL2
btConvexSeparatingDistanceUtil m_sepDistance; btConvexSeparatingDistanceUtil m_sepDistance;
#endif #endif
btSimplexSolverInterface* m_simplexSolver; btSimplexSolverInterface* m_simplexSolver;
btConvexPenetrationDepthSolver* m_pdSolver; btConvexPenetrationDepthSolver* m_pdSolver;
bool m_ownManifold; bool m_ownManifold;
btPersistentManifold* m_manifoldPtr; btPersistentManifold* m_manifoldPtr;
bool m_lowLevelOfDetail; bool m_lowLevelOfDetail;
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
///cache separating vector to speedup collision detection ///cache separating vector to speedup collision detection
public: public:
btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAl gorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* bod y1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver * pdSolver); btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAl gorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* bod y1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver * pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThr eshold);
virtual ~btConvexConvexAlgorithm(); virtual ~btConvexConvexAlgorithm();
virtual void processCollision (btCollisionObject* body0,btCollisionO bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO ut); virtual void processCollision (btCollisionObject* body0,btCollisionO bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO ut);
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCo llisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut); virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCo llisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
virtual void getAllContactManifolds(btManifoldArray& manifoldArra y) virtual void getAllContactManifolds(btManifoldArray& manifoldArra y)
{ {
///should we use m_ownManifold to avoid adding duplicates? ///should we use m_ownManifold to avoid adding duplicates?
skipping to change at line 77 skipping to change at line 82
void setLowLevelOfDetail(bool useLowLevel); void setLowLevelOfDetail(bool useLowLevel);
const btPersistentManifold* getManifold() const btPersistentManifold* getManifold()
{ {
return m_manifoldPtr; return m_manifoldPtr;
} }
struct CreateFunc :public btCollisionAlgorithmCreateFunc struct CreateFunc :public btCollisionAlgorithmCreateFunc
{ {
btConvexPenetrationDepthSolver* m_pdSolver; btConvexPenetrationDepthSolver* m_pdSolver;
btSimplexSolverInterface* m_simplexSol ver; btSimplexSolverInterface* m_simplexSol ver;
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
CreateFunc(btSimplexSolverInterface* simp lexSolver, btConvexPenetrationDepthSolver* pdSolver); CreateFunc(btSimplexSolverInterface* simp lexSolver, btConvexPenetrationDepthSolver* pdSolver);
virtual ~CreateFunc(); virtual ~CreateFunc();
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb ject* body1) virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb ject* body1)
{ {
void* mem = ci.m_dispatcher1->allocateCollisionAlgor ithm(sizeof(btConvexConvexAlgorithm)); void* mem = ci.m_dispatcher1->allocateCollisionAlgor ithm(sizeof(btConvexConvexAlgorithm));
return new(mem) btConvexConvexAlgorithm(ci.m_manifol d,ci,body0,body1,m_simplexSolver,m_pdSolver); return new(mem) btConvexConvexAlgorithm(ci.m_manifol d,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_m inimumPointsPerturbationThreshold);
} }
}; };
}; };
#endif //CONVEX_CONVEX_ALGORITHM_H #endif //CONVEX_CONVEX_ALGORITHM_H
 End of changes. 6 change blocks. 
4 lines changed or deleted 15 lines changed or added


 btConvexPlaneCollisionAlgorithm.h   btConvexPlaneCollisionAlgorithm.h 
skipping to change at line 31 skipping to change at line 31
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
class btPersistentManifold; class btPersistentManifold;
#include "btCollisionDispatcher.h" #include "btCollisionDispatcher.h"
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
/// btSphereBoxCollisionAlgorithm provides sphere-box collision detection. /// btSphereBoxCollisionAlgorithm provides sphere-box collision detection.
/// Other features are frame-coherency (persistent data) and collision resp onse. /// Other features are frame-coherency (persistent data) and collision resp onse.
class btConvexPlaneCollisionAlgorithm : public btCollisionAlgorithm class btConvexPlaneCollisionAlgorithm : public btCollisionAlgorithm
{ {
bool m_ownManifold; bool m_ownManifold;
btPersistentManifold* m_manifoldPtr; btPersistentManifold* m_manifoldPtr;
bool m_isSwapped; bool m_isSwapped;
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
public: public:
btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCol lisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObje ct* col1, bool isSwapped); btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCol lisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObje ct* col1, bool isSwapped, int numPerturbationIterations,int minimumPointsPe rturbationThreshold);
virtual ~btConvexPlaneCollisionAlgorithm(); virtual ~btConvexPlaneCollisionAlgorithm();
virtual void processCollision (btCollisionObject* body0,btCollisionO bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO ut); virtual void processCollision (btCollisionObject* body0,btCollisionO bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO ut);
void collideSingleContact (const btQuaternion& perturbeRot, btCollis
ionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchI
nfo,btManifoldResult* resultOut);
virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCo llisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut); virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCo llisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
virtual void getAllContactManifolds(btManifoldArray& manifoldArra y) virtual void getAllContactManifolds(btManifoldArray& manifoldArra y)
{ {
if (m_manifoldPtr && m_ownManifold) if (m_manifoldPtr && m_ownManifold)
{ {
manifoldArray.push_back(m_manifoldPtr); manifoldArray.push_back(m_manifoldPtr);
} }
} }
struct CreateFunc :public btCollisionAlgorithmCreateFunc struct CreateFunc :public btCollisionAlgorithmCreateFunc
{ {
int m_numPerturbationIterations;
int m_minimumPointsPerturbationThreshold;
CreateFunc()
: m_numPerturbationIterations(3),
m_minimumPointsPerturbationThreshold(3)
{
}
virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb ject* body1) virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb ject* body1)
{ {
void* mem = ci.m_dispatcher1->allocateCollisionAlgor ithm(sizeof(btConvexPlaneCollisionAlgorithm)); void* mem = ci.m_dispatcher1->allocateCollisionAlgor ithm(sizeof(btConvexPlaneCollisionAlgorithm));
if (!m_swapped) if (!m_swapped)
{ {
return new(mem) btConvexPlaneCollisionAlgori thm(0,ci,body0,body1,false); return new(mem) btConvexPlaneCollisionAlgori thm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPertu rbationThreshold);
} else } else
{ {
return new(mem) btConvexPlaneCollisionAlgori thm(0,ci,body0,body1,true); return new(mem) btConvexPlaneCollisionAlgori thm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPertur bationThreshold);
} }
} }
}; };
}; };
#endif //CONVEX_PLANE_COLLISION_ALGORITHM_H #endif //CONVEX_PLANE_COLLISION_ALGORITHM_H
 End of changes. 7 change blocks. 
5 lines changed or deleted 20 lines changed or added


 btCudaBroadphase.h   btCudaBroadphase.h 
skipping to change at line 23 skipping to change at line 23
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 CUDA_BROADPHASE_H #ifndef CUDA_BROADPHASE_H
#define CUDA_BROADPHASE_H #define CUDA_BROADPHASE_H
#include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h" #include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h"
#include "btCudaBroadphaseKernel.h" #include "btCudaBroadphaseKernel.h"
///The btCudaBroadphase uses CUDA to compute overlapping pairs using a GPU. ///The bt3DGridBroadphase uses CUDA to compute overlapping pairs using a GP
class btCudaBroadphase : public btSimpleBroadphase U.
class bt3DGridBroadphase : public btSimpleBroadphase
{ {
protected:
bool m_bInitialized; bool m_bInitialized;
unsigned int m_numBodies; unsigned int m_numBodies;
unsigned int m_numCells; unsigned int m_numCells;
unsigned int m_maxPairsPerBody; unsigned int m_maxPairsPerBody;
btScalar m_cellFactorAABB; btScalar m_cellFactorAABB;
unsigned int m_maxBodiesPerCell;
btCudaBroadphaseParams m_params;
btScalar m_maxRadius;
// CPU data // CPU data
unsigned int* m_hBodiesHash; unsigned int* m_hBodiesHash;
unsigned int* m_hCellStart; unsigned int* m_hCellStart;
unsigned int* m_hPairBuffStartCurr; unsigned int* m_hPairBuffStartCurr;
btCuda3F1U* m_hAABB; btCuda3F1U* m_hAABB;
unsigned int* m_hPairBuff; unsigned int* m_hPairBuff;
unsigned int* m_hPairScan; unsigned int* m_hPairScan;
unsigned int* m_hPairOut; unsigned int* m_hPairOut;
// GPU data
unsigned int* m_dBodiesHash[2];
unsigned int* m_dCellStart;
unsigned int* m_dPairBuff;
unsigned int* m_dPairBuffStartCurr;
btCuda3F1U* m_dAABB;
unsigned int* m_dPairScan;
unsigned int* m_dPairOut;
unsigned int m_maxBodiesPerCell;
btCudaBroadphaseParams m_params;
btScalar m_maxRadius;
// large proxies // large proxies
int m_numLargeHandles; int m_numLargeHandles;
int m_maxLargeHandles; int m_maxLargeHandles;
int m_LastLargeHandleIndex; int m_LastLargeHandleIndex;
btSimpleBroadphaseProxy* m_pLargeHandles; btSimpleBroadphaseProxy* m_pLargeHandles;
void* m_pLargeHandlesRawPtr; void* m_pLargeHandlesRawPtr;
int m_firstFreeLargeHandle; int m_firstFreeLargeHandle;
int allocLargeHandle() int allocLargeHandle()
{ {
btAssert(m_numLargeHandles < m_maxLargeHandles); btAssert(m_numLargeHandles < m_maxLargeHandles);
skipping to change at line 84 skipping to change at line 77
{ {
m_LastLargeHandleIndex--; m_LastLargeHandleIndex--;
} }
proxy->SetNextFree(m_firstFreeLargeHandle); proxy->SetNextFree(m_firstFreeLargeHandle);
m_firstFreeLargeHandle = handle; m_firstFreeLargeHandle = handle;
proxy->m_clientObject = 0; proxy->m_clientObject = 0;
m_numLargeHandles--; m_numLargeHandles--;
} }
bool isLargeProxy(const btVector3& aabbMin, const btVector3& aabbMa x); bool isLargeProxy(const btVector3& aabbMin, const btVector3& aabbMa x);
bool isLargeProxy(btBroadphaseProxy* proxy); bool isLargeProxy(btBroadphaseProxy* proxy);
// debug // debug
unsigned int m_numPairsAdded; unsigned int m_numPairsAdded;
unsigned int m_numPairsRemoved; unsigned int m_numPairsRemoved;
unsigned int m_numOverflows; unsigned int m_numOverflows;
// //
public: public:
btCudaBroadphase(const btVector3& worldAabbMin,const btVector3& worl bt3DGridBroadphase(const btVector3& worldAabbMin,const btVector3& wo
dAabbMax, rldAabbMax,
int gridS int gridSizeX, int gridSizeY, int
izeX, int gridSizeY, int gridSizeZ, gridSizeZ,
int maxSm int maxSmallProxies, int maxLarge
allProxies, int maxLargeProxies, int maxPairsPerBody, Proxies, int maxPairsPerBody,
int maxBo int maxBodiesPerCell = 8,
diesPerCell = 8, btScalar cellFactorAABB = btScala
btScalar r(1.0f));
cellFactorAABB = btScalar(1.0f)); virtual ~bt3DGridBroadphase();
virtual ~btCudaBroadphase();
virtual void calculateOverlappingPairs(btDispatcher* dispatcher); virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
virtual btBroadphaseProxy* createProxy(const btVector3& aabbMin , const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisio nFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy); virtual btBroadphaseProxy* createProxy(const btVector3& aabbMin , const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisio nFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void rayTest(const btVector3& rayFrom,const btVector3& ra yTo, btBroadphaseRayCallback& rayCallback); virtual void rayTest(const btVector3& rayFrom,const btVector3& ra yTo, btBroadphaseRayCallback& rayCallback);
protected: protected:
void _initialize(); void _initialize();
void _finalize(); void _finalize();
void scanOverlappingPairBuffCPU(); void addPairsToCache(btDispatcher* dispatcher);
void addPairsToCacheCPU(btDispatcher* dispatcher);
void addLarge2LargePairsToCache(btDispatcher* dispatcher); void addLarge2LargePairsToCache(btDispatcher* dispatcher);
// overrides for CPU version
virtual void setParameters(btCudaBroadphaseParams* hostParams);
virtual void prepareAABB();
virtual void calcHashAABB();
virtual void sortHash();
virtual void findCellStart();
virtual void findOverlappingPairs();
virtual void findPairsLarge();
virtual void computePairCacheChanges();
virtual void scanOverlappingPairBuff();
virtual void squeezeOverlappingPairBuff();
};
///The btCudaBroadphase uses CUDA to compute overlapping pairs using a GPU.
class btCudaBroadphase : public bt3DGridBroadphase
{
protected:
// GPU data
unsigned int* m_dBodiesHash[2];
unsigned int* m_dCellStart;
unsigned int* m_dPairBuff;
unsigned int* m_dPairBuffStartCurr;
btCuda3F1U* m_dAABB;
unsigned int* m_dPairScan;
unsigned int* m_dPairOut;
public:
btCudaBroadphase(const btVector3& worldAabbMin,const btVector3& worl
dAabbMax,
int gridS
izeX, int gridSizeY, int gridSizeZ,
int maxSm
allProxies, int maxLargeProxies, int maxPairsPerBody,
int maxBo
diesPerCell = 8,
btScalar
cellFactorAABB = btScalar(1.0f));
virtual ~btCudaBroadphase();
protected:
void _initialize();
void _finalize();
void allocateArray(void** devPtr, unsigned int size);
void freeArray(void* devPtr);
// overrides for CUDA version
virtual void setParameters(btCudaBroadphaseParams* hostParams);
virtual void prepareAABB();
virtual void calcHashAABB();
virtual void sortHash();
virtual void findCellStart();
virtual void findOverlappingPairs();
virtual void findPairsLarge();
virtual void computePairCacheChanges();
virtual void scanOverlappingPairBuff();
virtual void squeezeOverlappingPairBuff();
}; };
#endif //CUDA_BROADPHASE_H #endif //CUDA_BROADPHASE_H
 End of changes. 9 change blocks. 
28 lines changed or deleted 72 lines changed or added


 btCudaBroadphaseKernel.h   btCudaBroadphaseKernel.h 
skipping to change at line 56 skipping to change at line 56
struct btCuda3F1U struct btCuda3F1U
{ {
float fx; float fx;
float fy; float fy;
float fz; float fz;
unsigned int uw; unsigned int uw;
}; };
extern "C" extern "C"
{ {
// CPU functions
void bt3DGrid_setParameters(btCudaBroadphaseParams* hostParams);
void bt3DGrid_calcHashAABB(btCuda3F1U* pAABB, unsigned int* hash,
unsigned int numBodies);
void bt3DGrid_findCellStart(unsigned int* hash, unsigned int* cellSt
art, unsigned int numBodies, unsigned int numCells);
void bt3DGrid_findOverlappingPairs( btCuda3F1U* pAABB, unsig
ned int* pHash,
unsigned int* pCellStart,
unsigned int* pPairBuff,
unsigned int* pPairBuffStartCurr,
unsigned int numBodies);
void bt3DGrid_findPairsLarge( btCuda3F1U* pAABB, unsigned int*
pHash,
unsi
gned int* pCellStart,
unsi
gned int* pPairBuff,
unsi
gned int* pPairBuffStartCurr,
unsi
gned int numBodies,
unsi
gned int numLarge);
void bt3DGrid_computePairCacheChanges( unsigned int* pPairBuff, uns
igned int* pPairBuffStartCurr,
unsigned int* pPairScan, btCuda3F1U* pAABB, unsigned int numBod
ies);
void bt3DGrid_squeezeOverlappingPairBuff( unsigned int* pPairB
uff, unsigned int* pPairBuffStartCurr, unsigned int* pPairScan,
unsigned int* pPairOut, btCuda3F1U* pAABB, unsigned int
numBodies);
// CUDA functions
void btCuda_allocateArray(void** devPtr, unsigned int size); void btCuda_allocateArray(void** devPtr, unsigned int size);
void btCuda_freeArray(void* devPtr); void btCuda_freeArray(void* devPtr);
void btCuda_copyArrayFromDevice(void* host, const void* device, unsi gned int size); void btCuda_copyArrayFromDevice(void* host, const void* device, unsi gned int size);
void btCuda_copyArrayToDevice(void* device, const void* host, unsign ed int size); void btCuda_copyArrayToDevice(void* device, const void* host, unsign ed int size);
void btCuda_setParameters(btCudaBroadphaseParams* hostParams); void btCuda_setParameters(btCudaBroadphaseParams* hostParams);
void btCuda_calcHashAABB(btCuda3F1U* pAABB, unsigned int* hash, unsi gned int numBodies); void btCuda_calcHashAABB(btCuda3F1U* pAABB, unsigned int* hash, unsi gned int numBodies);
void btCuda_findCellStart(unsigned int* hash, unsigned int* cellStar t, unsigned int numBodies, unsigned int numCells); void btCuda_findCellStart(unsigned int* hash, unsigned int* cellStar t, unsigned int numBodies, unsigned int numCells);
void btCuda_findOverlappingPairs( btCuda3F1U* pAABB, unsig ned int* pHash, void btCuda_findOverlappingPairs( btCuda3F1U* pAABB, unsig ned int* pHash,
unsigned int* pCellStart, unsigned int* pCellStart,
unsigned int* pPairBuff, unsigned int* pPairBuff,
 End of changes. 2 change blocks. 
0 lines changed or deleted 40 lines changed or added


 btDbvt.h   btDbvt.h 
skipping to change at line 59 skipping to change at line 59
// Enable benchmarking code // Enable benchmarking code
#define DBVT_ENABLE_BENCHMARK 0 #define DBVT_ENABLE_BENCHMARK 0
// Inlining // Inlining
#define DBVT_INLINE SIMD_FORCE_INLINE #define DBVT_INLINE SIMD_FORCE_INLINE
// Specific methods implementation // Specific methods implementation
//SSE gives errors on a MSVC 7.1 //SSE gives errors on a MSVC 7.1
#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_US E_DOUBLE_PRECISION)) #ifdef BT_USE_SSE
#define DBVT_SELECT_IMPL DBVT_IMPL_SSE #define DBVT_SELECT_IMPL DBVT_IMPL_SSE
#define DBVT_MERGE_IMPL DBVT_IMPL_SSE #define DBVT_MERGE_IMPL DBVT_IMPL_SSE
#define DBVT_INT0_IMPL DBVT_IMPL_SSE #define DBVT_INT0_IMPL DBVT_IMPL_SSE
#else #else
#define DBVT_SELECT_IMPL DBVT_IMPL_GENERIC #define DBVT_SELECT_IMPL DBVT_IMPL_GENERIC
#define DBVT_MERGE_IMPL DBVT_IMPL_GENERIC #define DBVT_MERGE_IMPL DBVT_IMPL_GENERIC
#define DBVT_INT0_IMPL DBVT_IMPL_GENERIC #define DBVT_INT0_IMPL DBVT_IMPL_GENERIC
#endif #endif
#if (DBVT_SELECT_IMPL==DBVT_IMPL_SSE)|| \ #if (DBVT_SELECT_IMPL==DBVT_IMPL_SSE)|| \
skipping to change at line 84 skipping to change at line 84
// //
// Auto config and checks // Auto config and checks
// //
#if DBVT_USE_TEMPLATE #if DBVT_USE_TEMPLATE
#define DBVT_VIRTUAL #define DBVT_VIRTUAL
#define DBVT_VIRTUAL_DTOR(a) #define DBVT_VIRTUAL_DTOR(a)
#define DBVT_PREFIX template <typename T > #define DBVT_PREFIX template <typename T >
#define DBVT_IPOLICY T& policy #define DBVT_IPOLICY T& policy
#define DBVT_CHECKTYPE static const ICollide& type checker=*(T*)0; #define DBVT_CHECKTYPE static const ICollide& type checker=*(T*)1;(void)typechecker;
#else #else
#define DBVT_VIRTUAL_DTOR(a) virtual ~a() {} #define DBVT_VIRTUAL_DTOR(a) virtual ~a() {}
#define DBVT_VIRTUAL virtual #define DBVT_VIRTUAL virtual
#define DBVT_PREFIX #define DBVT_PREFIX
#define DBVT_IPOLICY ICollide& policy #define DBVT_IPOLICY ICollide& policy
#define DBVT_CHECKTYPE #define DBVT_CHECKTYPE
#endif #endif
#if DBVT_USE_MEMMOVE #if DBVT_USE_MEMMOVE
#ifndef __CELLOS_LV2__ #ifndef __CELLOS_LV2__
skipping to change at line 148 skipping to change at line 148
static inline btDbvtAabbMm FromMM(const btVector3& mi,c onst btVector3& mx); static inline btDbvtAabbMm FromMM(const btVector3& mi,c onst btVector3& mx);
static inline btDbvtAabbMm FromPoints(const btVector3* pts,int n); static inline btDbvtAabbMm FromPoints(const btVector3* pts,int n);
static inline btDbvtAabbMm FromPoints(const btVector3** ppts,int n); static inline btDbvtAabbMm FromPoints(const btVector3** ppts,int n);
DBVT_INLINE void Expand(const btVecto r3& e); DBVT_INLINE void Expand(const btVecto r3& e);
DBVT_INLINE void SignedExpand(const b tVector3& e); DBVT_INLINE void SignedExpand(const b tVector3& e);
DBVT_INLINE bool Contain(const btDbvt AabbMm& a) const; DBVT_INLINE bool Contain(const btDbvt AabbMm& a) const;
DBVT_INLINE int Classify(const btVec tor3& n,btScalar o,int s) const; DBVT_INLINE int Classify(const btVec tor3& n,btScalar o,int s) const;
DBVT_INLINE btScalar ProjectMinimum(const btVecto r3& v,unsigned signs) const; DBVT_INLINE btScalar ProjectMinimum(const btVecto r3& v,unsigned signs) const;
DBVT_INLINE friend bool Intersect( const btDbvt AabbMm& a, DBVT_INLINE friend bool Intersect( const btDbvt AabbMm& a,
const btDbvtAabbMm& b); const btDbvtAabbMm& b);
DBVT_INLINE friend bool Intersect( const btDbvt
AabbMm& a,
const btDbvtAabbMm& b,
const btTransform& xform);
DBVT_INLINE friend bool Intersect( const btDbvt AabbMm& a, DBVT_INLINE friend bool Intersect( const btDbvt AabbMm& a,
const btVector3& b); const btVector3& b);
DBVT_INLINE friend btScalar Proximity( const btDbvt AabbMm& a, DBVT_INLINE friend btScalar Proximity( const btDbvt AabbMm& a,
const btDbvtAabbMm& b); const btDbvtAabbMm& b);
DBVT_INLINE friend int Select( const btDbvt AabbMm& o, DBVT_INLINE friend int Select( const btDbvt AabbMm& o,
const btDbvtAabbMm& a, const btDbvtAabbMm& a,
const btDbvtAabbMm& b); const btDbvtAabbMm& b);
DBVT_INLINE friend void Merge( const btDbvt AabbMm& a, DBVT_INLINE friend void Merge( const btDbvt AabbMm& a,
const btDbvtAabbMm& b, const btDbvtAabbMm& b,
skipping to change at line 304 skipping to change at line 302
DBVT_IPOLICY); DBVT_IPOLICY);
DBVT_PREFIX DBVT_PREFIX
void collideTT( const btDbvtNode* root0, void collideTT( const btDbvtNode* root0,
const btDbvtNode* root1, const btDbvtNode* root1,
DBVT_IPOLICY); DBVT_IPOLICY);
DBVT_PREFIX DBVT_PREFIX
void collideTTpersistentStack( const btDbvt Node* root0, void collideTTpersistentStack( const btDbvt Node* root0,
const btDbvtNode* root1, const btDbvtNode* root1,
DBVT_IPOLICY); DBVT_IPOLICY);
#if 0
DBVT_PREFIX DBVT_PREFIX
void collideTT( const btDbvtNode* root0, void collideTT( const btDbvtNode* root0,
const btDbvtNode* root1, const btDbvtNode* root1,
const btTransform& xform, const btTransform& xform,
DBVT_IPOLICY); DBVT_IPOLICY);
DBVT_PREFIX DBVT_PREFIX
void collideTT( const btDbvtNode* root0, void collideTT( const btDbvtNode* root0,
const btTransform& xform0, const btTransform& xform0,
const btDbvtNode* root1, const btDbvtNode* root1,
const btTransform& xform1, const btTransform& xform1,
DBVT_IPOLICY); DBVT_IPOLICY);
#endif
DBVT_PREFIX DBVT_PREFIX
void collideTV( const btDbvtNode* root, void collideTV( const btDbvtNode* root,
const btDbvtVolume& volume, const btDbvtVolume& volume,
DBVT_IPOLICY); DBVT_IPOLICY);
///rayTest is a re-entrant ray test, and can be called in parallel a s long as the btAlignedAlloc is thread-safe (uses locking etc) ///rayTest is a re-entrant ray test, and can be called in parallel a s long as the btAlignedAlloc is thread-safe (uses locking etc)
///rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInver ses each time ///rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInver ses each time
DBVT_PREFIX DBVT_PREFIX
static void rayTest( const btDbvtNode* ro ot, static void rayTest( const btDbvtNode* ro ot,
const btVector3& rayFrom, const btVector3& rayFrom,
const btVector3& rayTo, const btVector3& rayTo,
skipping to change at line 532 skipping to change at line 532
(a.mx.x()>=b.mi.x())&& (a.mx.x()>=b.mi.x())&&
(a.mi.y()<=b.mx.y())&& (a.mi.y()<=b.mx.y())&&
(a.mx.y()>=b.mi.y())&& (a.mx.y()>=b.mi.y())&&
(a.mi.z()<=b.mx.z())&& (a.mi.z()<=b.mx.z())&&
(a.mx.z()>=b.mi.z())); (a.mx.z()>=b.mi.z()));
#endif #endif
} }
// //
DBVT_INLINE bool Intersect( const btDbvtAabbMm& a, DBVT_INLINE bool Intersect( const btDbvtAabbMm& a,
const btDb
vtAabbMm& b,
const btTr
ansform& xform)
{
const btVector3 d0=xform*b.Center()-a.Center();
const btVector3 d1=d0*xform.getBasis();
btScalar s0[2]={0,0};
btScalar s1[2]={dot(xform.getOrigin(),d0),s1[
0]};
a.AddSpan(d0,s0[0],s0[1]);
b.AddSpan(d1,s1[0],s1[1]);
if(s0[0]>(s1[1])) return(false);
if(s0[1]<(s1[0])) return(false);
return(true);
}
//
DBVT_INLINE bool Intersect( const btDbvtAabbMm& a,
const btVe ctor3& b) const btVe ctor3& b)
{ {
return( (b.x()>=a.mi.x())&& return( (b.x()>=a.mi.x())&&
(b.y()>=a.mi.y())&& (b.y()>=a.mi.y())&&
(b.z()>=a.mi.z())&& (b.z()>=a.mi.z())&&
(b.x()<=a.mx.x())&& (b.x()<=a.mx.x())&&
(b.y()<=a.mx.y())&& (b.y()<=a.mx.y())&&
(b.z()<=a.mx.z())); (b.z()<=a.mx.z()));
} }
skipping to change at line 839 skipping to change at line 823
else else
{ {
policy.Process(p.a,p .b); policy.Process(p.a,p .b);
} }
} }
} }
} while(depth); } while(depth);
} }
} }
#if 0
// //
DBVT_PREFIX DBVT_PREFIX
inline void btDbvt::collideTT( const btDbvtNode* root0, inline void btDbvt::collideTT( const btDbvtNode* root0,
const btDb vtNode* root1, const btDb vtNode* root1,
const btTr ansform& xform, const btTr ansform& xform,
DBVT_IPOLI CY) DBVT_IPOLI CY)
{ {
DBVT_CHECKTYPE DBVT_CHECKTYPE
if(root0&&root1) if(root0&&root1)
{ {
skipping to change at line 906 skipping to change at line 890
DBVT_PREFIX DBVT_PREFIX
inline void btDbvt::collideTT( const btDbvtNode* root0, inline void btDbvt::collideTT( const btDbvtNode* root0,
const btTr ansform& xform0, const btTr ansform& xform0,
const btDb vtNode* root1, const btDb vtNode* root1,
const btTr ansform& xform1, const btTr ansform& xform1,
DBVT_IPOLI CY) DBVT_IPOLI CY)
{ {
const btTransform xform=xform0.inverse()*xform1; const btTransform xform=xform0.inverse()*xform1;
collideTT(root0,root1,xform,policy); collideTT(root0,root1,xform,policy);
} }
#endif
// //
DBVT_PREFIX DBVT_PREFIX
inline void btDbvt::collideTV( const btDbvtNode* root, inline void btDbvt::collideTV( const btDbvtNode* root,
const btDb vtVolume& vol, const btDb vtVolume& vol,
DBVT_IPOLI CY) DBVT_IPOLI CY)
{ {
DBVT_CHECKTYPE DBVT_CHECKTYPE
if(root) if(root)
{ {
 End of changes. 8 change blocks. 
26 lines changed or deleted 8 lines changed or added


 btDbvtBroadphase.h   btDbvtBroadphase.h 
skipping to change at line 27 skipping to change at line 27
#define BT_DBVT_BROADPHASE_H #define BT_DBVT_BROADPHASE_H
#include "BulletCollision/BroadphaseCollision/btDbvt.h" #include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" #include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
// //
// Compile time config // Compile time config
// //
#define DBVT_BP_PROFILE 0 #define DBVT_BP_PROFILE 0
#define DBVT_BP_SORTPAIRS 1 //#define DBVT_BP_SORTPAIRS 1
#define DBVT_BP_PREVENTFALSEUPDATE 0 #define DBVT_BP_PREVENTFALSEUPDATE 0
#define DBVT_BP_ACCURATESLEEPING 0 #define DBVT_BP_ACCURATESLEEPING 0
#define DBVT_BP_ENABLE_BENCHMARK 0 #define DBVT_BP_ENABLE_BENCHMARK 0
#define DBVT_BP_MARGIN (btScalar)0.05 #define DBVT_BP_MARGIN (btScalar)0.05
#if DBVT_BP_PROFILE #if DBVT_BP_PROFILE
#define DBVT_BP_PROFILING_RATE 256 #define DBVT_BP_PROFILING_RATE 256
#include "LinearMath/btQuickprof.h" #include "LinearMath/btQuickprof.h"
#endif #endif
skipping to change at line 117 skipping to change at line 117
void setAabb(btBr oadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDi spatcher* dispatcher); void setAabb(btBr oadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDi spatcher* dispatcher);
virtual void rayTest(const btVector3& rayFrom,const btVector3& ra yTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVecto r3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); virtual void rayTest(const btVector3& rayFrom,const btVector3& ra yTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVecto r3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
void calculateOve rlappingPairs(btDispatcher* dispatcher); void calculateOve rlappingPairs(btDispatcher* dispatcher);
btOverlappingPairCache* getOverlappingPairCache(); btOverlappingPairCache* getOverlappingPairCache();
const btOverlappingPairCache* getOverlappingPairCache() const; const btOverlappingPairCache* getOverlappingPairCache() const;
void getBroadphas eAabb(btVector3& aabbMin,btVector3& aabbMax) const; void getBroadphas eAabb(btVector3& aabbMin,btVector3& aabbMax) const;
void printStats() ; void printStats() ;
static void benchmark(bt BroadphaseInterface*); static void benchmark(bt BroadphaseInterface*);
void performDeferredRemoval(btDispatcher* dispatcher);
///reset broadphase internal structures, to ensure determinism/repro
ducability
virtual void resetPool(btDispatcher* dispatcher);
}; };
#endif #endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 8 lines changed or added


 btDefaultCollisionConfiguration.h   btDefaultCollisionConfiguration.h 
skipping to change at line 109 skipping to change at line 109
return m_collisionAlgorithmPool; return m_collisionAlgorithmPool;
} }
virtual btStackAlloc* getStackAllocator() virtual btStackAlloc* getStackAllocator()
{ {
return m_stackAlloc; return m_stackAlloc;
} }
virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateF unc(int proxyType0,int proxyType1); virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateF unc(int proxyType0,int proxyType1);
///Use this method to allow to generate multiple contact points betw
een at once, between two objects using the generic convex-convex algorithm.
///By default, this feature is disabled for best performance.
///@param numPerturbationIterations controls the number of collision
queries. Set it to zero to disable the feature.
///@param minimumPointsPerturbationThreshold is the minimum number o
f points in the contact cache, above which the feature is disabled
///3 is a good value for both params, if you want to enable the feat
ure. This is because the default contact cache contains a maximum of 4 poin
ts, and one collision query at the unperturbed orientation is performed fir
st.
///See Bullet/Demos/CollisionDemo for an example how this feature ga
thers multiple points.
///@todo we could add a per-object setting of those parameters, for
level-of-detail collision detection.
void setConvexConvexMultipointIterations(int numPerturbationItera
tions=3, int minimumPointsPerturbationThreshold = 3);
}; };
#endif //BT_DEFAULT_COLLISION_CONFIGURATION #endif //BT_DEFAULT_COLLISION_CONFIGURATION
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 btDiscreteDynamicsWorld.h   btDiscreteDynamicsWorld.h 
skipping to change at line 26 skipping to change at line 26
#ifndef BT_DISCRETE_DYNAMICS_WORLD_H #ifndef BT_DISCRETE_DYNAMICS_WORLD_H
#define BT_DISCRETE_DYNAMICS_WORLD_H #define BT_DISCRETE_DYNAMICS_WORLD_H
#include "btDynamicsWorld.h" #include "btDynamicsWorld.h"
class btDispatcher; class btDispatcher;
class btOverlappingPairCache; class btOverlappingPairCache;
class btConstraintSolver; class btConstraintSolver;
class btSimulationIslandManager; class btSimulationIslandManager;
class btTypedConstraint; class btTypedConstraint;
class btActionInterface;
class btRaycastVehicle;
class btCharacterControllerInterface;
class btIDebugDraw; class btIDebugDraw;
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
///btDiscreteDynamicsWorld provides discrete rigid body simulation ///btDiscreteDynamicsWorld provides discrete rigid body simulation
///those classes replace the obsolete CcdPhysicsEnvironment/CcdPhysicsContr oller ///those classes replace the obsolete CcdPhysicsEnvironment/CcdPhysicsContr oller
class btDiscreteDynamicsWorld : public btDynamicsWorld class btDiscreteDynamicsWorld : public btDynamicsWorld
{ {
protected: protected:
btConstraintSolver* m_constraintSolver; btConstraintSolver* m_constraintSolver;
skipping to change at line 53 skipping to change at line 52
btVector3 m_gravity; btVector3 m_gravity;
//for variable timesteps //for variable timesteps
btScalar m_localTime; btScalar m_localTime;
//for variable timesteps //for variable timesteps
bool m_ownsIslandManager; bool m_ownsIslandManager;
bool m_ownsConstraintSolver; bool m_ownsConstraintSolver;
btAlignedObjectArray<btRaycastVehicle*> m_vehicles; btAlignedObjectArray<btActionInterface*> m_actions;
btAlignedObjectArray<btCharacterControllerInterface*> m_characters;
int m_profileTimings; int m_profileTimings;
virtual void predictUnconstraintMotion(btScalar timeStep); virtual void predictUnconstraintMotion(btScalar timeStep);
virtual void integrateTransforms(btScalar timeStep); virtual void integrateTransforms(btScalar timeStep);
virtual void calculateSimulationIslands(); virtual void calculateSimulationIslands();
virtual void solveConstraints(btContactSolverInfo& solverInfo); virtual void solveConstraints(btContactSolverInfo& solverInfo);
void updateActivationState(btScalar timeStep); void updateActivationState(btScalar timeStep);
void updateVehicles(btScalar timeStep); void updateActions(btScalar timeStep);
void updateCharacters(btScalar timeStep);
void startProfiling(btScalar timeStep); void startProfiling(btScalar timeStep);
virtual void internalSingleStepSimulation( btScalar timeStep); virtual void internalSingleStepSimulation( btScalar timeStep);
virtual void saveKinematicState(btScalar timeStep); virtual void saveKinematicState(btScalar timeStep);
void debugDrawSphere(btScalar radius, const btTransform& transfor m, const btVector3& color); void debugDrawSphere(btScalar radius, const btTransform& transfor m, const btVector3& color);
public: public:
skipping to change at line 100 skipping to change at line 95
virtual void synchronizeMotionStates(); virtual void synchronizeMotionStates();
///this can be useful to synchronize a single rigid body -> graphics object ///this can be useful to synchronize a single rigid body -> graphics object
void synchronizeSingleMotionState(btRigidBody* body); void synchronizeSingleMotionState(btRigidBody* body);
virtual void addConstraint(btTypedConstraint* constraint, bool di sableCollisionsBetweenLinkedBodies=false); virtual void addConstraint(btTypedConstraint* constraint, bool di sableCollisionsBetweenLinkedBodies=false);
virtual void removeConstraint(btTypedConstraint* constraint); virtual void removeConstraint(btTypedConstraint* constraint);
virtual void addVehicle(btRaycastVehicle* vehicle); virtual void addAction(btActionInterface*);
virtual void removeVehicle(btRaycastVehicle* vehicle);
virtual void addCharacter(btCharacterControllerInterface* charact
er);
virtual void removeCharacter(btCharacterControllerInterface* char acter); virtual void removeAction(btActionInterface*);
btSimulationIslandManager* getSimulationIslandManager() btSimulationIslandManager* getSimulationIslandManager()
{ {
return m_islandManager; return m_islandManager;
} }
const btSimulationIslandManager* getSimulationIslandManager() const const btSimulationIslandManager* getSimulationIslandManager() const
{ {
return m_islandManager; return m_islandManager;
} }
skipping to change at line 134 skipping to change at line 126
virtual btVector3 getGravity () const; virtual btVector3 getGravity () const;
virtual void addRigidBody(btRigidBody* body); virtual void addRigidBody(btRigidBody* body);
virtual void addRigidBody(btRigidBody* body, short group, short m ask); virtual void addRigidBody(btRigidBody* body, short group, short m ask);
virtual void removeRigidBody(btRigidBody* body); virtual void removeRigidBody(btRigidBody* body);
void debugDrawObject(const btTransform& worldTransform, const btC ollisionShape* shape, const btVector3& color); void debugDrawObject(const btTransform& worldTransform, const btC ollisionShape* shape, const btVector3& color);
void debugDrawConstraint(btTypedConstraint* constraint);
virtual void debugDrawWorld(); virtual void debugDrawWorld();
virtual void setConstraintSolver(btConstraintSolver* solver); virtual void setConstraintSolver(btConstraintSolver* solver);
virtual btConstraintSolver* getConstraintSolver(); virtual btConstraintSolver* getConstraintSolver();
virtual int getNumConstraints() const; virtual int getNumConstraints() const;
virtual btTypedConstraint* getConstraint(int index) ; virtual btTypedConstraint* getConstraint(int index) ;
skipping to change at line 162 skipping to change at line 156
virtual void clearForces(); virtual void clearForces();
///apply gravity, call this once per timestep ///apply gravity, call this once per timestep
virtual void applyGravity(); virtual void applyGravity();
virtual void setNumTasks(int numTasks) virtual void setNumTasks(int numTasks)
{ {
(void) numTasks; (void) numTasks;
} }
///obsolete, use updateActions instead
virtual void updateVehicles(btScalar timeStep)
{
updateActions(timeStep);
}
///obsolete, use addAction instead
virtual void addVehicle(btActionInterface* vehicle);
///obsolete, use removeAction instead
virtual void removeVehicle(btActionInterface* vehicle);
///obsolete, use addAction instead
virtual void addCharacter(btActionInterface* character);
///obsolete, use removeAction instead
virtual void removeCharacter(btActionInterface* character);
}; };
#endif //BT_DISCRETE_DYNAMICS_WORLD_H #endif //BT_DISCRETE_DYNAMICS_WORLD_H
 End of changes. 8 change blocks. 
15 lines changed or deleted 22 lines changed or added


 btDynamicsWorld.h   btDynamicsWorld.h 
skipping to change at line 23 skipping to change at line 23
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 BT_DYNAMICS_WORLD_H #ifndef BT_DYNAMICS_WORLD_H
#define BT_DYNAMICS_WORLD_H #define BT_DYNAMICS_WORLD_H
#include "BulletCollision/CollisionDispatch/btCollisionWorld.h" #include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
#include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h" #include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h"
class btTypedConstraint; class btTypedConstraint;
class btRaycastVehicle; class btActionInterface;
class btConstraintSolver; class btConstraintSolver;
class btDynamicsWorld; class btDynamicsWorld;
class btCharacterControllerInterface;
/// Type for the callback for each tick /// Type for the callback for each tick
typedef void (*btInternalTickCallback)(btDynamicsWorld *world, btScalar tim eStep); typedef void (*btInternalTickCallback)(btDynamicsWorld *world, btScalar tim eStep);
enum btDynamicsWorldType enum btDynamicsWorldType
{ {
BT_SIMPLE_DYNAMICS_WORLD=1, BT_SIMPLE_DYNAMICS_WORLD=1,
BT_DISCRETE_DYNAMICS_WORLD=2, BT_DISCRETE_DYNAMICS_WORLD=2,
BT_CONTINUOUS_DYNAMICS_WORLD=3 BT_CONTINUOUS_DYNAMICS_WORLD=3
}; };
skipping to change at line 74 skipping to change at line 73
virtual void debugDrawWorld() = 0; virtual void debugDrawWorld() = 0;
virtual void addConstraint(btTypedConstraint* constraint, bool disableCollisionsBetweenLinkedBodies=false) virtual void addConstraint(btTypedConstraint* constraint, bool disableCollisionsBetweenLinkedBodies=false)
{ {
(void)constraint; (void)disableCollisionsBetweenLink edBodies; (void)constraint; (void)disableCollisionsBetweenLink edBodies;
} }
virtual void removeConstraint(btTypedConstraint* constrai nt) {(void)constraint;} virtual void removeConstraint(btTypedConstraint* constrai nt) {(void)constraint;}
virtual void addVehicle(btRaycastVehicle* vehicle) {(void virtual void addAction(btActionInterface* action) = 0;
)vehicle;}
virtual void removeVehicle(btRaycastVehicle* vehicle) {(v
oid)vehicle;}
virtual void addCharacter(btCharacterControllerInterface*
character) {(void)character;}
virtual void removeCharacter(btCharacterControllerInterfa ce* character) {(void)character;} virtual void removeAction(btActionInterface* action) = 0;
//once a rigidbody is added to the dynamics world, it will g et this gravity assigned //once a rigidbody is added to the dynamics world, it will g et this gravity assigned
//existing rigidbodies in the world get gravity assigned too , during this method //existing rigidbodies in the world get gravity assigned too , during this method
virtual void setGravity(const btVector3& gravity) = 0; virtual void setGravity(const btVector3& gravity) = 0;
virtual btVector3 getGravity () const = 0; virtual btVector3 getGravity () const = 0;
virtual void synchronizeMotionStates() = 0; virtual void synchronizeMotionStates() = 0;
virtual void addRigidBody(btRigidBody* body) = 0; virtual void addRigidBody(btRigidBody* body) = 0;
skipping to change at line 129 skipping to change at line 124
void* getWorldUserInfo() const void* getWorldUserInfo() const
{ {
return m_worldUserInfo; return m_worldUserInfo;
} }
btContactSolverInfo& getSolverInfo() btContactSolverInfo& getSolverInfo()
{ {
return m_solverInfo; return m_solverInfo;
} }
///obsolete, use addAction instead.
virtual void addVehicle(btActionInterface* vehicle) {(voi
d)vehicle;}
///obsolete, use removeAction instead
virtual void removeVehicle(btActionInterface* vehicle) {(
void)vehicle;}
///obsolete, use addAction instead.
virtual void addCharacter(btActionInterface* character) {
(void)character;}
///obsolete, use removeAction instead
virtual void removeCharacter(btActionInterface* character
) {(void)character;}
}; };
#endif //BT_DYNAMICS_WORLD_H #endif //BT_DYNAMICS_WORLD_H
 End of changes. 5 change blocks. 
11 lines changed or deleted 16 lines changed or added


 btGImpactShape.h   btGImpactShape.h 
skipping to change at line 836 skipping to change at line 836
//! This class manages a mesh supplied by the btStridingMeshInterface inter face. //! This class manages a mesh supplied by the btStridingMeshInterface inter face.
/*! /*!
Set of btGImpactMeshShapePart parts Set of btGImpactMeshShapePart parts
- Simply create this shape by passing the btStridingMeshInterface to the co nstructor btGImpactMeshShape, then you must call updateBound() after creati ng the mesh - Simply create this shape by passing the btStridingMeshInterface to the co nstructor btGImpactMeshShape, then you must call updateBound() after creati ng the mesh
- You can handle deformable meshes with this shape, by calling postUpdate() every time when changing the mesh vertices. - You can handle deformable meshes with this shape, by calling postUpdate() every time when changing the mesh vertices.
*/ */
class btGImpactMeshShape : public btGImpactShapeInterface class btGImpactMeshShape : public btGImpactShapeInterface
{ {
btStridingMeshInterface* m_meshInterface;
protected: protected:
btAlignedObjectArray<btGImpactMeshShapePart*> m_mesh_parts; btAlignedObjectArray<btGImpactMeshShapePart*> m_mesh_parts;
void buildMeshParts(btStridingMeshInterface * meshInterface) void buildMeshParts(btStridingMeshInterface * meshInterface)
{ {
for (int i=0;i<meshInterface->getNumSubParts() ;++i ) for (int i=0;i<meshInterface->getNumSubParts() ;++i )
{ {
btGImpactMeshShapePart * newpart = new btGImpactMesh ShapePart(meshInterface,i); btGImpactMeshShapePart * newpart = new btGImpactMesh ShapePart(meshInterface,i);
m_mesh_parts.push_back(newpart); m_mesh_parts.push_back(newpart);
} }
} }
skipping to change at line 862 skipping to change at line 864
while(i--) while(i--)
{ {
m_mesh_parts[i]->updateBound(); m_mesh_parts[i]->updateBound();
m_localAABB.merge(m_mesh_parts[i]->getLocalBox()); m_localAABB.merge(m_mesh_parts[i]->getLocalBox());
} }
} }
public: public:
btGImpactMeshShape(btStridingMeshInterface * meshInterface) btGImpactMeshShape(btStridingMeshInterface * meshInterface)
{ {
m_meshInterface = meshInterface;
buildMeshParts(meshInterface); buildMeshParts(meshInterface);
} }
virtual ~btGImpactMeshShape() virtual ~btGImpactMeshShape()
{ {
int i = m_mesh_parts.size(); int i = m_mesh_parts.size();
while(i--) while(i--)
{ {
btGImpactMeshShapePart * part = m_mesh_parts[i]; btGImpactMeshShapePart * part = m_mesh_parts[i];
delete part; delete part;
} }
m_mesh_parts.clear(); m_mesh_parts.clear();
} }
btStridingMeshInterface* getMeshInterface()
{
return m_meshInterface;
}
const btStridingMeshInterface* getMeshInterface() const
{
return m_meshInterface;
}
int getMeshPartCount() const int getMeshPartCount() const
{ {
return m_mesh_parts.size(); return m_mesh_parts.size();
} }
btGImpactMeshShapePart * getMeshPart(int index) btGImpactMeshShapePart * getMeshPart(int index)
{ {
return m_mesh_parts[index]; return m_mesh_parts[index];
} }
skipping to change at line 980 skipping to change at line 993
{ {
btAssert(0); btAssert(0);
} }
virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const
{ {
btAssert(0); btAssert(0);
} }
//! call when reading child shapes //! call when reading child shapes
virtual void lockChildShapes() virtual void lockChildShapes() const
{ {
btAssert(0); btAssert(0);
} }
virtual void unlockChildShapes() virtual void unlockChildShapes() const
{ {
btAssert(0); btAssert(0);
} }
//! Retrieves the bound from a child //! Retrieves the bound from a child
/*! /*!
*/ */
virtual void getChildAabb(int child_index,const btTransform& t,btVector 3& aabbMin,btVector3& aabbMax) const virtual void getChildAabb(int child_index,const btTransform& t,btVector 3& aabbMin,btVector3& aabbMax) const
{ {
btAssert(0); btAssert(0);
 End of changes. 5 change blocks. 
2 lines changed or deleted 15 lines changed or added


 btGeneric6DofConstraint.h   btGeneric6DofConstraint.h 
skipping to change at line 91 skipping to change at line 91
m_ERP = limot.m_ERP; m_ERP = limot.m_ERP;
m_bounce = limot.m_bounce; m_bounce = limot.m_bounce;
m_currentLimit = limot.m_currentLimit; m_currentLimit = limot.m_currentLimit;
m_currentLimitError = limot.m_currentLimitError; m_currentLimitError = limot.m_currentLimitError;
m_enableMotor = limot.m_enableMotor; m_enableMotor = limot.m_enableMotor;
} }
//! Is limited //! Is limited
bool isLimited() bool isLimited()
{ {
if(m_loLimit>=m_hiLimit) return false; if(m_loLimit > m_hiLimit) return false;
return true; return true;
} }
//! Need apply correction //! Need apply correction
bool needApplyTorques() bool needApplyTorques()
{ {
if(m_currentLimit == 0 && m_enableMotor == false) return false; if(m_currentLimit == 0 && m_enableMotor == false) return false;
return true; return true;
} }
//! calculates error //! calculates error
/*! /*!
calculates m_currentLimit and m_currentLimitError. calculates m_currentLimit and m_currentLimitError.
*/ */
int testLimitValue(btScalar test_value); int testLimitValue(btScalar test_value);
//! apply the correction impulses for two bodies //! apply the correction impulses for two bodies
btScalar solveAngularLimits(btScalar timeStep,btVector3& axis, btScalar jacDiagABInv,btRigidBody * body0, btRigidBody * body1); btScalar solveAngularLimits(btScalar timeStep,btVector3& axis, btScalar jacDiagABInv,btRigidBody * body0, btSolverBody& bodyA,btRigidBody * body1, btSolverBody& bodyB);
}; };
class btTranslationalLimitMotor class btTranslationalLimitMotor
{ {
public: public:
btVector3 m_lowerLimit;//!< the constraint lower limits btVector3 m_lowerLimit;//!< the constraint lower limits
btVector3 m_upperLimit;//!< the constraint upper limits btVector3 m_upperLimit;//!< the constraint upper limits
btVector3 m_accumulatedImpulse; btVector3 m_accumulatedImpulse;
//! Linear_Limit_parameters //! Linear_Limit_parameters
//!@{ //!@{
btScalar m_limitSoftness;//!< Softness for linear limit btScalar m_limitSoftness;//!< Softness for linear limit
btScalar m_damping;//!< Damping for linear limit btScalar m_damping;//!< Damping for linear limit
btScalar m_restitution;//! Bounce parameter for linear limit btScalar m_restitution;//! Bounce parameter for linear limit
//!@} //!@}
bool m_enableMotor[3];
btVector3 m_targetVelocity;//!< target motor velocity
btVector3 m_maxMotorForce;//!< max force on motor
btVector3 m_currentLimitError;//! How much is violated this limit
int m_currentLimit[3];//!< 0=free, 1=at lower li
mit, 2=at upper limit
btTranslationalLimitMotor() btTranslationalLimitMotor()
{ {
m_lowerLimit.setValue(0.f,0.f,0.f); m_lowerLimit.setValue(0.f,0.f,0.f);
m_upperLimit.setValue(0.f,0.f,0.f); m_upperLimit.setValue(0.f,0.f,0.f);
m_accumulatedImpulse.setValue(0.f,0.f,0.f); m_accumulatedImpulse.setValue(0.f,0.f,0.f);
m_limitSoftness = 0.7f; m_limitSoftness = 0.7f;
m_damping = btScalar(1.0f); m_damping = btScalar(1.0f);
m_restitution = btScalar(0.5f); m_restitution = btScalar(0.5f);
for(int i=0; i < 3; i++)
{
m_enableMotor[i] = false;
m_targetVelocity[i] = btScalar(0.f);
m_maxMotorForce[i] = btScalar(0.f);
}
} }
btTranslationalLimitMotor(const btTranslationalLimitMotor & other ) btTranslationalLimitMotor(const btTranslationalLimitMotor & other )
{ {
m_lowerLimit = other.m_lowerLimit; m_lowerLimit = other.m_lowerLimit;
m_upperLimit = other.m_upperLimit; m_upperLimit = other.m_upperLimit;
m_accumulatedImpulse = other.m_accumulatedImpulse; m_accumulatedImpulse = other.m_accumulatedImpulse;
m_limitSoftness = other.m_limitSoftness ; m_limitSoftness = other.m_limitSoftness ;
m_damping = other.m_damping; m_damping = other.m_damping;
m_restitution = other.m_restitution; m_restitution = other.m_restitution;
for(int i=0; i < 3; i++)
{
m_enableMotor[i] = other.m_enableMotor[i];
m_targetVelocity[i] = other.m_targetVelocity[i];
m_maxMotorForce[i] = other.m_maxMotorForce[i];
}
} }
//! Test limit //! Test limit
/*! /*!
- free means upper < lower, - free means upper < lower,
- locked means upper == lower - locked means upper == lower
- limited means upper > lower - limited means upper > lower
- limitIndex: first 3 are linear, next 3 are angular - limitIndex: first 3 are linear, next 3 are angular
*/ */
inline bool isLimited(int limitIndex) inline bool isLimited(int limitIndex)
{ {
return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]); return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]);
} }
inline bool needApplyForce(int limitIndex)
{
if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == f
alse) return false;
return true;
}
int testLimitValue(int limitIndex, btScalar test_value);
btScalar solveLinearAxis( btScalar solveLinearAxis(
btScalar timeStep, btScalar timeStep,
btScalar jacDiagABInv, btScalar jacDiagABInv,
btRigidBody& body1,const btVector3 &pointInA, btRigidBody& body1,btSolverBody& bodyA,const btVector3 &pointInA,
btRigidBody& body2,const btVector3 &pointInB, btRigidBody& body2,btSolverBody& bodyB,const btVector3 &pointInB,
int limit_index, int limit_index,
const btVector3 & axis_normal_on_a, const btVector3 & axis_normal_on_a,
const btVector3 & anchorPos); const btVector3 & anchorPos);
}; };
/// btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space /// btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space
/*! /*!
btGeneric6DofConstraint can leave any of the 6 degree of freedom 'free' or 'locked'. btGeneric6DofConstraint can leave any of the 6 degree of freedom 'free' or 'locked'.
currently this limit supports rotational motors<br> currently this limit supports rotational motors<br>
skipping to change at line 239 skipping to change at line 262
//!@} //!@}
protected: protected:
//! temporal variables //! temporal variables
//!@{ //!@{
btScalar m_timeStep; btScalar m_timeStep;
btTransform m_calculatedTransformA; btTransform m_calculatedTransformA;
btTransform m_calculatedTransformB; btTransform m_calculatedTransformB;
btVector3 m_calculatedAxisAngleDiff; btVector3 m_calculatedAxisAngleDiff;
btVector3 m_calculatedAxis[3]; btVector3 m_calculatedAxis[3];
btVector3 m_calculatedLinearDiff;
btVector3 m_AnchorPos; // point betwen pivots of bodies A and B to s olve linear axes btVector3 m_AnchorPos; // point betwen pivots of bodies A and B to s olve linear axes
bool m_useLinearReferenceFrameA; bool m_useLinearReferenceFrameA;
//!@} //!@}
btGeneric6DofConstraint& operator=(btGeneric6DofConstraint& othe r) btGeneric6DofConstraint& operator=(btGeneric6DofConstraint& othe r)
{ {
btAssert(0); btAssert(0);
(void) other; (void) other;
return *this; return *this;
} }
int setAngularLimits(btConstraintInfo2 *info, int row_offset);
int setLinearLimits(btConstraintInfo2 *info);
void buildLinearJacobian( void buildLinearJacobian(
btJacobianEntry & jacLinear,const btVector3 & normalWorld, btJacobianEntry & jacLinear,const btVector3 & normalWorld,
const btVector3 & pivotAInW,const btVector3 & pivotBInW); const btVector3 & pivotAInW,const btVector3 & pivotBInW);
void buildAngularJacobian(btJacobianEntry & jacAngular,const btVector3 & jointAxisW); void buildAngularJacobian(btJacobianEntry & jacAngular,const btVector3 & jointAxisW);
// tests linear limits
void calculateLinearInfo();
//! calcs the euler angles between the two bodies. //! calcs the euler angles between the two bodies.
void calculateAngleInfo(); void calculateAngleInfo();
public: public:
///for backwards compatibility during the transition to 'getInfo/get
Info2'
bool m_useSolveConstraintObsolete;
btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTra nsform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrame A); btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTra nsform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrame A);
btGeneric6DofConstraint(); btGeneric6DofConstraint();
//! Calcs global transform of the offsets //! Calcs global transform of the offsets
/*! /*!
Calcs the global transform for the joint offset for body A an B, and also calcs the agle differences between the bodies. Calcs the global transform for the joint offset for body A an B, and also calcs the agle differences between the bodies.
\sa btGeneric6DofConstraint.getCalculatedTransformA , btGeneric6DofC onstraint.getCalculatedTransformB, btGeneric6DofConstraint.calculateAngleIn fo \sa btGeneric6DofConstraint.getCalculatedTransformA , btGeneric6DofC onstraint.getCalculatedTransformB, btGeneric6DofConstraint.calculateAngleIn fo
*/ */
void calculateTransforms(); void calculateTransforms();
skipping to change at line 315 skipping to change at line 350
} }
btTransform & getFrameOffsetB() btTransform & getFrameOffsetB()
{ {
return m_frameInB; return m_frameInB;
} }
//! performs Jacobian calculation, and also calculates angle differe nces and axis //! performs Jacobian calculation, and also calculates angle differe nces and axis
virtual void buildJacobian(); virtual void buildJacobian();
virtual void solveConstraint(btScalar timeStep); virtual void getInfo1 (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info);
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep);
void updateRHS(btScalar timeStep); void updateRHS(btScalar timeStep);
//! Get the rotation axis in global coordinates //! Get the rotation axis in global coordinates
/*! /*!
\pre btGeneric6DofConstraint.buildJacobian must be called previously . \pre btGeneric6DofConstraint.buildJacobian must be called previously .
*/ */
btVector3 getAxis(int axis_index) const; btVector3 getAxis(int axis_index) const;
//! Get the relative Euler angle //! Get the relative Euler angle
skipping to change at line 417 skipping to change at line 456
{ {
return m_rbA; return m_rbA;
} }
const btRigidBody& getRigidBodyB() const const btRigidBody& getRigidBodyB() const
{ {
return m_rbB; return m_rbB;
} }
virtual void calcAnchorPos(void); // overridable virtual void calcAnchorPos(void); // overridable
int get_limit_motor_info2( btRotationalLimitMotor * limot,
btRigidBody
* body0, btRigidBody * body1,
btConstraint
Info2 *info, int row, btVector3& ax1, int rotational);
}; };
#endif //GENERIC_6DOF_CONSTRAINT_H #endif //GENERIC_6DOF_CONSTRAINT_H
 End of changes. 13 change blocks. 
5 lines changed or deleted 54 lines changed or added


 btHeightfieldTerrainShape.h   btHeightfieldTerrainShape.h 
skipping to change at line 33 skipping to change at line 33
The caller is responsible for maintaining the heightfield array; this The caller is responsible for maintaining the heightfield array; this
class does not make a copy. class does not make a copy.
The heightfield can be dynamic so long as the min/max height values The heightfield can be dynamic so long as the min/max height values
capture the extremes (heights must always be in that range). capture the extremes (heights must always be in that range).
The local origin of the heightfield is assumed to be the exact The local origin of the heightfield is assumed to be the exact
center (as determined by width and length and height, with each center (as determined by width and length and height, with each
axis multiplied by the localScaling). axis multiplied by the localScaling).
\b NOTE: be careful with coordinates. If you have a heightfield with a l
ocal
min height of -100m, and a max height of +500m, you may be tempted to pla
ce it
at the origin (0,0) and expect the heights in world coordinates to be
-100 to +500 meters.
Actually, the heights will be -300 to +300m, because bullet will re-cente
r
the heightfield based on its AABB (which is determined by the min/max
heights). So keep in mind that once you create a btHeightfieldTerrainSha
pe
object, the heights will be adjusted relative to the center of the AABB.
This
is different to the behavior of many rendering engines, but is useful for
physics engines.
Most (but not all) rendering and heightfield libraries assume upAxis = 1 Most (but not all) rendering and heightfield libraries assume upAxis = 1
(that is, the y-axis is "up"). This class allows any of the 3 coordinate s (that is, the y-axis is "up"). This class allows any of the 3 coordinate s
to be "up". Make sure your choice of axis is consistent with your render ing to be "up". Make sure your choice of axis is consistent with your render ing
system. system.
The heightfield heights are determined from the data type used for the The heightfield heights are determined from the data type used for the
heightfieldData array. heightfieldData array.
- PHY_UCHAR: height at a point is the uchar value at the - PHY_UCHAR: height at a point is the uchar value at the
grid point, multipled by heightScale. uchar isn't recommended grid point, multipled by heightScale. uchar isn't recommended
skipping to change at line 91 skipping to change at line 102
}; };
PHY_ScalarType m_heightDataType; PHY_ScalarType m_heightDataType;
bool m_flipQuadEdges; bool m_flipQuadEdges;
bool m_useDiamondSubdivision; bool m_useDiamondSubdivision;
int m_upAxis; int m_upAxis;
btVector3 m_localScaling; btVector3 m_localScaling;
virtual btScalar getHeightFieldValue(int x,int y) const; virtual btScalar getRawHeightFieldValue(int x,int y) const;
void quantizeWithClamp(int* out, const btVector3& point,i nt isMax) const; void quantizeWithClamp(int* out, const btVector3& point,i nt isMax) const;
void getVertex(int x,int y,btVector3& vertex) const; void getVertex(int x,int y,btVector3& vertex) const;
/// protected initialization /// protected initialization
/** /**
Handles the work of constructors so that public constructors can b e Handles the work of constructors so that public constructors can b e
backwards-compatible without a lot of copy/paste. backwards-compatible without a lot of copy/paste.
*/ */
void initialize(int heightStickWidth, int heightStickLength, void initialize(int heightStickWidth, int heightStickLength,
void* heightfieldData, btScalar heightScale, void* heightfieldData, btScalar heightScale,
 End of changes. 2 change blocks. 
1 lines changed or deleted 17 lines changed or added


 btHingeConstraint.h   btHingeConstraint.h 
skipping to change at line 56 skipping to change at line 56
btScalar m_lowerLimit; btScalar m_lowerLimit;
btScalar m_upperLimit; btScalar m_upperLimit;
btScalar m_kHinge; btScalar m_kHinge;
btScalar m_limitSign; btScalar m_limitSign;
btScalar m_correction; btScalar m_correction;
btScalar m_accLimitImpulse; btScalar m_accLimitImpulse;
btScalar m_hingeAngle;
btScalar m_referenceSign;
bool m_angularOnly; bool m_angularOnly;
bool m_enableAngularMotor; bool m_enableAngularMotor;
bool m_solveLimit; bool m_solveLimit;
bool m_useSolveConstraintObsolete;
bool m_useReferenceFrameA;
public: public:
btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3 & pivotInA,const btVector3& pivotInB, btVector3& axisInA,btVector3& axisInB ); btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3 & pivotInA,const btVector3& pivotInB, btVector3& axisInA,btVector3& axisInB , bool useReferenceFrameA = false);
btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVecto r3& axisInA); btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVecto r3& axisInA, bool useReferenceFrameA = false);
btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransfo rm& rbAFrame, const btTransform& rbBFrame); btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransfo rm& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false) ;
btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame); btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA = false);
btHingeConstraint(); btHingeConstraint();
virtual void buildJacobian(); virtual void buildJacobian();
virtual void solveConstraint(btScalar timeStep); virtual void getInfo1 (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info);
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep);
void updateRHS(btScalar timeStep); void updateRHS(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;
} }
btRigidBody& getRigidBodyA()
{
return m_rbA;
}
btRigidBody& getRigidBodyB()
{
return m_rbB;
}
void setAngularOnly(bool angularOnly) void setAngularOnly(bool angularOnly)
{ {
m_angularOnly = angularOnly; m_angularOnly = angularOnly;
} }
void enableAngularMotor(bool enableMotor,btScalar targetVelocity, btScalar maxMotorImpulse) void enableAngularMotor(bool enableMotor,btScalar targetVelocity, btScalar maxMotorImpulse)
{ {
m_enableAngularMotor = enableMotor; m_enableAngularMotor = enableMotor;
m_motorTargetVelocity = targetVelocity; m_motorTargetVelocity = targetVelocity;
m_maxMotorImpulse = maxMotorImpulse; m_maxMotorImpulse = maxMotorImpulse;
skipping to change at line 123 skipping to change at line 141
return m_lowerLimit; return m_lowerLimit;
} }
btScalar getUpperLimit() const btScalar getUpperLimit() const
{ {
return m_upperLimit; return m_upperLimit;
} }
btScalar getHingeAngle(); btScalar getHingeAngle();
void testLimit();
const btTransform& getAFrame() { return m_rbAFrame; }; const btTransform& getAFrame() { return m_rbAFrame; };
const btTransform& getBFrame() { return m_rbBFrame; }; const btTransform& getBFrame() { return m_rbBFrame; };
inline int getSolveLimit() inline int getSolveLimit()
{ {
return m_solveLimit; return m_solveLimit;
} }
inline btScalar getLimitSign() inline btScalar getLimitSign()
{ {
 End of changes. 9 change blocks. 
5 lines changed or deleted 26 lines changed or added


 btIDebugDraw.h   btIDebugDraw.h 
skipping to change at line 31 skipping to change at line 31
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#ifndef IDEBUG_DRAW__H #ifndef IDEBUG_DRAW__H
#define IDEBUG_DRAW__H #define IDEBUG_DRAW__H
#include "btVector3.h" #include "btVector3.h"
#include "btTransform.h"
///The btIDebugDraw interface class allows hooking up a debug renderer to v isually debug simulations. ///The btIDebugDraw interface class allows hooking up a debug renderer to v isually debug simulations.
///Typical use case: create a debug drawer object, and assign it to a btCol lisionWorld or btDynamicsWorld using setDebugDrawer and call debugDrawWorld . ///Typical use case: create a debug drawer object, and assign it to a btCol lisionWorld or btDynamicsWorld using setDebugDrawer and call debugDrawWorld .
///A class that implements the btIDebugDraw interface has to implement the drawLine method at a minimum. ///A class that implements the btIDebugDraw interface has to implement the drawLine method at a minimum.
class btIDebugDraw class btIDebugDraw
{ {
public: public:
enum DebugDrawModes enum DebugDrawModes
{ {
skipping to change at line 53 skipping to change at line 54
DBG_DrawAabb=2, DBG_DrawAabb=2,
DBG_DrawFeaturesText=4, DBG_DrawFeaturesText=4,
DBG_DrawContactPoints=8, DBG_DrawContactPoints=8,
DBG_NoDeactivation=16, DBG_NoDeactivation=16,
DBG_NoHelpText = 32, DBG_NoHelpText = 32,
DBG_DrawText=64, DBG_DrawText=64,
DBG_ProfileTimings = 128, DBG_ProfileTimings = 128,
DBG_EnableSatComparison = 256, DBG_EnableSatComparison = 256,
DBG_DisableBulletLCP = 512, DBG_DisableBulletLCP = 512,
DBG_EnableCCD = 1024, DBG_EnableCCD = 1024,
DBG_DrawConstraints = (1 << 11),
DBG_DrawConstraintLimits = (1 << 12),
DBG_MAX_DEBUG_DRAW_MODE DBG_MAX_DEBUG_DRAW_MODE
}; };
virtual ~btIDebugDraw() {}; virtual ~btIDebugDraw() {};
virtual void drawLine(const btVector3& from,const btVector3& to,
const btVector3& fromColor, const btVector3& toColor)
{
drawLine (from, to, fromColor);
}
virtual void drawBox (const btVector3& boxMin, const btVector3& b
oxMax, const btVector3& color, btScalar alpha)
{
}
virtual void drawSphere (const btVector3& p, btScalar radius, con
st btVector3& color)
{
}
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 drawTriangle(const btVector3& v0,const btVector3& v1 ,const btVector3& v2,const btVector3& /*n0*/,const btVector3& /*n1*/,const btVector3& /*n2*/,const btVector3& color, btScalar alpha) virtual void drawTriangle(const btVector3& v0,const btVector3& v1 ,const btVector3& v2,const btVector3& /*n0*/,const btVector3& /*n1*/,const btVector3& /*n2*/,const btVector3& color, btScalar alpha)
{ {
drawTriangle(v0,v1,v2,color,alpha); drawTriangle(v0,v1,v2,color,alpha);
} }
virtual void drawTriangle(const btVector3& v0,const btVector3& v1 ,const btVector3& v2,const btVector3& color, btScalar /*alpha*/) virtual void drawTriangle(const btVector3& v0,const btVector3& v1 ,const btVector3& v2,const btVector3& color, btScalar /*alpha*/)
{ {
drawLine(v0,v1,color); drawLine(v0,v1,color);
drawLine(v1,v2,color); drawLine(v1,v2,color);
skipping to change at line 110 skipping to change at line 126
edgecoord[2]*halfExtents[2]); edgecoord[2]*halfExtents[2]);
pb+=center; pb+=center;
drawLine(pa,pb,color); drawLine(pa,pb,color);
} }
edgecoord = btVector3(-1.f,-1.f,-1.f); edgecoord = btVector3(-1.f,-1.f,-1.f);
if (i<3) if (i<3)
edgecoord[i]*=-1.f; edgecoord[i]*=-1.f;
} }
} }
void drawTransform(const btTransform& transform, btScalar orthoLen)
{
btVector3 start = transform.getOrigin();
drawLine(start, start+transform.getBasis() * btVector3(ortho
Len, 0, 0), btVector3(0.7f,0,0));
drawLine(start, start+transform.getBasis() * btVector3(0, or
thoLen, 0), btVector3(0,0.7f,0));
drawLine(start, start+transform.getBasis() * btVector3(0, 0,
orthoLen), btVector3(0,0,0.7f));
}
void drawArc(const btVector3& center, const btVector3& normal, const
btVector3& axis, btScalar radiusA, btScalar radiusB, btScalar minAngle, bt
Scalar maxAngle,
const btVector3& color, bool drawSect, btSca
lar stepDegrees = btScalar(10.f))
{
const btVector3& vx = axis;
btVector3 vy = normal.cross(axis);
btScalar step = stepDegrees * SIMD_RADS_PER_DEG;
int nSteps = (int)((maxAngle - minAngle) / step);
if(!nSteps) nSteps = 1;
btVector3 prev = center + radiusA * vx * btCos(minAngle) + r
adiusB * vy * btSin(minAngle);
if(drawSect)
{
drawLine(center, prev, color);
}
for(int i = 1; i <= nSteps; i++)
{
btScalar angle = minAngle + (maxAngle - minAngle) *
btScalar(i) / btScalar(nSteps);
btVector3 next = center + radiusA * vx * btCos(angle
) + radiusB * vy * btSin(angle);
drawLine(prev, next, color);
prev = next;
}
if(drawSect)
{
drawLine(center, prev, color);
}
}
void drawSpherePatch(const btVector3& center, const btVector3& up, c
onst btVector3& axis, btScalar radius,
btScalar minTh, btScalar maxTh, btScalar minPs, btScalar max
Ps, const btVector3& color, btScalar stepDegrees = btScalar(10.f))
{
btVector3 vA[74];
btVector3 vB[74];
btVector3 *pvA = vA, *pvB = vB, *pT;
btVector3 npole = center + up * radius;
btVector3 spole = center - up * radius;
btVector3 arcStart;
btScalar step = stepDegrees * SIMD_RADS_PER_DEG;
const btVector3& kv = up;
const btVector3& iv = axis;
btVector3 jv = kv.cross(iv);
bool drawN = false;
bool drawS = false;
if(minTh <= -SIMD_HALF_PI)
{
minTh = -SIMD_HALF_PI + step;
drawN = true;
}
if(maxTh >= SIMD_HALF_PI)
{
maxTh = SIMD_HALF_PI - step;
drawS = true;
}
if(minTh > maxTh)
{
minTh = -SIMD_HALF_PI + step;
maxTh = SIMD_HALF_PI - step;
drawN = drawS = true;
}
int n_hor = (int)((maxTh - minTh) / step) + 1;
if(n_hor < 2) n_hor = 2;
btScalar step_h = (maxTh - minTh) / btScalar(n_hor - 1);
bool isClosed = false;
if(minPs > maxPs)
{
minPs = -SIMD_PI + step;
maxPs = SIMD_PI;
isClosed = true;
}
else if((maxPs - minPs) >= SIMD_PI * btScalar(2.f))
{
isClosed = true;
}
else
{
isClosed = false;
}
int n_vert = (int)((maxPs - minPs) / step) + 1;
if(n_vert < 2) n_vert = 2;
btScalar step_v = (maxPs - minPs) / btScalar(n_vert - 1);
for(int i = 0; i < n_hor; i++)
{
btScalar th = minTh + btScalar(i) * step_h;
btScalar sth = radius * btSin(th);
btScalar cth = radius * btCos(th);
for(int j = 0; j < n_vert; j++)
{
btScalar psi = minPs + btScalar(j) * step_v;
btScalar sps = btSin(psi);
btScalar cps = btCos(psi);
pvB[j] = center + cth * cps * iv + cth * sps
* jv + sth * kv;
if(i)
{
drawLine(pvA[j], pvB[j], color);
}
else if(drawS)
{
drawLine(spole, pvB[j], color);
}
if(j)
{
drawLine(pvB[j-1], pvB[j], color);
}
else
{
arcStart = pvB[j];
}
if((i == (n_hor - 1)) && drawN)
{
drawLine(npole, pvB[j], color);
}
if(isClosed)
{
if(j == (n_vert-1))
{
drawLine(arcStart, pvB[j], c
olor);
}
}
else
{
if(((!i) || (i == (n_hor-1))) && ((!
j) || (j == (n_vert-1))))
{
drawLine(center, pvB[j], col
or);
}
}
}
pT = pvA; pvA = pvB; pvB = pT;
}
}
void drawBox(const btVector3& bbMin, const btVector3& bbMax, const b
tVector3& color)
{
drawLine(btVector3(bbMin[0], bbMin[1], bbMin[2]), btVector3(
bbMax[0], bbMin[1], bbMin[2]), color);
drawLine(btVector3(bbMax[0], bbMin[1], bbMin[2]), btVector3(
bbMax[0], bbMax[1], bbMin[2]), color);
drawLine(btVector3(bbMax[0], bbMax[1], bbMin[2]), btVector3(
bbMin[0], bbMax[1], bbMin[2]), color);
drawLine(btVector3(bbMin[0], bbMax[1], bbMin[2]), btVector3(
bbMin[0], bbMin[1], bbMin[2]), color);
drawLine(btVector3(bbMin[0], bbMin[1], bbMin[2]), btVector3(
bbMin[0], bbMin[1], bbMax[2]), color);
drawLine(btVector3(bbMax[0], bbMin[1], bbMin[2]), btVector3(
bbMax[0], bbMin[1], bbMax[2]), color);
drawLine(btVector3(bbMax[0], bbMax[1], bbMin[2]), btVector3(
bbMax[0], bbMax[1], bbMax[2]), color);
drawLine(btVector3(bbMin[0], bbMax[1], bbMin[2]), btVector3(
bbMin[0], bbMax[1], bbMax[2]), color);
drawLine(btVector3(bbMin[0], bbMin[1], bbMax[2]), btVector3(
bbMax[0], bbMin[1], bbMax[2]), color);
drawLine(btVector3(bbMax[0], bbMin[1], bbMax[2]), btVector3(
bbMax[0], bbMax[1], bbMax[2]), color);
drawLine(btVector3(bbMax[0], bbMax[1], bbMax[2]), btVector3(
bbMin[0], bbMax[1], bbMax[2]), color);
drawLine(btVector3(bbMin[0], bbMax[1], bbMax[2]), btVector3(
bbMin[0], bbMin[1], bbMax[2]), color);
}
void drawBox(const btVector3& bbMin, const btVector3& bbMax, const b
tTransform& trans, const btVector3& color)
{
drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMin[2]), color);
drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMin[2]), color);
drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMin[2]), color);
drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMin[2]), color);
drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMax[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMax[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color);
drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMax[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color);
}
}; };
#endif //IDEBUG_DRAW__H #endif //IDEBUG_DRAW__H
 End of changes. 4 change blocks. 
0 lines changed or deleted 225 lines changed or added


 btKinematicCharacterController.h   btKinematicCharacterController.h 
skipping to change at line 66 skipping to change at line 66
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_useGhostObjectSweepTest; bool m_useGhostObjectSweepTest;
int m_upAxis;
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);
bool recoverFromPenetration (btCollisionWorld* collisionWorld); bool recoverFromPenetration ( btCollisionWorld* collisionWorld);
void stepUp (btCollisionWorld* collisionWorld); void stepUp (btCollisionWorld* collisionWorld);
void updateTargetPositionBasedOnCollision (const btVector3& hit_norm al, btScalar tangentMag = btScalar(0.0), btScalar normalMag = btScalar(1.0) ); void updateTargetPositionBasedOnCollision (const btVector3& hit_norm al, btScalar tangentMag = btScalar(0.0), btScalar normalMag = btScalar(1.0) );
void stepForwardAndStrafe (btCollisionWorld* collisionWorld, const b tVector3& walkMove); void stepForwardAndStrafe (btCollisionWorld* collisionWorld, const b tVector3& walkMove);
void stepDown (btCollisionWorld* collisionWorld, btScalar dt); void stepDown (btCollisionWorld* collisionWorld, btScalar dt);
public: public:
btKinematicCharacterController (btPairCachingGhostObject* ghostObjec t,btConvexShape* convexShape,btScalar stepHeight); btKinematicCharacterController (btPairCachingGhostObject* ghostObjec t,btConvexShape* convexShape,btScalar stepHeight, int upAxis = 1);
~btKinematicCharacterController (); ~btKinematicCharacterController ();
///btActionInterface interface
virtual void updateAction( btCollisionWorld* collisionWorld,btScalar
deltaTime)
{
preStep ( collisionWorld);
playerStep (collisionWorld, deltaTime);
}
///btActionInterface interface
void debugDraw(btIDebugDraw* debugDrawer);
void setUpAxis (int axis)
{
if (axis < 0)
axis = 0;
if (axis > 2)
axis = 2;
m_upAxis = axis;
}
virtual void setWalkDirection(const btVector3& walkDirection) virtual void setWalkDirection(const btVector3& walkDirection)
{ {
m_walkDirection = walkDirection; m_walkDirection = walkDirection;
} }
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 ();
btPairCachingGhostObject* getGhostObject(); btPairCachingGhostObject* getGhostObject();
void setUseGhostSweepTest(bool useGhostObjectSweepTest) void setUseGhostSweepTest(bool useGhostObjectSweepTest)
{ {
 End of changes. 5 change blocks. 
4 lines changed or deleted 26 lines changed or added


 btManifoldPoint.h   btManifoldPoint.h 
skipping to change at line 108 skipping to change at line 108
const btVector3& getPositionWorldOnB() const const btVector3& getPositionWorldOnB() const
{ {
return m_positionWorldOnB; return m_positionWorldOnB;
} }
void setDistance(btScalar dist) void setDistance(btScalar dist)
{ {
m_distance1 = dist; m_distance1 = dist;
} }
///this returns the most recent applied impulse, to
satisfy contact constraints by the constraint solver
btScalar getAppliedImpulse() const
{
return m_appliedImpulse;
}
}; };
#endif //MANIFOLD_CONTACT_POINT_H #endif //MANIFOLD_CONTACT_POINT_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added


 btMatrix3x3.h   btMatrix3x3.h 
skipping to change at line 190 skipping to change at line 190
-sj, cj * si, cj * ci); -sj, cj * si, cj * ci);
} }
/**@brief Set the matrix to the identity */ /**@brief Set the matrix to the identity */
void setIdentity() void setIdentity()
{ {
setValue(btScalar(1.0), btScalar(0.0), btScalar(0.0) , setValue(btScalar(1.0), btScalar(0.0), btScalar(0.0) ,
btScalar(0.0), btScalar(1.0), btSca lar(0.0), btScalar(0.0), btScalar(1.0), btSca lar(0.0),
btScalar(0.0), btScalar(0.0), btSca lar(1.0)); btScalar(0.0), btScalar(0.0), btSca lar(1.0));
} }
static const btMatrix3x3& getIdentity()
{
static const btMatrix3x3 identityMatrix(btScalar(1.0
), btScalar(0.0), btScalar(0.0),
btScalar(0.0), btScalar(1.0), btSca
lar(0.0),
btScalar(0.0), btScalar(0.0), btSca
lar(1.0));
return identityMatrix;
}
/**@brief Fill the values of the matrix into a 9 element array /**@brief Fill the values of the matrix into a 9 element array
* @param m The array to be filled */ * @param m The array to be filled */
void getOpenGLSubMatrix(btScalar *m) const void getOpenGLSubMatrix(btScalar *m) const
{ {
m[0] = btScalar(m_el[0].x()); m[0] = btScalar(m_el[0].x());
m[1] = btScalar(m_el[1].x()); m[1] = btScalar(m_el[1].x());
m[2] = btScalar(m_el[2].x()); m[2] = btScalar(m_el[2].x());
m[3] = btScalar(0.0); m[3] = btScalar(0.0);
m[4] = btScalar(m_el[0].y()); m[4] = btScalar(m_el[0].y());
m[5] = btScalar(m_el[1].y()); m[5] = btScalar(m_el[1].y());
 End of changes. 1 change blocks. 
0 lines changed or deleted 12 lines changed or added


 btMultiSapBroadphase.h   btMultiSapBroadphase.h 
skipping to change at line 139 skipping to change at line 139
aabbMin.setValue(-1e30f,-1e30f,-1e30f); aabbMin.setValue(-1e30f,-1e30f,-1e30f);
aabbMax.setValue(1e30f,1e30f,1e30f); aabbMax.setValue(1e30f,1e30f,1e30f);
} }
void buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAa bbMax); void buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAa bbMax);
virtual void printStats(); virtual void printStats();
void quicksort (btBroadphasePairArray& a, int lo, int hi); void quicksort (btBroadphasePairArray& a, int lo, int hi);
///reset broadphase internal structures, to ensure determinism/repro
ducability
virtual void resetPool(btDispatcher* dispatcher);
}; };
#endif //BT_MULTI_SAP_BROADPHASE #endif //BT_MULTI_SAP_BROADPHASE
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 btMultimaterialTriangleMeshShape.h   btMultimaterialTriangleMeshShape.h 
skipping to change at line 34 skipping to change at line 34
///The BvhTriangleMaterialMeshShape extends the btBvhTriangleMeshShape. Its main contribution is the interface into a material array, which allows per -triangle friction and restitution. ///The BvhTriangleMaterialMeshShape extends the btBvhTriangleMeshShape. Its main contribution is the interface into a material array, which allows per -triangle friction and restitution.
ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhT riangleMeshShape ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhT riangleMeshShape
{ {
btAlignedObjectArray <btMaterial*> m_materialList; btAlignedObjectArray <btMaterial*> m_materialList;
int ** m_triangleMaterials; int ** m_triangleMaterials;
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {} btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {m_shapeTy pe = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;}
btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface , bool useQuantizedAabbCompression, bool buildBvh = true): btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface , bool useQuantizedAabbCompression, bool buildBvh = true):
btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh) btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
{ {
m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
btVector3 m_triangle[3]; btVector3 m_triangle[3];
const unsigned char *vertexbase; const unsigned char *vertexbase;
int numverts; int numverts;
PHY_ScalarType type; PHY_ScalarType type;
int stride; int stride;
const unsigned char *indexbase; const unsigned char *indexbase;
int indexstride; int indexstride;
int numfaces; int numfaces;
PHY_ScalarType indicestype; PHY_ScalarType indicestype;
skipping to change at line 70 skipping to change at line 72
indicestype, indicestype,
i); i);
//m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces, 16)); //m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces, 16));
} }
} }
///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterf ace, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btV ector3& bvhAabbMax, bool buildBvh = true): btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterf ace, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btV ector3& bvhAabbMax, bool buildBvh = true):
btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh) btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh)
{ {
m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
btVector3 m_triangle[3]; btVector3 m_triangle[3];
const unsigned char *vertexbase; const unsigned char *vertexbase;
int numverts; int numverts;
PHY_ScalarType type; PHY_ScalarType type;
int stride; int stride;
const unsigned char *indexbase; const unsigned char *indexbase;
int indexstride; int indexstride;
int numfaces; int numfaces;
PHY_ScalarType indicestype; PHY_ScalarType indicestype;
skipping to change at line 110 skipping to change at line 114
/* /*
for(int i = 0; i < m_meshInterface->getNumSubParts(); i++) for(int i = 0; i < m_meshInterface->getNumSubParts(); i++)
{ {
btAlignedFree(m_materialValues[i]); btAlignedFree(m_materialValues[i]);
m_materialLookup[i] = NULL; m_materialLookup[i] = NULL;
} }
btAlignedFree(m_materialValues); btAlignedFree(m_materialValues);
m_materialLookup = NULL; m_materialLookup = NULL;
*/ */
} }
virtual int getShapeType() const
{
return MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
}
//debugging //debugging
virtual const char* getName()const {return "MULTIMATERIALTRIANGL EMESH";} virtual const char* getName()const {return "MULTIMATERIALTRIANGL EMESH";}
///Obtains the material for a specific triangle ///Obtains the material for a specific triangle
const btMaterial * getMaterialProperties(int partID, int triIndex); const btMaterial * getMaterialProperties(int partID, int triIndex);
} }
; ;
#endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H #endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
 End of changes. 4 change blocks. 
6 lines changed or deleted 5 lines changed or added


 btOdeJoint.h   btOdeJoint.h 
skipping to change at line 45 skipping to change at line 45
// to one body then the second body is 0. // to one body then the second body is 0.
// info returned by getInfo1 function. the constraint dimension is m (<=6 ). // info returned by getInfo1 function. the constraint dimension is m (<=6 ).
// i.e. that is the total number of rows in the jacobian. `nub' is the // i.e. that is the total number of rows in the jacobian. `nub' is the
// number of unbounded variables (which have lo,hi = -/+ infinity). // number of unbounded variables (which have lo,hi = -/+ infinity).
btOdeJoint(); btOdeJoint();
virtual ~btOdeJoint(); virtual ~btOdeJoint();
struct Info1 { struct Info1 {
int m,nub; int m_numConstraintRows,nub;
}; };
// info returned by getInfo2 function // info returned by getInfo2 function
struct Info2 { struct Info2 {
// integrator parameters: frames per second (1/stepsize), default error // integrator parameters: frames per second (1/stepsize), default error
// reduction parameter (0..1). // reduction parameter (0..1).
btScalar fps,erp; btScalar fps,erp;
// for the first and second body, pointers to two (linear and angular) // for the first and second body, pointers to two (linear and angular)
// n*3 jacobian sub matrices, stored by rows. these matrices will have // n*3 jacobian sub matrices, stored by rows. these matrices will have
// been initialized to 0 on entry. if the second body is zero then the // been initialized to 0 on entry. if the second body is zero then the
// J2xx pointers may be 0. // J2xx pointers may be 0.
btScalar *J1l,*J1a,*J2l,*J2a; btScalar *m_J1linearAxis,*m_J1angularAxis,*m_J2linearAxis,*m_J2angularA xis;
// elements to jump from one row to the next in J's // elements to jump from one row to the next in J's
int rowskip; int rowskip;
// right hand sides of the equation J*v = c + cfm * lambda. cfm is the // right hand sides of the equation J*v = c + cfm * lambda. cfm is the
// "constraint force mixing" vector. c is set to zero on entry, cfm is // "constraint force mixing" vector. c is set to zero on entry, cfm is
// set to a constant value (typically very small or zero) value on entr y. // set to a constant value (typically very small or zero) value on entr y.
btScalar *c,*cfm; btScalar *m_constraintError,*cfm;
// lo and hi limits for variables (set to -/+ infinity on entry). // lo and hi limits for variables (set to -/+ infinity on entry).
btScalar *lo,*hi; btScalar *m_lowerLimit,*m_higherLimit;
// 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;
}; };
// virtual function table: size of the joint structure, function pointers . // virtual function table: size of the joint structure, function pointers .
// we do it this way instead of using C++ virtual functions because // we do it this way instead of using C++ virtual functions because
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 btOdeQuickstepConstraintSolver.h   btOdeQuickstepConstraintSolver.h 
skipping to change at line 43 skipping to change at line 43
/// btOdeQuickstepConstraintSolver is one of the available solvers for Bull et dynamics framework /// btOdeQuickstepConstraintSolver is one of the available solvers for Bull et dynamics framework
/// It uses an adapted version quickstep solver from the Open Dynamics Engi ne project /// It uses an adapted version quickstep solver from the Open Dynamics Engi ne project
class btOdeQuickstepConstraintSolver : public btConstraintSolver class btOdeQuickstepConstraintSolver : public btConstraintSolver
{ {
private: private:
int m_CurBody; int m_CurBody;
int m_CurJoint; int m_CurJoint;
int m_CurTypedJoint; int m_CurTypedJoint;
float m_cfm;
float m_erp;
btSorLcpSolver m_SorLcpSolver; btSorLcpSolver m_SorLcpSolver;
btAlignedObjectArray<btOdeSolverBody*> m_odeBodies; btAlignedObjectArray<btOdeSolverBody*> m_odeBodies;
btAlignedObjectArray<btOdeJoint*> m_joints; btAlignedObjectArray<btOdeJoint*> m_joints;
btAlignedObjectArray<btOdeSolverBody> m_SolverBodyArray; btAlignedObjectArray<btOdeSolverBody> m_SolverBodyArray;
btAlignedObjectArray<btOdeContactJoint> m_JointArray; btAlignedObjectArray<btOdeContactJoint> m_JointArray;
btAlignedObjectArray<btOdeTypedJoint> m_TypedJointArray; btAlignedObjectArray<btOdeTypedJoint> m_TypedJointArray;
private: private:
skipping to change at line 75 skipping to change at line 72
const btAlignedObjec tArray< btOdeSolverBody*> &bodies,int _bodyId0,int _bodyId1,btIDebugDraw* d ebugDrawer); const btAlignedObjec tArray< btOdeSolverBody*> &bodies,int _bodyId0,int _bodyId1,btIDebugDraw* d ebugDrawer);
public: public:
btOdeQuickstepConstraintSolver(); btOdeQuickstepConstraintSolver();
virtual ~btOdeQuickstepConstraintSolver() {} virtual ~btOdeQuickstepConstraintSolver() {}
virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies ,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** const raints,int numConstraints,const btContactSolverInfo& info,btIDebugDraw* deb ugDrawer,btStackAlloc* stackAlloc,btDispatcher* dispatcher); virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies ,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** const raints,int numConstraints,const btContactSolverInfo& info,btIDebugDraw* deb ugDrawer,btStackAlloc* stackAlloc,btDispatcher* dispatcher);
///setConstraintForceMixing, the cfm adds some positive value to the
main diagonal
///This can improve convergence (make matrix positive semidefinite),
but it can make the simulation look more 'springy'
void setConstraintForceMixing(float cfm) {
m_cfm = cfm;
}
///setErrorReductionParamter sets the maximum amount of error reduct
ion
///which limits energy addition during penetration depth recovery
void setErrorReductionParamter(float erp)
{
m_erp = erp;
}
///clear internal cached data and reset random seed ///clear internal cached data and reset random seed
void reset() void reset()
{ {
m_SorLcpSolver.dRand2_seed = 0; m_SorLcpSolver.dRand2_seed = 0;
} }
void setRandSeed(unsigned long seed) void setRandSeed(unsigned long seed)
{ {
m_SorLcpSolver.dRand2_seed = seed; m_SorLcpSolver.dRand2_seed = seed;
} }
 End of changes. 2 change blocks. 
19 lines changed or deleted 0 lines changed or added


 btOverlappingPairCache.h   btOverlappingPairCache.h 
skipping to change at line 80 skipping to change at line 80
virtual void setOverlapFilterCallback(btOverlapFilterCallback* callb ack) = 0; virtual void setOverlapFilterCallback(btOverlapFilterCallback* callb ack) = 0;
virtual void processAllOverlappingPairs(btOverlapCallback*,btDisp atcher* dispatcher) = 0; virtual void processAllOverlappingPairs(btOverlapCallback*,btDisp atcher* dispatcher) = 0;
virtual btBroadphasePair* findPair(btBroadphaseProxy* proxy0, btBroa dphaseProxy* proxy1) = 0; virtual btBroadphasePair* findPair(btBroadphaseProxy* proxy0, btBroa dphaseProxy* proxy1) = 0;
virtual bool hasDeferredRemoval() = 0; virtual bool hasDeferredRemoval() = 0;
virtual void setInternalGhostPairCallback(btOverlappingPairCallba ck* ghostPairCallback)=0; virtual void setInternalGhostPairCallback(btOverlappingPairCallba ck* ghostPairCallback)=0;
virtual void sortOverlappingPairs(btDispatcher* dispatcher) = 0;
}; };
/// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.bo x2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com /// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.bo x2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com
class btHashedOverlappingPairCache : public btOverlappingPairCache class btHashedOverlappingPairCache : public btOverlappingPairCache
{ {
btBroadphasePairArray m_overlappingPairArray; btBroadphasePairArray m_overlappingPairArray;
btOverlapFilterCallback* m_overlapFilterCallback; btOverlapFilterCallback* m_overlapFilterCallback;
bool m_blockedForChanges; bool m_blockedForChanges;
public: public:
skipping to change at line 242 skipping to change at line 244
virtual bool hasDeferredRemoval() virtual bool hasDeferredRemoval()
{ {
return false; return false;
} }
virtual void setInternalGhostPairCallback(btOverlappingPairCallba ck* ghostPairCallback) virtual void setInternalGhostPairCallback(btOverlappingPairCallba ck* ghostPairCallback)
{ {
m_ghostPairCallback = ghostPairCallback; m_ghostPairCallback = ghostPairCallback;
} }
public: virtual void sortOverlappingPairs(btDispatcher* dispatcher);
protected:
btAlignedObjectArray<int> m_hashTable; btAlignedObjectArray<int> m_hashTable;
btAlignedObjectArray<int> m_next; btAlignedObjectArray<int> m_next;
btOverlappingPairCallback* m_ghostPairCallback; btOverlappingPairCallback* m_ghostPairCallback;
}; };
///btSortedOverlappingPairCache maintains the objects with overlapping AABB ///btSortedOverlappingPairCache maintains the objects with overlapping AABB
///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase ///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
class btSortedOverlappingPairCache : public btOverlappingPairCache class btSortedOverlappingPairCache : public btOverlappingPairCache
skipping to change at line 344 skipping to change at line 348
virtual bool hasDeferredRemoval() virtual bool hasDeferredRemoval()
{ {
return m_hasDeferredRemoval; return m_hasDeferredRemoval;
} }
virtual void setInternalGhostPairCallback(btOverlappingPa irCallback* ghostPairCallback) virtual void setInternalGhostPairCallback(btOverlappingPa irCallback* ghostPairCallback)
{ {
m_ghostPairCallback = ghostPairCallback; m_ghostPairCallback = ghostPairCallback;
} }
virtual void sortOverlappingPairs(btDispatcher* dispatche
r);
}; };
///btNullPairCache skips add/removal of overlapping pairs. Userful for benc hmarking and unit testing. ///btNullPairCache skips add/removal of overlapping pairs. Userful for benc hmarking and unit testing.
class btNullPairCache : public btOverlappingPairCache class btNullPairCache : public btOverlappingPairCache
{ {
btBroadphasePairArray m_overlappingPairArray; btBroadphasePairArray m_overlappingPairArray;
public: public:
skipping to change at line 419 skipping to change at line 425
virtual void* removeOverlappingPair(btBroadphaseProxy* /*proxy0*/, btBroadphaseProxy* /*proxy1*/,btDispatcher* /*dispatcher*/) virtual void* removeOverlappingPair(btBroadphaseProxy* /*proxy0*/, btBroadphaseProxy* /*proxy1*/,btDispatcher* /*dispatcher*/)
{ {
return 0; return 0;
} }
virtual void removeOverlappingPairsContainingProxy(btBroadphasePr oxy* /*proxy0*/,btDispatcher* /*dispatcher*/) virtual void removeOverlappingPairsContainingProxy(btBroadphasePr oxy* /*proxy0*/,btDispatcher* /*dispatcher*/)
{ {
} }
virtual void sortOverlappingPairs(btDispatcher* dispatcher)
{
}
}; };
#endif //OVERLAPPING_PAIR_CACHE_H #endif //OVERLAPPING_PAIR_CACHE_H
 End of changes. 4 change blocks. 
1 lines changed or deleted 12 lines changed or added


 btPersistentManifold.h   btPersistentManifold.h 
skipping to change at line 54 skipping to change at line 54
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;
/// 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_index1a; int m_index1a;
btPersistentManifold(); btPersistentManifold();
btPersistentManifold(void* body0,void* body1,int , btScalar contactB reakingThreshold) btPersistentManifold(void* body0,void* body1,int , btScalar contactB reakingThreshold,btScalar contactProcessingThreshold)
: 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)
{ {
} }
SIMD_FORCE_INLINE void* getBody0() { return m_body0;} SIMD_FORCE_INLINE void* getBody0() { return m_body0;}
SIMD_FORCE_INLINE void* getBody1() { return m_body1;} SIMD_FORCE_INLINE void* getBody1() { return m_body1;}
SIMD_FORCE_INLINE const void* getBody0() const { return m_body0;} SIMD_FORCE_INLINE const void* getBody0() const { return m_body0;}
SIMD_FORCE_INLINE const void* getBody1() const { return m_body1;} SIMD_FORCE_INLINE const void* getBody1() const { return m_body1;}
skipping to change at line 110 skipping to change at line 112
SIMD_FORCE_INLINE btManifoldPoint& getContactPoint(int index) SIMD_FORCE_INLINE btManifoldPoint& getContactPoint(int index)
{ {
btAssert(index < m_cachedPoints); btAssert(index < m_cachedPoints);
return m_pointCache[index]; return m_pointCache[index];
} }
///@todo: get this margin from the current physics / collision envir onment ///@todo: get this margin from the current physics / collision envir onment
btScalar getContactBreakingThreshold() const; btScalar getContactBreakingThreshold() const;
btScalar getContactProcessingThreshold() const
{
return m_contactProcessingThreshold;
}
int getCacheEntry(const btManifoldPoint& newPoint) const; int getCacheEntry(const btManifoldPoint& newPoint) const;
int addManifoldPoint( const btManifoldPoint& newPoint); int addManifoldPoint( const btManifoldPoint& newPoint);
void removeContactPoint (int index) void removeContactPoint (int index)
{ {
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];
 End of changes. 4 change blocks. 
2 lines changed or deleted 9 lines changed or added


 btPoint2PointConstraint.h   btPoint2PointConstraint.h 
skipping to change at line 51 skipping to change at line 51
#ifdef IN_PARALLELL_SOLVER #ifdef IN_PARALLELL_SOLVER
public: public:
#endif #endif
btJacobianEntry m_jac[3]; //3 orthogonal linear constraints btJacobianEntry m_jac[3]; //3 orthogonal linear constraints
btVector3 m_pivotInA; btVector3 m_pivotInA;
btVector3 m_pivotInB; btVector3 m_pivotInB;
public: public:
///for backwards compatibility during the transition to 'getInfo/get
Info2'
bool m_useSolveConstraintObsolete;
btConstraintSetting m_setting; btConstraintSetting m_setting;
btPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btV ector3& pivotInA,const btVector3& pivotInB); btPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btV ector3& pivotInA,const btVector3& pivotInB);
btPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA); btPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA);
btPoint2PointConstraint(); btPoint2PointConstraint();
virtual void buildJacobian(); virtual void buildJacobian();
virtual void solveConstraint(btScalar timeStep); virtual void getInfo1 (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info);
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep);
void updateRHS(btScalar timeStep); void updateRHS(btScalar timeStep);
void setPivotA(const btVector3& pivotA) void setPivotA(const btVector3& pivotA)
{ {
m_pivotInA = pivotA; m_pivotInA = pivotA;
} }
void setPivotB(const btVector3& pivotB) void setPivotB(const btVector3& pivotB)
{ {
 End of changes. 2 change blocks. 
1 lines changed or deleted 10 lines changed or added


 btQuadWord.h   btQuadWord.h 
skipping to change at line 25 skipping to change at line 25
#ifndef SIMD_QUADWORD_H #ifndef SIMD_QUADWORD_H
#define SIMD_QUADWORD_H #define SIMD_QUADWORD_H
#include "btScalar.h" #include "btScalar.h"
#include "btMinMax.h" #include "btMinMax.h"
#if defined (__CELLOS_LV2) && defined (__SPU__) #if defined (__CELLOS_LV2) && defined (__SPU__)
#include <altivec.h> #include <altivec.h>
#endif #endif
/**@brief The btQuadWordStorage class is base class for btVector3 and btQua ternion. /**@brief The btQuadWord class is base class for btVector3 and btQuaternion .
* Some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword. * Some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword.
*/ */
#ifndef USE_LIBSPE2 #ifndef USE_LIBSPE2
ATTRIBUTE_ALIGNED16(class) btQuadWordStorage ATTRIBUTE_ALIGNED16(class) btQuadWord
#else #else
class btQuadWordStorage class btQuadWord
#endif #endif
{ {
protected: protected:
#if defined (__SPU__) && defined (__CELLOS_LV2__) #if defined (__SPU__) && defined (__CELLOS_LV2__)
union { union {
vec_float4 mVec128; vec_float4 mVec128;
btScalar m_floats[4]; btScalar m_floats[4];
}; };
public: public:
vec_float4 get128() const vec_float4 get128() const
{ {
return mVec128; return mVec128;
} }
protected:
#else //__CELLOS_LV2__ __SPU__ #else //__CELLOS_LV2__ __SPU__
btScalar m_floats[4]; btScalar m_floats[4];
#endif //__CELLOS_LV2__ __SPU__ #endif //__CELLOS_LV2__ __SPU__
};
/** @brief The btQuadWord is base-class for vectors, points */
class btQuadWord : public btQuadWordStorage
{
public: public:
/**@brief Return the x value */ /**@brief Return the x value */
SIMD_FORCE_INLINE const btScalar& getX() const { return m_fl oats[0]; } SIMD_FORCE_INLINE const btScalar& getX() const { return m_fl oats[0]; }
/**@brief Return the y value */ /**@brief Return the y value */
SIMD_FORCE_INLINE const btScalar& getY() const { return m_fl oats[1]; } SIMD_FORCE_INLINE const btScalar& getY() const { return m_fl oats[1]; }
/**@brief Return the z value */ /**@brief Return the z value */
SIMD_FORCE_INLINE const btScalar& getZ() const { return m_fl oats[2]; } SIMD_FORCE_INLINE const btScalar& getZ() const { return m_fl oats[2]; }
/**@brief Set the x value */ /**@brief Set the x value */
SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x;} ; SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x;} ;
skipping to change at line 134 skipping to change at line 130
m_floats[0]=x; m_floats[0]=x;
m_floats[1]=y; m_floats[1]=y;
m_floats[2]=z; m_floats[2]=z;
m_floats[3]=w; m_floats[3]=w;
} }
/**@brief No initialization constructor */ /**@brief No initialization constructor */
SIMD_FORCE_INLINE btQuadWord() SIMD_FORCE_INLINE btQuadWord()
// :m_floats[0](btScalar(0.)),m_floats[1](btScalar(0.)) ,m_floats[2](btScalar(0.)),m_floats[3](btScalar(0.)) // :m_floats[0](btScalar(0.)),m_floats[1](btScalar(0.)) ,m_floats[2](btScalar(0.)),m_floats[3](btScalar(0.))
{ {
} }
/**@brief Copy constructor */
SIMD_FORCE_INLINE btQuadWord(const btQuadWordStorage& q)
{
*((btQuadWordStorage*)this) = q;
}
/**@brief Three argument constructor (zeros w) /**@brief Three argument constructor (zeros w)
* @param x Value of x * @param x Value of x
* @param y Value of y * @param y Value of y
* @param z Value of z * @param z Value of z
*/ */
SIMD_FORCE_INLINE btQuadWord(const btScalar& x, const btScal ar& y, const btScalar& z) SIMD_FORCE_INLINE btQuadWord(const btScalar& x, const btScal ar& y, const btScalar& z)
{ {
m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m _floats[3] = 0.0f; m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m _floats[3] = 0.0f;
} }
 End of changes. 6 change blocks. 
13 lines changed or deleted 5 lines changed or added


 btQuaternion.h   btQuaternion.h 
skipping to change at line 19 skipping to change at line 19
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 SIMD__QUATERNION_H_ #ifndef SIMD__QUATERNION_H_
#define SIMD__QUATERNION_H_ #define SIMD__QUATERNION_H_
#include "btVector3.h" #include "btVector3.h"
#include "btQuadWord.h"
/**@brief The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatrix3x3, btVector3 and btTransform. */ /**@brief The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatrix3x3, btVector3 and btTransform. */
class btQuaternion : public btQuadWord { class btQuaternion : public btQuadWord {
public: public:
/**@brief No initialization constructor */ /**@brief No initialization constructor */
btQuaternion() {} btQuaternion() {}
// template <typename btScalar> // template <typename btScalar>
// explicit Quaternion(const btScalar *v) : Tuple4<btSc alar>(v) {} // explicit Quaternion(const btScalar *v) : Tuple4<btSc alar>(v) {}
/**@brief Constructor from scalars */ /**@brief Constructor from scalars */
skipping to change at line 57 skipping to change at line 58
#else #else
setEulerZYX(yaw, pitch, roll); setEulerZYX(yaw, pitch, roll);
#endif #endif
} }
/**@brief Set the rotation using axis angle notation /**@brief Set the rotation using axis angle notation
* @param axis The axis around which to rotate * @param axis The axis around which to rotate
* @param angle The magnitude of the rotation in Radians */ * @param angle The magnitude of the rotation in Radians */
void setRotation(const btVector3& axis, const btScalar& angle) void setRotation(const btVector3& axis, const btScalar& angle)
{ {
btScalar d = axis.length(); btScalar d = axis.length();
assert(d != btScalar(0.0)); btAssert(d != btScalar(0.0));
btScalar s = btSin(angle * btScalar(0.5)) / d; btScalar s = btSin(angle * btScalar(0.5)) / d;
setValue(axis.x() * s, axis.y() * s, axis.z() * s, setValue(axis.x() * s, axis.y() * s, axis.z() * s,
btCos(angle * btScalar(0.5))); btCos(angle * btScalar(0.5)));
} }
/**@brief Set the quaternion using Euler angles /**@brief Set the quaternion using Euler angles
* @param yaw Angle around Y * @param yaw Angle around Y
* @param pitch Angle around X * @param pitch Angle around X
* @param roll Angle around Z */ * @param roll Angle around Z */
void setEuler(const btScalar& yaw, const btScalar& pitch, const btSc alar& roll) void setEuler(const btScalar& yaw, const btScalar& pitch, const btSc alar& roll)
{ {
skipping to change at line 175 skipping to change at line 176
SIMD_FORCE_INLINE btQuaternion SIMD_FORCE_INLINE btQuaternion
operator*(const btScalar& s) const operator*(const btScalar& s) const
{ {
return btQuaternion(x() * s, y() * s, z() * s, m_floats[3] * s); return btQuaternion(x() * s, y() * s, z() * s, m_floats[3] * s);
} }
/**@brief Return an inversely scaled versionof this quaternion /**@brief Return an inversely scaled versionof this quaternion
* @param s The inverse scale factor */ * @param s The inverse scale factor */
btQuaternion operator/(const btScalar& s) const btQuaternion operator/(const btScalar& s) const
{ {
assert(s != btScalar(0.0)); btAssert(s != btScalar(0.0));
return *this * (btScalar(1.0) / s); return *this * (btScalar(1.0) / s);
} }
/**@brief Inversely scale this quaternion /**@brief Inversely scale this quaternion
* @param s The scale factor */ * @param s The scale factor */
btQuaternion& operator/=(const btScalar& s) btQuaternion& operator/=(const btScalar& s)
{ {
assert(s != btScalar(0.0)); btAssert(s != btScalar(0.0));
return *this *= btScalar(1.0) / s; return *this *= btScalar(1.0) / s;
} }
/**@brief Return a normalized version of this quaternion */ /**@brief Return a normalized version of this quaternion */
btQuaternion normalized() const btQuaternion normalized() const
{ {
return *this / length(); return *this / length();
} }
/**@brief Return the angle between this quaternion and the other /**@brief Return the angle between this quaternion and the other
* @param q The other quaternion */ * @param q The other quaternion */
btScalar angle(const btQuaternion& q) const btScalar angle(const btQuaternion& q) const
{ {
btScalar s = btSqrt(length2() * q.length2()); btScalar s = btSqrt(length2() * q.length2());
assert(s != btScalar(0.0)); btAssert(s != btScalar(0.0));
return btAcos(dot(q) / s); return btAcos(dot(q) / s);
} }
/**@brief Return the angle of rotation represented by this quaternion */ /**@brief Return the angle of rotation represented by this quaternion */
btScalar getAngle() const btScalar getAngle() const
{ {
btScalar s = btScalar(2.) * btAcos(m_floats[3]); btScalar s = btScalar(2.) * btAcos(m_floats[3]);
return s; return s;
} }
/**@brief Return the inverse of this quaternion */ /**@brief Return the inverse of this quaternion */
skipping to change at line 272 skipping to change at line 273
(m_floats[1] * s0 + q.y() * s1) * d, (m_floats[1] * s0 + q.y() * s1) * d,
(m_floats[2] * s0 + q.z() * s1) * d, (m_floats[2] * s0 + q.z() * s1) * d,
(m_floats[3] * s0 + q.m_floats[3] * s1) * d) ; (m_floats[3] * s0 + q.m_floats[3] * s1) * d) ;
} }
else else
{ {
return *this; return *this;
} }
} }
static const btQuaternion& getIdentity()
{
static const btQuaternion identityQuat(btScalar(0.),btScalar
(0.),btScalar(0.),btScalar(1.));
return identityQuat;
}
SIMD_FORCE_INLINE const btScalar& getW() const { return m_floats[3]; } SIMD_FORCE_INLINE const btScalar& getW() const { return m_floats[3]; }
}; };
/**@brief Return the negative of a quaternion */ /**@brief Return the negative of a quaternion */
SIMD_FORCE_INLINE btQuaternion SIMD_FORCE_INLINE btQuaternion
operator-(const btQuaternion& q) operator-(const btQuaternion& q)
{ {
return btQuaternion(-q.x(), -q.y(), -q.z(), -q.w()); return btQuaternion(-q.x(), -q.y(), -q.z(), -q.w());
} }
 End of changes. 6 change blocks. 
4 lines changed or deleted 12 lines changed or added


 btRaycastCallback.h   btRaycastCallback.h 
skipping to change at line 32 skipping to change at line 32
class btConvexShape; class btConvexShape;
class btTriangleRaycastCallback: public btTriangleCallback class btTriangleRaycastCallback: public btTriangleCallback
{ {
public: public:
//input //input
btVector3 m_from; btVector3 m_from;
btVector3 m_to; btVector3 m_to;
//@BP Mod - allow backface filtering and unflipped normals
enum EFlags
{
kF_None = 0,
kF_FilterBackfaces = 1 << 0,
kF_KeepUnflippedNormal = 1 << 1, // Prevents returned face normal
getting flipped when a ray hits a back-facing triangle
kF_Terminator = 0xFFFFFFFF
};
unsigned int m_flags;
btScalar m_hitFraction; btScalar m_hitFraction;
btTriangleRaycastCallback(const btVector3& from,const btVector3& to) ; btTriangleRaycastCallback(const btVector3& from,const btVector3& to, unsigned int flags=0);
virtual void processTriangle(btVector3* triangle, int partId, int tr iangleIndex); virtual void processTriangle(btVector3* triangle, int partId, int tr iangleIndex);
virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex ) = 0; virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex ) = 0;
}; };
class btTriangleConvexcastCallback : public btTriangleCallback class btTriangleConvexcastCallback : public btTriangleCallback
{ {
public: public:
 End of changes. 2 change blocks. 
1 lines changed or deleted 13 lines changed or added


 btRaycastVehicle.h   btRaycastVehicle.h 
skipping to change at line 20 skipping to change at line 20
*/ */
#ifndef RAYCASTVEHICLE_H #ifndef RAYCASTVEHICLE_H
#define RAYCASTVEHICLE_H #define RAYCASTVEHICLE_H
#include "BulletDynamics/Dynamics/btRigidBody.h" #include "BulletDynamics/Dynamics/btRigidBody.h"
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" #include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
#include "btVehicleRaycaster.h" #include "btVehicleRaycaster.h"
class btDynamicsWorld; class btDynamicsWorld;
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "btWheelInfo.h" #include "btWheelInfo.h"
#include "BulletDynamics/Dynamics/btActionInterface.h"
class btVehicleTuning; class btVehicleTuning;
///rayCast vehicle, very special constraint that turn a rigidbody into a ve hicle. ///rayCast vehicle, very special constraint that turn a rigidbody into a ve hicle.
class btRaycastVehicle : public btTypedConstraint class btRaycastVehicle : public btActionInterface
{ {
btAlignedObjectArray<btVector3> m_forwardWS; btAlignedObjectArray<btVector3> m_forwardWS;
btAlignedObjectArray<btVector3> m_axle; btAlignedObjectArray<btVector3> m_axle;
btAlignedObjectArray<btScalar> m_forwardImpulse; btAlignedObjectArray<btScalar> m_forwardImpulse;
btAlignedObjectArray<btScalar> m_sideImpulse; btAlignedObjectArray<btScalar> m_sideImpulse;
public: public:
class btVehicleTuning class btVehicleTuning
{ {
skipping to change at line 76 skipping to change at line 77
void defaultInit(const btVehicleTuning& tuning); void defaultInit(const btVehicleTuning& tuning);
public: public:
//constructor to create a car from an existing rigidbody //constructor to create a car from an existing rigidbody
btRaycastVehicle(const btVehicleTuning& tuning,btRigidBody* chassis, btVehicleRaycaster* raycaster ); btRaycastVehicle(const btVehicleTuning& tuning,btRigidBody* chassis, btVehicleRaycaster* raycaster );
virtual ~btRaycastVehicle() ; virtual ~btRaycastVehicle() ;
///btActionInterface interface
virtual void updateAction( btCollisionWorld* collisionWorld, btScala
r step)
{
updateVehicle(step);
}
///btActionInterface interface
void debugDraw(btIDebugDraw* debugDrawer);
const btTransform& getChassisWorldTransform() const; const btTransform& getChassisWorldTransform() const;
btScalar rayCast(btWheelInfo& wheel); btScalar rayCast(btWheelInfo& wheel);
virtual void updateVehicle(btScalar step); virtual void updateVehicle(btScalar step);
void resetSuspension(); void resetSuspension();
btScalar getSteeringValue(int wheel) const; btScalar getSteeringValue(int wheel) const;
skipping to change at line 171 skipping to change at line 181
return m_currentVehicleSpeedKmHour; return m_currentVehicleSpeedKmHour;
} }
virtual void setCoordinateSystem(int rightIndex,int upIndex,int f orwardIndex) virtual void setCoordinateSystem(int rightIndex,int upIndex,int f orwardIndex)
{ {
m_indexRightAxis = rightIndex; m_indexRightAxis = rightIndex;
m_indexUpAxis = upIndex; m_indexUpAxis = upIndex;
m_indexForwardAxis = forwardIndex; m_indexForwardAxis = forwardIndex;
} }
virtual void buildJacobian()
{
//not yet
}
virtual void solveConstraint(btScalar timeStep)
{
(void)timeStep;
//not yet
}
}; };
class btDefaultVehicleRaycaster : public btVehicleRaycaster class btDefaultVehicleRaycaster : public btVehicleRaycaster
{ {
btDynamicsWorld* m_dynamicsWorld; btDynamicsWorld* m_dynamicsWorld;
public: public:
btDefaultVehicleRaycaster(btDynamicsWorld* world) btDefaultVehicleRaycaster(btDynamicsWorld* world)
:m_dynamicsWorld(world) :m_dynamicsWorld(world)
{ {
} }
 End of changes. 4 change blocks. 
12 lines changed or deleted 12 lines changed or added


 btRigidBody.h   btRigidBody.h 
skipping to change at line 49 skipping to change at line 49
class btRigidBody : public btCollisionObject class btRigidBody : public btCollisionObject
{ {
btMatrix3x3 m_invInertiaTensorWorld; btMatrix3x3 m_invInertiaTensorWorld;
btVector3 m_linearVelocity; btVector3 m_linearVelocity;
btVector3 m_angularVelocity; btVector3 m_angularVelocity;
btScalar m_inverseMass; btScalar m_inverseMass;
btScalar m_angularFactor; btScalar m_angularFactor;
btVector3 m_gravity; btVector3 m_gravity;
btVector3 m_gravity_acceleration;
btVector3 m_invInertiaLocal; btVector3 m_invInertiaLocal;
btVector3 m_totalForce; btVector3 m_totalForce;
btVector3 m_totalTorque; btVector3 m_totalTorque;
btScalar m_linearDamping; btScalar m_linearDamping;
btScalar m_angularDamping; btScalar m_angularDamping;
bool m_additionalDamping; bool m_additionalDamping;
btScalar m_additionalDampingFactor; btScalar m_additionalDampingFactor;
btScalar m_additionalLinearDampingThresholdSqr; btScalar m_additionalLinearDampingThresholdSqr;
skipping to change at line 178 skipping to change at line 179
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();
void setGravity(const btVector3& acceleration); void setGravity(const btVector3& acceleration);
const btVector3& getGravity() const const btVector3& getGravity() const
{ {
return m_gravity; return m_gravity_acceleration;
} }
void setDamping(btScalar lin_damping, btScalar an g_damping); void setDamping(btScalar lin_damping, btScalar an g_damping);
btScalar getLinearDamping() const btScalar getLinearDamping() const
{ {
return m_linearDamping; return m_linearDamping;
} }
btScalar getAngularDamping() const btScalar getAngularDamping() const
skipping to change at line 229 skipping to change at line 230
void integrateVelocities(btScalar step); void integrateVelocities(btScalar step);
void setCenterOfMassTransform(const btTransform& xform); void setCenterOfMassTransform(const btTransform& xform);
void applyCentralForce(const btVector3& force) void applyCentralForce(const btVector3& force)
{ {
m_totalForce += force; m_totalForce += force;
} }
const btVector3& getInvInertiaDiagLocal() const btVector3& getTotalForce()
{
return m_totalForce;
};
const btVector3& getTotalTorque()
{
return m_totalTorque;
};
const btVector3& getInvInertiaDiagLocal() const
{ {
return m_invInertiaLocal; return m_invInertiaLocal;
}; };
void setInvInertiaDiagLocal(const btVector3& diagInvInertia) void setInvInertiaDiagLocal(const btVector3& diagInvInertia)
{ {
m_invInertiaLocal = diagInvInertia; m_invInertiaLocal = diagInvInertia;
} }
void setSleepingThresholds(btScalar linear,btScalar angular) void setSleepingThresholds(btScalar linear,btScalar angular)
 End of changes. 3 change blocks. 
2 lines changed or deleted 13 lines changed or added


 btScalar.h   btScalar.h 
skipping to change at line 26 skipping to change at line 26
#define SIMD___SCALAR_H #define SIMD___SCALAR_H
#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>
#define BT_BULLET_VERSION 273 #define BT_BULLET_VERSION 274
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
#ifdef WIN32 #ifdef WIN32
#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)
#define SIMD_FORCE_INLINE inline #define SIMD_FORCE_INLINE inline
#define ATTRIBUTE_ALIGNED16(a) a #define ATTRIBUTE_ALIGNED16(a) a
#define ATTRIBUTE_ALIGNED128(a) a #define ATTRIBUTE_ALIGNED128(a) a
#else #else
#define BT_HAS_ALIGNED_ALLOCATOR //#define BT_HAS_ALIGNED_ALLOCATOR
#pragma warning(disable : 4324) // disable padding w arning #pragma warning(disable : 4324) // disable padding w arning
// #pragma warning(disable:4530) // Disable the excepti on disable but used in MSCV Stl warning. // #pragma warning(disable:4530) // Disable the excepti on disable but used in MSCV Stl warning.
// #pragma warning(disable:4996) //Turn off warnings ab out deprecated C routines // #pragma warning(disable:4996) //Turn off warnings ab out deprecated C routines
// #pragma warning(disable:4786) // Disable the "debug name too long" warning // #pragma warning(disable:4786) // Disable the "debug name too long" warning
#define SIMD_FORCE_INLINE __forceinline #define SIMD_FORCE_INLINE __forceinline
#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a #define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a
#define ATTRIBUTE_ALIGNED128(a) __declspec (align(12 8)) a #define ATTRIBUTE_ALIGNED128(a) __declspec (align(12 8)) a
#ifdef _XBOX #ifdef _XBOX
#define BT_USE_VMX128 #define BT_USE_VMX128
#include <ppcintrinsics.h> #include <ppcintrinsics.h>
#define BT_HAVE_NATIVE_FSEL #define BT_HAVE_NATIVE_FSEL
#define btFsel(a,b,c) __fsel((a),(b),(c)) #define btFsel(a,b,c) __fsel((a),(b),(c))
#else #else
#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_US
E_DOUBLE_PRECISION))
#define BT_USE_SSE #define BT_USE_SSE
#endif #include <emmintrin.h>
#endif
#endif//_XBOX
#endif //__MINGW32__ #endif //__MINGW32__
#include <assert.h> #include <assert.h>
#ifdef BT_DEBUG #ifdef BT_DEBUG
#define btAssert assert #define btAssert assert
#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)
skipping to change at line 122 skipping to change at line 128
//btFullAssert is optional, slows down a lot //btFullAssert is optional, slows down a lot
#define btFullAssert(x) #define btFullAssert(x)
#define btLikely(_c) __builtin_expect((_c), 1) #define btLikely(_c) __builtin_expect((_c), 1)
#define btUnlikely(_c) __builtin_expect((_c), 0) #define btUnlikely(_c) __builtin_expect((_c), 0)
#else #else
//non-windows systems //non-windows systems
#define SIMD_FORCE_INLINE inline #define SIMD_FORCE_INLINE inline
///@todo: check out alignment methods for other platforms/co
mpilers
///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned
(16)))
///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned
(128)))
#define ATTRIBUTE_ALIGNED16(a) a #define ATTRIBUTE_ALIGNED16(a) a
#define ATTRIBUTE_ALIGNED128(a) a #define ATTRIBUTE_ALIGNED128(a) a
#ifndef assert #ifndef assert
#include <assert.h> #include <assert.h>
#endif #endif
#if defined(DEBUG) || defined (_DEBUG) #if defined(DEBUG) || defined (_DEBUG)
#define btAssert assert #define btAssert assert
#else #else
#define btAssert(x) #define btAssert(x)
 End of changes. 5 change blocks. 
3 lines changed or deleted 16 lines changed or added


 btSequentialImpulseConstraintSolver.h   btSequentialImpulseConstraintSolver.h 
skipping to change at line 25 skipping to change at line 25
#ifndef SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H #ifndef SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
#define SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H #define SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
#include "btConstraintSolver.h" #include "btConstraintSolver.h"
class btIDebugDraw; class btIDebugDraw;
#include "btContactConstraint.h" #include "btContactConstraint.h"
#include "btSolverBody.h" #include "btSolverBody.h"
#include "btSolverConstraint.h" #include "btSolverConstraint.h"
///The btSequentialImpulseConstraintSolver uses a Propagation Method and Se ///The btSequentialImpulseConstraintSolver is a fast SIMD implementation of
quentially applies impulses the Projected Gauss Seidel (iterative LCP) method.
///The approach is the 3D version of Erin Catto's GDC 2006 tutorial. See ht
tp://www.gphysics.com
///Although Sequential Impulse is more intuitive, it is mathematically equi
valent to Projected Successive Overrelaxation (iterative LCP)
///Applies impulses for combined restitution and penetration recovery and t
o simulate friction
class btSequentialImpulseConstraintSolver : public btConstraintSolver class btSequentialImpulseConstraintSolver : public btConstraintSolver
{ {
protected:
btAlignedObjectArray<btSolverBody> m_tmpSolverBodyPool; btAlignedObjectArray<btSolverBody> m_tmpSolverBodyPool;
btAlignedObjectArray<btSolverConstraint> m_tmpSolverConstrain btConstraintArray m_tmpSolverContactConstraint
tPool; Pool;
btAlignedObjectArray<btSolverConstraint> m_tmpSolverFrictionC btConstraintArray m_tmpSolverNonContactConstra
onstraintPool; intPool;
btConstraintArray m_tmpSolverContactFrictionCo
nstraintPool;
btAlignedObjectArray<int> m_orderTmpConstraintPool; btAlignedObjectArray<int> m_orderTmpConstraintPool;
btAlignedObjectArray<int> m_orderFrictionConstraintPool; btAlignedObjectArray<int> m_orderFrictionConstraintPool;
protected:
btScalar solve(btRigidBody* body0,btRigidBody* body1, btManifoldPoin
t& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debugDrawer);
btScalar solveFriction(btRigidBody* body0,btRigidBody* body1, btMani
foldPoint& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debug
Drawer);
void prepareConstraints(btPersistentManifold* manifoldPtr, const bt
ContactSolverInfo& info,btIDebugDraw* debugDrawer);
btSolverConstraint& addFrictionConstraint(const btVector3& norma lAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint & cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation); btSolverConstraint& addFrictionConstraint(const btVector3& norma lAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint & cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation);
ContactSolverFunc m_contactDispatch[MAX_CONTACT_SOLVER_TYPES][MAX_CO
NTACT_SOLVER_TYPES];
ContactSolverFunc m_frictionDispatch[MAX_CONTACT_SOLVER_TYPES][MAX_C
ONTACT_SOLVER_TYPES];
///m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction ///m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction
unsigned long m_btSeed2; unsigned long m_btSeed2;
public: void initSolverBody(btSolverBody* solverBody, btCollisionObject*
collisionObject);
btScalar restitutionCurve(btScalar rel_vel, btScalar restitution);
btSequentialImpulseConstraintSolver(); void convertContact(btPersistentManifold* manifold,const btContac tSolverInfo& infoGlobal);
///Advanced: Override the default contact solving function for conta void resolveSplitPenetrationImpulseCacheFriendly(
cts, for certain types of rigidbody btSolverBody& body1,
///See btRigidBody::m_contactSolverType and btRigidBody::m_frictionS btSolverBody& body2,
olverType const btSolverConstraint& contactConstraint,
void setContactSolverFunc(ContactSolverFunc func,int type0,int ty const btContactSolverInfo& solverInfo);
pe1)
{
m_contactDispatch[type0][type1] = func;
}
///Advanced: Override the default friction solving function for cont //internal method
acts, for certain types of rigidbody int getOrInitSolverBody(btCollisionObject& body);
///See btRigidBody::m_contactSolverType and btRigidBody::m_frictionS
olverType void resolveSingleConstraintRowGeneric(btSolverBody& body1,btSolv
void SetFrictionSolverFunc(ContactSolverFunc func,int type0,int t erBody& body2,const btSolverConstraint& contactConstraint);
ype1)
{
m_frictionDispatch[type0][type1] = func;
}
void resolveSingleConstraintRowGenericSIMD(btSolverBody& body1,bt
SolverBody& body2,const btSolverConstraint& contactConstraint);
void resolveSingleConstraintRowLowerLimit(btSolverBody& body1,btS
olverBody& body2,const btSolverConstraint& contactConstraint);
void resolveSingleConstraintRowLowerLimitSIMD(btSolverBody& body1
,btSolverBody& body2,const btSolverConstraint& contactConstraint);
public:
btSequentialImpulseConstraintSolver();
virtual ~btSequentialImpulseConstraintSolver(); virtual ~btSequentialImpulseConstraintSolver();
virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies ,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** const raints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* de bugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher); virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies ,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** const raints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* de bugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher);
virtual btScalar solveGroupCacheFriendly(btCollisionObject** bodies,
int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedC
onstraint** constraints,int numConstraints,const btContactSolverInfo& infoG
lobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodie
s,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btType
dConstraint** constraints,int numConstraints,const btContactSolverInfo& inf
oGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedCons traint** constraints,int numConstraints,const btContactSolverInfo& infoGlob al,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc); btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedCons traint** constraints,int numConstraints,const btContactSolverInfo& infoGlob al,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodie s,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btType dConstraint** constraints,int numConstraints,const btContactSolverInfo& inf oGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
///clear internal cached data and reset random seed ///clear internal cached data and reset random seed
virtual void reset(); virtual void reset();
btScalar solveCombinedContactFriction(btRigidBody* body0,btRigidBody
* body1, btManifoldPoint& cp, const btContactSolverInfo& info,int iter,btID
ebugDraw* debugDrawer);
unsigned long btRand2(); unsigned long btRand2();
int btRandInt2 (int n); int btRandInt2 (int n);
void setRandSeed(unsigned long seed) void setRandSeed(unsigned long seed)
{ {
m_btSeed2 = seed; m_btSeed2 = seed;
} }
unsigned long getRandSeed() const unsigned long getRandSeed() const
{ {
 End of changes. 13 change blocks. 
57 lines changed or deleted 36 lines changed or added


 btSimpleBroadphase.h   btSimpleBroadphase.h 
skipping to change at line 102 skipping to change at line 102
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadp haseProxy*>(proxy); btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadp haseProxy*>(proxy);
return proxy0; return proxy0;
} }
inline const btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBr oadphaseProxy* proxy) const inline const btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBr oadphaseProxy* proxy) const
{ {
const btSimpleBroadphaseProxy* proxy0 = static_cast<const bt SimpleBroadphaseProxy*>(proxy); const btSimpleBroadphaseProxy* proxy0 = static_cast<const bt SimpleBroadphaseProxy*>(proxy);
return proxy0; return proxy0;
} }
///reset broadphase internal structures, to ensure determinism/repro
ducability
virtual void resetPool(btDispatcher* dispatcher);
void validate(); void validate();
protected: protected:
public: public:
btSimpleBroadphase(int maxProxies=16384,btOverlappingPairCache* over lappingPairCache=0); btSimpleBroadphase(int maxProxies=16384,btOverlappingPairCache* over lappingPairCache=0);
virtual ~btSimpleBroadphase(); virtual ~btSimpleBroadphase();
static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0, btSimpleBroadphaseProxy* proxy1); static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0, btSimpleBroadphaseProxy* proxy1);
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 btSimulationIslandManager.h   btSimulationIslandManager.h 
skipping to change at line 37 skipping to change at line 37
class btPersistentManifold; class btPersistentManifold;
///SimulationIslandManager creates and handles simulation islands, using bt UnionFind ///SimulationIslandManager creates and handles simulation islands, using bt UnionFind
class btSimulationIslandManager class btSimulationIslandManager
{ {
btUnionFind m_unionFind; btUnionFind m_unionFind;
btAlignedObjectArray<btPersistentManifold*> m_islandmanifold; btAlignedObjectArray<btPersistentManifold*> m_islandmanifold;
btAlignedObjectArray<btCollisionObject* > m_islandBodies; btAlignedObjectArray<btCollisionObject* > m_islandBodies;
bool m_splitIslands;
public: public:
btSimulationIslandManager(); btSimulationIslandManager();
virtual ~btSimulationIslandManager(); virtual ~btSimulationIslandManager();
void initUnionFind(int n); void initUnionFind(int n);
btUnionFind& getUnionFind() { return m_unionFind;} btUnionFind& getUnionFind() { return m_unionFind;}
virtual void updateActivationState(btCollisionWorld* colWorld,btD ispatcher* dispatcher); virtual void updateActivationState(btCollisionWorld* colWorld,btD ispatcher* dispatcher);
virtual void storeIslandActivationState(btCollisionWorld* world); virtual void storeIslandActivationState(btCollisionWorld* world);
skipping to change at line 61 skipping to change at line 63
{ {
virtual ~IslandCallback() {}; virtual ~IslandCallback() {};
virtual void ProcessIsland(btCollisionObject** bodies,int numBodies,class btPersistentManifold** manifolds,int numManifolds, int islandId) = 0; virtual void ProcessIsland(btCollisionObject** bodies,int numBodies,class btPersistentManifold** manifolds,int numManifolds, int islandId) = 0;
}; };
void buildAndProcessIslands(btDispatcher* dispatcher,btCollisionW orld* collisionWorld, IslandCallback* callback); void buildAndProcessIslands(btDispatcher* dispatcher,btCollisionW orld* collisionWorld, IslandCallback* callback);
void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorl d); void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorl d);
bool getSplitIslands()
{
return m_splitIslands;
}
void setSplitIslands(bool doSplitIslands)
{
m_splitIslands = doSplitIslands;
}
}; };
#endif //SIMULATION_ISLAND_MANAGER_H #endif //SIMULATION_ISLAND_MANAGER_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added


 btSliderConstraint.h   btSliderConstraint.h 
skipping to change at line 49 skipping to change at line 49
#define SLIDER_CONSTRAINT_DEF_SOFTNESS (btScalar(1.0)) #define SLIDER_CONSTRAINT_DEF_SOFTNESS (btScalar(1.0))
#define SLIDER_CONSTRAINT_DEF_DAMPING (btScalar(1.0)) #define SLIDER_CONSTRAINT_DEF_DAMPING (btScalar(1.0))
#define SLIDER_CONSTRAINT_DEF_RESTITUTION (btScalar(0.7)) #define SLIDER_CONSTRAINT_DEF_RESTITUTION (btScalar(0.7))
//------------------------------------------------------------------------- ---- //------------------------------------------------------------------------- ----
class btSliderConstraint : public btTypedConstraint class btSliderConstraint : public btTypedConstraint
{ {
protected: protected:
///for backwards compatibility during the transition to 'getInfo/get
Info2'
bool m_useSolveConstraintObsolete;
btTransform m_frameInA; btTransform m_frameInA;
btTransform m_frameInB; btTransform m_frameInB;
// use frameA fo define limits, if true // use frameA fo define limits, if true
bool m_useLinearReferenceFrameA; bool m_useLinearReferenceFrameA;
// linear limits // linear limits
btScalar m_lowerLinLimit; btScalar m_lowerLinLimit;
btScalar m_upperLinLimit; btScalar m_upperLinLimit;
// angular limits // angular limits
btScalar m_lowerAngLimit; btScalar m_lowerAngLimit;
btScalar m_upperAngLimit; btScalar m_upperAngLimit;
skipping to change at line 107 skipping to change at line 109
btVector3 m_sliderAxis; btVector3 m_sliderAxis;
btVector3 m_realPivotAInW; btVector3 m_realPivotAInW;
btVector3 m_realPivotBInW; btVector3 m_realPivotBInW;
btVector3 m_projPivotInW; btVector3 m_projPivotInW;
btVector3 m_delta; btVector3 m_delta;
btVector3 m_depth; btVector3 m_depth;
btVector3 m_relPosA; btVector3 m_relPosA;
btVector3 m_relPosB; btVector3 m_relPosB;
btScalar m_linPos; btScalar m_linPos;
btScalar m_angPos;
btScalar m_angDepth; btScalar m_angDepth;
btScalar m_kAngle; btScalar m_kAngle;
bool m_poweredLinMotor; bool m_poweredLinMotor;
btScalar m_targetLinMotorVelocity; btScalar m_targetLinMotorVelocity;
btScalar m_maxLinMotorForce; btScalar m_maxLinMotorForce;
btScalar m_accumulatedLinMotorImpulse; btScalar m_accumulatedLinMotorImpulse;
bool m_poweredAngMotor; bool m_poweredAngMotor;
skipping to change at line 129 skipping to change at line 132
btScalar m_accumulatedAngMotorImpulse; btScalar m_accumulatedAngMotorImpulse;
//------------------------ //------------------------
void initParams(); void initParams();
public: public:
// constructors // constructors
btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransfor m& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA); btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransfor m& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
btSliderConstraint(); btSliderConstraint();
// overrides // overrides
virtual void buildJacobian(); virtual void buildJacobian();
virtual void solveConstraint(btScalar timeStep); virtual void getInfo1 (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info);
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep);
// access // access
const btRigidBody& getRigidBodyA() const { return m_rbA; } const btRigidBody& getRigidBodyA() const { return m_rbA; }
const btRigidBody& getRigidBodyB() const { return m_rbB; } const btRigidBody& getRigidBodyB() const { return m_rbB; }
const btTransform & getCalculatedTransformA() const { return m_calculat edTransformA; } const btTransform & getCalculatedTransformA() const { return m_calculat edTransformA; }
const btTransform & getCalculatedTransformB() const { return m_calculat edTransformB; } const btTransform & getCalculatedTransformB() const { return m_calculat edTransformB; }
const btTransform & getFrameOffsetA() const { return m_frameInA; } const btTransform & getFrameOffsetA() const { return m_frameInA; }
const btTransform & getFrameOffsetB() const { return m_frameInB; } const btTransform & getFrameOffsetB() const { return m_frameInB; }
btTransform & getFrameOffsetA() { return m_frameInA; } btTransform & getFrameOffsetA() { return m_frameInA; }
btTransform & getFrameOffsetB() { return m_frameInB; } btTransform & getFrameOffsetB() { return m_frameInB; }
btScalar getLowerLinLimit() { return m_lowerLinLimit; } btScalar getLowerLinLimit() { return m_lowerLinLimit; }
skipping to change at line 205 skipping to change at line 213
btScalar getMaxAngMotorForce() { return m_maxAngMotorForce; } btScalar getMaxAngMotorForce() { return m_maxAngMotorForce; }
btScalar getLinearPos() { return m_linPos; } btScalar getLinearPos() { return m_linPos; }
// access for ODE solver // access for ODE solver
bool getSolveLinLimit() { return m_solveLinLim; } bool getSolveLinLimit() { return m_solveLinLim; }
btScalar getLinDepth() { return m_depth[0]; } btScalar getLinDepth() { return m_depth[0]; }
bool getSolveAngLimit() { return m_solveAngLim; } bool getSolveAngLimit() { return m_solveAngLim; }
btScalar getAngDepth() { return m_angDepth; } btScalar getAngDepth() { return m_angDepth; }
// internal // internal
void buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const b tTransform& frameInA, const btTransform& frameInB); void buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const b tTransform& frameInA, const btTransform& frameInB);
void solveConstraintInt(btRigidBody& rbA, btRigidBody& rbB); void solveConstraintInt(btRigidBody& rbA, btSolverBody& bodyA,btR igidBody& rbB, btSolverBody& bodyB);
// shared code used by ODE solver // shared code used by ODE solver
void calculateTransforms(void); void calculateTransforms(void);
void testLinLimits(void); void testLinLimits(void);
void testLinLimits2(btConstraintInfo2* info);
void testAngLimits(void); void testAngLimits(void);
// access for PE Solver // access for PE Solver
btVector3 getAncorInA(void); btVector3 getAncorInA(void);
btVector3 getAncorInB(void); btVector3 getAncorInB(void);
}; };
//------------------------------------------------------------------------- ---- //------------------------------------------------------------------------- ----
#endif //SLIDER_CONSTRAINT_H #endif //SLIDER_CONSTRAINT_H
 End of changes. 5 change blocks. 
2 lines changed or deleted 13 lines changed or added


 btSoftBody.h   btSoftBody.h 
skipping to change at line 51 skipping to change at line 51
btDispatcher* m_dispatcher; btDispatcher* m_dispatcher;
btVector3 m_gravity; btVector3 m_gravity;
btSparseSdf<3> m_sparsesdf; btSparseSdf<3> m_sparsesdf;
}; };
///The btSoftBody is an class to simulate cloth and volumetric soft bodies. ///The btSoftBody is an class to simulate cloth and volumetric soft bodies.
///There is two-way interaction between btSoftBody and btRigidBody/btCollis ionObject. ///There is two-way interaction between btSoftBody and btRigidBody/btCollis ionObject.
class btSoftBody : public btCollisionObject class btSoftBody : public btCollisionObject
{ {
public: public:
btAlignedObjectArray<class btCollisionObject*> m_collisionDisabledOb
jects;
// //
// Enumerations // Enumerations
// //
///eAeroModel ///eAeroModel
struct eAeroModel { enum _ { struct eAeroModel { enum _ {
V_Point, ///Vertex normals are oriented toward veloci ty V_Point, ///Vertex normals are oriented toward veloci ty
V_TwoSided, ///Vertex normals are fliped to match veloci ty V_TwoSided, ///Vertex normals are fliped to match veloci ty
V_OneSided, ///Vertex normals are taken as it is V_OneSided, ///Vertex normals are taken as it is
F_TwoSided, ///Face normals are fliped to match velocity F_TwoSided, ///Face normals are fliped to match velocity
skipping to change at line 298 skipping to change at line 300
int m_nv impulses; int m_nv impulses;
int m_nd impulses; int m_nd impulses;
btVector3 m_lv; btVector3 m_lv;
btVector3 m_av; btVector3 m_av;
btDbvtNode* m_leaf; btDbvtNode* m_leaf;
btScalar m_ndamping; /* Node damping */ btScalar m_ndamping; /* Node damping */
btScalar m_ldamping; /* Linear damping */ btScalar m_ldamping; /* Linear damping */
btScalar m_adamping; /* Angular damping */ btScalar m_adamping; /* Angular damping */
btScalar m_matching; btScalar m_matching;
bool m_collide; bool m_collide;
int m_cl usterIndex;
Cluster() : m_leaf(0),m_ndamping(0),m_ldamping(0),m_adamping (0),m_matching(0) {} Cluster() : m_leaf(0),m_ndamping(0),m_ldamping(0),m_adamping (0),m_matching(0) {}
}; };
/* Impulse */ /* Impulse */
struct Impulse struct Impulse
{ {
btVector3 m_velocity; btVector3 m_velocity;
btVector3 m_drift; btVector3 m_drift;
int m_as Velocity:1; int m_as Velocity:1;
int m_as Drift:1; int m_as Drift:1;
Impulse() : m_velocity(0,0,0),m_drift(0,0,0),m_asVelocity(0) ,m_asDrift(0) {} Impulse() : m_velocity(0,0,0),m_drift(0,0,0),m_asVelocity(0) ,m_asDrift(0) {}
skipping to change at line 606 skipping to change at line 609
tJointArray m_joints; // J oints tJointArray m_joints; // J oints
tMaterialArray m_materials; // Materials tMaterialArray m_materials; // Materials
btScalar m_timeacc; // T ime accumulator btScalar m_timeacc; // T ime accumulator
btVector3 m_bounds[2]; // Spatial b ounds btVector3 m_bounds[2]; // Spatial b ounds
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
btTransform m_initialWorldTransform;
// //
// 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 678 skipping to change at line 685
Material* mat=0, Material* mat=0,
bool bcheckexist=false); bool bcheckexist=false);
/* Append face */ /* Append face */
void appendFace(int model=-1,Material* ma t=0); void appendFace(int model=-1,Material* ma t=0);
void appendFace( int node0, void appendFace( int node0,
int node1, int node1,
int node2, int node2,
Material* mat=0); Material* mat=0);
/* Append anchor */ /* Append anchor */
void appendAnchor( int node, void appendAnchor( int node,
btRigidBody* body); btRigidBody* body, bool disableCollisionBetweenLinkedBodies= false);
/* Append linear joint */ /* Append linear joint */
void appendLinearJoint(const LJoint::Spec s& specs,Cluster* body0,Body body1); void appendLinearJoint(const LJoint::Spec s& specs,Cluster* body0,Body body1);
void appendLinearJoint(const LJoint::Spec s& specs,Body body=Body()); void appendLinearJoint(const LJoint::Spec s& specs,Body body=Body());
void appendLinearJoint(const LJoint::Spec s& specs,btSoftBody* body); void appendLinearJoint(const LJoint::Spec s& specs,btSoftBody* body);
/* Append linear joint */ /* Append linear joint */
void appendAngularJoint(const AJoint::Spe cs& specs,Cluster* body0,Body body1); void appendAngularJoint(const AJoint::Spe cs& specs,Cluster* body0,Body body1);
void appendAngularJoint(const AJoint::Spe cs& specs,Body body=Body()); void appendAngularJoint(const AJoint::Spe cs& specs,Body body=Body());
void appendAngularJoint(const AJoint::Spe cs& specs,btSoftBody* body); void appendAngularJoint(const AJoint::Spe cs& specs,btSoftBody* body);
/* Add force (or gravity) to the entire body */ /* Add force (or gravity) to the entire body */
void addForce( const btVect or3& force); void addForce( const btVect or3& force);
 End of changes. 4 change blocks. 
1 lines changed or deleted 10 lines changed or added


 btSoftBodyInternals.h   btSoftBodyInternals.h 
skipping to change at line 743 skipping to change at line 743
pj->m_split *= psb- >m_cfg.kSR_SPLT_CL; pj->m_split *= psb- >m_cfg.kSR_SPLT_CL;
} }
} }
} }
} }
void Process(btSoftBody* ps,btCollisionObject* co lOb) void Process(btSoftBody* ps,btCollisionObject* co lOb)
{ {
psb = ps; psb = ps;
m_colObj = colOb; m_colObj = colOb;
idt = ps->m_sst.isdt; idt = ps->m_sst.isdt;
margin = m_colObj->getCollisionShape( margin = m_colObj->getCollisionShape(
)->getMargin()+ )->getMargin();
m_colObj->getCollisionShape()->getMargin(); ///Bullet rigid body uses multiply instead of minimu
m to determine combined friction. Some customization would be useful.
friction = btMin(psb->m_cfg.kDF,m_colOb j->getFriction()); friction = btMin(psb->m_cfg.kDF,m_colOb j->getFriction());
btVector3 mins; btVector3 mins;
btVector3 maxs; btVector3 maxs;
ATTRIBUTE_ALIGNED16(btDbvtVolume) volu me; ATTRIBUTE_ALIGNED16(btDbvtVolume) volu me;
colOb->getCollisionShape()->getAabb(colOb->getInterp olationWorldTransform(),mins,maxs); colOb->getCollisionShape()->getAabb(colOb->getInterp olationWorldTransform(),mins,maxs);
volume=btDbvtVolume::FromMM(mins,maxs); volume=btDbvtVolume::FromMM(mins,maxs);
volume.Expand(btVector3(1,1,1)*margin); volume.Expand(btVector3(1,1,1)*margin);
ps->m_cdbvt.collideTV(ps->m_cdbvt.m_root,volume,*thi s); ps->m_cdbvt.collideTV(ps->m_cdbvt.m_root,volume,*thi s);
} }
skipping to change at line 766 skipping to change at line 766
// //
// CollideCL_SS // CollideCL_SS
// //
struct CollideCL_SS : ClusterBase struct CollideCL_SS : ClusterBase
{ {
btSoftBody* bodies[2]; btSoftBody* bodies[2];
void Process(const btDbvtNode* la,const btDbvtNod e* lb) void Process(const btDbvtNode* la,const btDbvtNod e* lb)
{ {
btSoftBody::Cluster* cla=(btSoftBody::Clu ster*)la->data; btSoftBody::Cluster* cla=(btSoftBody::Clu ster*)la->data;
btSoftBody::Cluster* clb=(btSoftBody::Clu ster*)lb->data; btSoftBody::Cluster* clb=(btSoftBody::Clu ster*)lb->data;
btSoftClusterCollisionShape csa(cla);
btSoftClusterCollisionShape csb(clb); bool connected=false;
btGjkEpaSolver2::sResults res; if ((bodies[0]==bodies[1])&&(bodies[0]->m_clusterCon
if(btGjkEpaSolver2::SignedDistance( &csa,btTrans nectivity.size()))
form::getIdentity(),
&csb,btTransform::getIdentity(),
cla->m_com-clb->m_com,res))
{ {
btSoftBody::CJoint joint; connected = bodies[0]->m_clusterConnectivity
if(SolveContact(res,cla,clb,joint)) [cla->m_clusterIndex+bodies[0]->m_clusters.size()*clb->m_clusterIndex];
}
if (!connected)
{
btSoftClusterCollisionShape csa(cla);
btSoftClusterCollisionShape csb(clb);
btGjkEpaSolver2::sResults res;
if(btGjkEpaSolver2::SignedDistance( &csa
,btTransform::getIdentity(),
&csb,btTransform::getIdentity(),
cla->m_com-clb->m_com,res))
{ {
btSoftBody::CJoint* pj=new(btAli btSoftBody::CJoint joint;
gnedAlloc(sizeof(btSoftBody::CJoint),16)) btSoftBody::CJoint(); if(SolveContact(res,cla,clb,joint))
*pj=joint;bodies[0]->m_joints.push_b {
ack(pj); btSoftBody::CJoint* pj=n
pj->m_erp *= btMax(bodies ew(btAlignedAlloc(sizeof(btSoftBody::CJoint),16)) btSoftBody::CJoint();
[0]->m_cfg.kSSHR_CL,bodies[1]->m_cfg.kSSHR_CL); *pj=joint;bodies[0]->m_joint
pj->m_split *= (bodies[0]-> s.push_back(pj);
m_cfg.kSS_SPLT_CL+bodies[1]->m_cfg.kSS_SPLT_CL)/2; pj->m_erp *= btMa
x(bodies[0]->m_cfg.kSSHR_CL,bodies[1]->m_cfg.kSSHR_CL);
pj->m_split *= (bod
ies[0]->m_cfg.kSS_SPLT_CL+bodies[1]->m_cfg.kSS_SPLT_CL)/2;
}
} }
} else
{
static int count=0;
count++;
//printf("count=%d\n",count);
} }
} }
void Process(btSoftBody* psa,btSoftBody* psb) void Process(btSoftBody* psa,btSoftBody* psb)
{ {
idt = psa->m_sst.isdt; idt = psa->m_sst.isdt;
margin = (psa->getCollisionShape()->g etMargin()+psb->getCollisionShape()->getMargin())/2; margin = (psa->getCollisionShape()->g etMargin()+psb->getCollisionShape()->getMargin())/2;
friction = btMin(psa->m_cfg.kDF,psb->m_ cfg.kDF); friction = btMin(psa->m_cfg.kDF,psb->m_ cfg.kDF);
bodies[0] = psa; bodies[0] = psa;
bodies[1] = psb; bodies[1] = psb;
psa->m_cdbvt.collideTT(psa->m_cdbvt.m_root,psb->m_cd bvt.m_root,*this); psa->m_cdbvt.collideTT(psa->m_cdbvt.m_root,psb->m_cd bvt.m_root,*this);
 End of changes. 5 change blocks. 
20 lines changed or deleted 39 lines changed or added


 btSolverBody.h   btSolverBody.h 
skipping to change at line 26 skipping to change at line 26
#ifndef BT_SOLVER_BODY_H #ifndef BT_SOLVER_BODY_H
#define BT_SOLVER_BODY_H #define BT_SOLVER_BODY_H
class btRigidBody; class btRigidBody;
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h" #include "LinearMath/btMatrix3x3.h"
#include "BulletDynamics/Dynamics/btRigidBody.h" #include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btTransformUtil.h" #include "LinearMath/btTransformUtil.h"
///The btSolverBody is an internal datastructure for the constraint solver. ///Until we get other contributions, only use SIMD on Windows, when using V
Only necessary data is packed to increase cache coherence/performance. isual Studio 2008 or later, and not double precision
ATTRIBUTE_ALIGNED16 (struct) btSolverBody #ifdef BT_USE_SSE
#define USE_SIMD 1
#endif //
#ifdef USE_SIMD
struct btSimdScalar
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); SIMD_FORCE_INLINE btSimdScalar()
{
btMatrix3x3 m_worldInvInertiaTensor; }
btVector3 m_angularVelocity; SIMD_FORCE_INLINE btSimdScalar(float fl)
btVector3 m_linearVelocity; :m_vec128 (_mm_set1_ps(fl))
btVector3 m_centerOfMassPosition; {
btVector3 m_pushVelocity; }
btVector3 m_turnVelocity;
float m_angularFactor; SIMD_FORCE_INLINE btSimdScalar(__m128 v128)
float m_invMass; :m_vec128(v128)
float m_friction; {
btRigidBody* m_originalBody; }
union
{
__m128 m_vec128;
float m_floats[4];
int m_ints[4];
btScalar m_unusedPadding;
};
SIMD_FORCE_INLINE __m128 get128()
{
return m_vec128;
}
SIMD_FORCE_INLINE void getVelocityInLocalPoint(const btVector3& rel _pos, btVector3& velocity ) const SIMD_FORCE_INLINE const __m128 get128() const
{ {
velocity = m_linearVelocity + m_angularVelocity.cross(rel_po s); return m_vec128;
} }
//Optimization for the iterative solver: avoid calculating constant SIMD_FORCE_INLINE void set128(__m128 v128)
terms involving inertia, normal, relative position
SIMD_FORCE_INLINE void internalApplyImpulse(const btVector3& linearC
omponent, const btVector3& angularComponent,btScalar impulseMagnitude)
{ {
if (m_invMass) m_vec128 = v128;
{
m_linearVelocity += linearComponent*impulseMagnitude
;
m_angularVelocity += angularComponent*(impulseMagnit
ude*m_angularFactor);
}
} }
SIMD_FORCE_INLINE void internalApplyPushImpulse(const btVector3& lin earComponent, const btVector3& angularComponent,btScalar impulseMagnitude) SIMD_FORCE_INLINE operator __m128()
{ {
if (m_invMass) return m_vec128;
{ }
m_pushVelocity += linearComponent*impulseMagnitude; SIMD_FORCE_INLINE operator const __m128() const
m_turnVelocity += angularComponent*(impulseMagnitude {
*m_angularFactor); return m_vec128;
}
} }
void writebackVelocity() SIMD_FORCE_INLINE operator float() const
{ {
if (m_invMass) return m_floats[0];
{ }
m_originalBody->setLinearVelocity(m_linearVelocity);
m_originalBody->setAngularVelocity(m_angularVelocity
);
//m_originalBody->setCompanionId(-1); };
///@brief Return the elementwise product of two btSimdScalar
SIMD_FORCE_INLINE btSimdScalar
operator*(const btSimdScalar& v1, const btSimdScalar& v2)
{
return btSimdScalar(_mm_mul_ps(v1.get128(),v2.get128()));
}
///@brief Return the elementwise product of two btSimdScalar
SIMD_FORCE_INLINE btSimdScalar
operator+(const btSimdScalar& v1, const btSimdScalar& v2)
{
return btSimdScalar(_mm_add_ps(v1.get128(),v2.get128()));
}
#else
#define btSimdScalar btScalar
#endif
///The btSolverBody is an internal datastructure for the constraint solver.
Only necessary data is packed to increase cache coherence/performance.
ATTRIBUTE_ALIGNED16 (struct) btSolverBody
{
BT_DECLARE_ALIGNED_ALLOCATOR();
btVector3 m_deltaLinearVelocity;
btVector3 m_deltaAngularVelocity;
btScalar m_angularFactor;
btScalar m_invMass;
btScalar m_friction;
btRigidBody* m_originalBody;
btVector3 m_pushVelocity;
//btVector3 m_turnVelocity;
SIMD_FORCE_INLINE void getVelocityInLocalPointObsolete(const btVect
or3& rel_pos, btVector3& velocity ) const
{
if (m_originalBody)
velocity = m_originalBody->getLinearVelocity()+m_del
taLinearVelocity + (m_originalBody->getAngularVelocity()+m_deltaAngularVelo
city).cross(rel_pos);
else
velocity.setValue(0,0,0);
}
SIMD_FORCE_INLINE void getAngularVelocity(btVector3& angVel) const
{
if (m_originalBody)
angVel = m_originalBody->getAngularVelocity()+m_delt
aAngularVelocity;
else
angVel.setValue(0,0,0);
}
//Optimization for the iterative solver: avoid calculating constant
terms involving inertia, normal, relative position
SIMD_FORCE_INLINE void applyImpulse(const btVector3& linearComponent
, const btVector3& angularComponent,const btScalar impulseMagnitude)
{
//if (m_invMass)
{
m_deltaLinearVelocity += linearComponent*impulseMagn
itude;
m_deltaAngularVelocity += angularComponent*(impulseM
agnitude*m_angularFactor);
} }
} }
void writebackVelocity(btScalar timeStep) /*
void writebackVelocity()
{ {
if (m_invMass) if (m_invMass)
{ {
m_originalBody->setLinearVelocity(m_linearVelocity); m_originalBody->setLinearVelocity(m_originalBody->ge
m_originalBody->setAngularVelocity(m_angularVelocity tLinearVelocity()+ m_deltaLinearVelocity);
); m_originalBody->setAngularVelocity(m_originalBody->g
etAngularVelocity()+m_deltaAngularVelocity);
//correct the position/orientation based on push/tur
n recovery
btTransform newTransform;
btTransformUtil::integrateTransform(m_originalBody->
getWorldTransform(),m_pushVelocity,m_turnVelocity,timeStep,newTransform);
m_originalBody->setWorldTransform(newTransform);
//m_originalBody->setCompanionId(-1); //m_originalBody->setCompanionId(-1);
} }
} }
*/
void readVelocity() void writebackVelocity(btScalar timeStep=0)
{ {
if (m_invMass) if (m_invMass)
{ {
m_linearVelocity = m_originalBody->getLinearVelocity m_originalBody->setLinearVelocity(m_originalBody->ge
(); tLinearVelocity()+m_deltaLinearVelocity);
m_angularVelocity = m_originalBody->getAngularVeloci m_originalBody->setAngularVelocity(m_originalBody->g
ty(); etAngularVelocity()+m_deltaAngularVelocity);
//m_originalBody->setCompanionId(-1);
} }
} }
}; };
#endif //BT_SOLVER_BODY_H #endif //BT_SOLVER_BODY_H
 End of changes. 19 change blocks. 
57 lines changed or deleted 123 lines changed or added


 btSolverConstraint.h   btSolverConstraint.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 BT_SOLVER_CONSTRAINT_H #ifndef BT_SOLVER_CONSTRAINT_H
#define BT_SOLVER_CONSTRAINT_H #define BT_SOLVER_CONSTRAINT_H
class btRigidBody; class btRigidBody;
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h" #include "LinearMath/btMatrix3x3.h"
#include "btJacobianEntry.h"
//#define NO_FRICTION_TANGENTIALS 1 //#define NO_FRICTION_TANGENTIALS 1
#include "btSolverBody.h"
///1D constraint along a normal axis between bodyA and bodyB. It can be com bined to solve contact and friction constraints. ///1D constraint along a normal axis between bodyA and bodyB. It can be com bined to solve contact and friction constraints.
ATTRIBUTE_ALIGNED16 (struct) btSolverConstraint ATTRIBUTE_ALIGNED16 (struct) btSolverConstraint
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btVector3 m_relpos1CrossNormal; btVector3 m_relpos1CrossNormal;
btVector3 m_contactNormal; btVector3 m_contactNormal;
btVector3 m_relpos2CrossNormal;
btVector3 m_angularComponentA;
btVector3 m_angularComponentB; btVector3 m_relpos2CrossNormal;
//btVector3 m_contactNormal2;//usually m_contactNormal2
== -m_contactNormal
mutable btScalar m_appliedPushImpulse; btVector3 m_angularComponentA;
btVector3 m_angularComponentB;
mutable btScalar m_appliedImpulse; mutable btSimdScalar m_appliedPushImpulse;
int m_solverBodyIdA; mutable btSimdScalar m_appliedImpulse;
int m_solverBodyIdB;
btScalar m_friction; btScalar m_friction;
btScalar m_restitution;
btScalar m_jacDiagABInv; btScalar m_jacDiagABInv;
btScalar m_penetration; union
{
int m_numConsecutiveRowsPerKernel;
btScalar m_unusedPadding0;
};
int m_constraintType; union
int m_frictionIndex; {
void* m_originalContactPoint; int m_frictionIndex;
int m_unusedPadding[1]; btScalar m_unusedPadding1;
};
union
{
int m_solverBodyIdA;
btScalar m_unusedPadding2;
};
union
{
int m_solverBodyIdB;
btScalar m_unusedPadding3;
};
union
{
void* m_originalContactPoint;
btScalar m_unusedPadding4;
};
btScalar m_rhs;
btScalar m_cfm;
btScalar m_lowerLimit;
btScalar m_upperLimit;
enum btSolverConstraintType enum btSolverConstraintType
{ {
BT_SOLVER_CONTACT_1D = 0, BT_SOLVER_CONTACT_1D = 0,
BT_SOLVER_FRICTION_1D BT_SOLVER_FRICTION_1D
}; };
}; };
typedef btAlignedObjectArray<btSolverConstraint> btConstraintArray;
#endif //BT_SOLVER_CONSTRAINT_H #endif //BT_SOLVER_CONSTRAINT_H
 End of changes. 10 change blocks. 
16 lines changed or deleted 44 lines changed or added


 btSorLcp.h   btSorLcp.h 
skipping to change at line 41 skipping to change at line 41
//========================================================================= ==== //========================================================================= ====
class btSorLcpSolver //Remotion: 11.10.2007 class btSorLcpSolver //Remotion: 11.10.2007
{ {
public: public:
btSorLcpSolver() btSorLcpSolver()
{ {
dRand2_seed = 0; dRand2_seed = 0;
} }
void SolveInternal1 (float global_cfm, void SolveInternal1 (const btAlignedObjectArray<btOdeSolverBody*> &b
float global_erp, ody, int nb,
const btAlignedObjectArray<btOdeSolverBody*> &body, int nb,
btAlignedObjectArray<btOdeJoint*> &joint, btAlignedObjectArray<btOdeJoint*> &joint,
int nj, const btContactSolverInfo& solverInfo, int nj, const btContactSolverInfo& solverInfo,
btStackAlloc* stackAlloc btStackAlloc* stackAlloc
); );
public: //data public: //data
unsigned long dRand2_seed; unsigned long dRand2_seed;
protected: //typedef protected: //typedef
typedef const btScalar *dRealPtr; typedef const btScalar *dRealPtr;
 End of changes. 1 change blocks. 
3 lines changed or deleted 2 lines changed or added


 btSphereShape.h   btSphereShape.h 
skipping to change at line 48 skipping to change at line 48
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
//notice that the vectors should be unit length //notice that the vectors should be unit length
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 void calculateLocalInertia(btScalar mass,btVector3& inert ia) const; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const;
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const; virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const;
btScalar getRadius() const { return m_implicitShapeDimensions .getX() * m_localScaling.getX();} btScalar getRadius() const { return m_implicitShapeDimensions .getX() * m_localScaling.getX();}
void setUnscaledRadius(btScalar radius)
{
m_implicitShapeDimensions.setX(radius);
btConvexInternalShape::setMargin(radius);
}
//debugging //debugging
virtual const char* getName()const {return "SPHERE";} virtual const char* getName()const {return "SPHERE";}
virtual void setMargin(btScalar margin) virtual void setMargin(btScalar margin)
{ {
btConvexInternalShape::setMargin(margin); btConvexInternalShape::setMargin(margin);
} }
virtual btScalar getMargin() const virtual btScalar getMargin() const
{ {
//to improve gjk behaviour, use radius+margin as the full ma rgin, so never get into the penetration case //to improve gjk behaviour, use radius+margin as the full ma rgin, so never get into the penetration case
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 btTransform.h   btTransform.h 
skipping to change at line 185 skipping to change at line 185
/**@brief Return the inverse of this transform times the other transform /**@brief Return the inverse of this transform times the other transform
* @param t The other transform * @param t The other transform
* return this.inverse() * the other */ * return this.inverse() * the other */
btTransform inverseTimes(const btTransform& t) const; btTransform inverseTimes(const btTransform& t) const;
/**@brief Return the product of this transform and the other */ /**@brief Return the product of this transform and the other */
btTransform operator*(const btTransform& t) const; btTransform operator*(const btTransform& t) const;
/**@brief Return an identity transform */ /**@brief Return an identity transform */
static btTransform getIdentity() static const btTransform& getIdentity()
{ {
btTransform tr; static const btTransform identityTransform(btMatrix3x3::getI
tr.setIdentity(); dentity());
return tr; return identityTransform;
} }
private: private:
///Storage for the rotation ///Storage for the rotation
btMatrix3x3 m_basis; btMatrix3x3 m_basis;
///Storage for the translation ///Storage for the translation
btVector3 m_origin; btVector3 m_origin;
}; };
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 btTriangleIndexVertexArray.h   btTriangleIndexVertexArray.h 
skipping to change at line 53 skipping to change at line 53
///The btTriangleIndexVertexArray allows to access multiple triangle meshes , by indexing into existing triangle/index arrays. ///The btTriangleIndexVertexArray allows to access multiple triangle meshes , by indexing into existing triangle/index arrays.
///Additional meshes can be added using addIndexedMesh ///Additional meshes can be added using addIndexedMesh
///No duplcate is made of the vertex/index data, it only indexes into exter nal vertex/index arrays. ///No duplcate is made of the vertex/index data, it only indexes into exter nal vertex/index arrays.
///So keep those arrays around during the lifetime of this btTriangleIndexV ertexArray. ///So keep those arrays around during the lifetime of this btTriangleIndexV ertexArray.
ATTRIBUTE_ALIGNED16( class) btTriangleIndexVertexArray : public btStridingM eshInterface ATTRIBUTE_ALIGNED16( class) btTriangleIndexVertexArray : public btStridingM eshInterface
{ {
protected: protected:
IndexedMeshArray m_indexedMeshes; IndexedMeshArray m_indexedMeshes;
int m_pad[2]; int m_pad[2];
int m_hasAabb; // using int instead of bool to maintain alignment mutable int m_hasAabb; // using int instead of bool to maintain alig
btVector3 m_aabbMin; nment
btVector3 m_aabbMax; mutable btVector3 m_aabbMin;
mutable btVector3 m_aabbMax;
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btTriangleIndexVertexArray() : m_hasAabb(0) btTriangleIndexVertexArray() : m_hasAabb(0)
{ {
} }
virtual ~btTriangleIndexVertexArray(); virtual ~btTriangleIndexVertexArray();
skipping to change at line 106 skipping to change at line 106
const IndexedMeshArray& getIndexedMeshArray() const const IndexedMeshArray& getIndexedMeshArray() const
{ {
return m_indexedMeshes; return m_indexedMeshes;
} }
virtual void preallocateVertices(int numverts){(void) numverts;} virtual void preallocateVertices(int numverts){(void) numverts;}
virtual void preallocateIndices(int numindices){(void) numindices ;} virtual void preallocateIndices(int numindices){(void) numindices ;}
virtual bool hasPremadeAabb() const; virtual bool hasPremadeAabb() const;
virtual void setPremadeAabb(const btVector3& aabbMin, const btVec tor3& aabbMax ); virtual void setPremadeAabb(const btVector3& aabbMin, const btVec tor3& aabbMax ) const;
virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMa x ) const; virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMa x ) const;
} }
; ;
#endif //BT_TRIANGLE_INDEX_VERTEX_ARRAY_H #endif //BT_TRIANGLE_INDEX_VERTEX_ARRAY_H
 End of changes. 2 change blocks. 
4 lines changed or deleted 5 lines changed or added


 btTriangleMeshShape.h   btTriangleMeshShape.h 
skipping to change at line 42 skipping to change at line 42
btTriangleMeshShape(btStridingMeshInterface* meshInterface); btTriangleMeshShape(btStridingMeshInterface* meshInterface);
public: public:
virtual ~btTriangleMeshShape(); virtual ~btTriangleMeshShape();
virtual btVector3 localGetSupportingVertex(const btVector3& vec) con st; virtual btVector3 localGetSupportingVertex(const btVector3& vec) con st;
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
{ {
assert(0); btAssert(0);
return localGetSupportingVertex(vec); return localGetSupportingVertex(vec);
} }
void recalcLocalAabb(); void recalcLocalAabb();
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const; virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const;
virtual void processAllTriangles(btTriangleCallback* callback,con st btVector3& aabbMin,const btVector3& aabbMax) const; virtual void processAllTriangles(btTriangleCallback* callback,con st btVector3& aabbMin,const btVector3& aabbMax) const;
virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const;
 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 21 skipping to change at line 21
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 TYPED_CONSTRAINT_H #ifndef TYPED_CONSTRAINT_H
#define TYPED_CONSTRAINT_H #define TYPED_CONSTRAINT_H
class btRigidBody; class btRigidBody;
#include "LinearMath/btScalar.h" #include "LinearMath/btScalar.h"
#include "btSolverConstraint.h"
struct btSolverBody;
enum btTypedConstraintType enum btTypedConstraintType
{ {
POINT2POINT_CONSTRAINT_TYPE, POINT2POINT_CONSTRAINT_TYPE,
HINGE_CONSTRAINT_TYPE, HINGE_CONSTRAINT_TYPE,
CONETWIST_CONSTRAINT_TYPE, CONETWIST_CONSTRAINT_TYPE,
D6_CONSTRAINT_TYPE, D6_CONSTRAINT_TYPE,
VEHICLE_CONSTRAINT_TYPE,
SLIDER_CONSTRAINT_TYPE SLIDER_CONSTRAINT_TYPE
}; };
///TypedConstraint is the baseclass for Bullet constraints and vehicles ///TypedConstraint is the baseclass for Bullet constraints and vehicles
class btTypedConstraint class btTypedConstraint
{ {
int m_userConstraintType; int m_userConstraintType;
int m_userConstraintId; int m_userConstraintId;
btTypedConstraintType m_constraintType; btTypedConstraintType m_constraintType;
skipping to change at line 51 skipping to change at line 52
{ {
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;
public: public:
btTypedConstraint(btTypedConstraintType type); btTypedConstraint(btTypedConstraintType type);
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 {
int m_numConstraintRows,nub;
};
struct btConstraintInfo2 {
// integrator parameters: frames per second (1/stepsize), de
fault error
// reduction parameter (0..1).
btScalar fps,erp;
// for the first and second body, pointers to two (linear an
d angular)
// n*3 jacobian sub matrices, stored by rows. these matrices
will have
// been initialized to 0 on entry. if the second body is zer
o then the
// J2xx pointers may be 0.
btScalar *m_J1linearAxis,*m_J1angularAxis,*m_J2linearAxis,*m
_J2angularAxis;
// elements to jump from one row to the next in J's
int rowskip;
// right hand sides of the equation J*v = c + cfm * lambda.
cfm is the
// "constraint force mixing" vector. c is set to zero on ent
ry, cfm is
// set to a constant value (typically very small or zero) va
lue on entry.
btScalar *m_constraintError,*cfm;
// lo and hi limits for variables (set to -/+ infinity on en
try).
btScalar *m_lowerLimit,*m_upperLimit;
// findex vector for variables. see the LCP solver interface
for a
// description of what this does. this is set to -1 on entry
.
// note that the returned indexes are relative to the first
index of
// the constraint.
int *findex;
};
virtual void buildJacobian() = 0; virtual void buildJacobian() = 0;
virtual void solveConstraint(btScalar timeStep) = 0; virtual void setupSolverConstraint(btConstraintArray& ca, int sol
verBodyA,int solverBodyB, btScalar timeStep)
{
}
virtual void getInfo1 (btConstraintInfo1* info)=0;
virtual void getInfo2 (btConstraintInfo2* info)=0;
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep) = 0;
btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppL
im, btScalar vel, btScalar timeFact);
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 117 skipping to change at line 160
btScalar getAppliedImpulse() const btScalar getAppliedImpulse() const
{ {
return m_appliedImpulse; return m_appliedImpulse;
} }
btTypedConstraintType getConstraintType () const btTypedConstraintType getConstraintType () const
{ {
return m_constraintType; return m_constraintType;
} }
void setDbgDrawSize(btScalar dbgDrawSize)
{
m_dbgDrawSize = dbgDrawSize;
}
btScalar getDbgDrawSize()
{
return m_dbgDrawSize;
}
}; };
#endif //TYPED_CONSTRAINT_H #endif //TYPED_CONSTRAINT_H
 End of changes. 7 change blocks. 
3 lines changed or deleted 70 lines changed or added


 btUnionFind.h   btUnionFind.h 
skipping to change at line 97 skipping to change at line 97
{ {
m_elements[j].m_id = i; m_elements[i].m_sz + = m_elements[j].m_sz; m_elements[j].m_id = i; m_elements[i].m_sz + = m_elements[j].m_sz;
} }
#else #else
m_elements[i].m_id = j; m_elements[j].m_sz += m_elem ents[i].m_sz; m_elements[i].m_id = j; m_elements[j].m_sz += m_elem ents[i].m_sz;
#endif //USE_PATH_COMPRESSION #endif //USE_PATH_COMPRESSION
} }
int find(int x) int find(int x)
{ {
//assert(x < m_N); //btAssert(x < m_N);
//assert(x >= 0); //btAssert(x >= 0);
while (x != m_elements[x].m_id) while (x != m_elements[x].m_id)
{ {
//not really a reason not to use path compression, and it fl attens the trees/improves find performance dramatically //not really a reason not to use path compression, and it fl attens the trees/improves find performance dramatically
#ifdef USE_PATH_COMPRESSION #ifdef USE_PATH_COMPRESSION
// //
m_elements[x].m_id = m_elements[m_elements[x ].m_id].m_id; m_elements[x].m_id = m_elements[m_elements[x ].m_id].m_id;
#endif // #endif //
x = m_elements[x].m_id; x = m_elements[x].m_id;
//assert(x < m_N); //btAssert(x < m_N);
//assert(x >= 0); //btAssert(x >= 0);
} }
return x; return x;
} }
}; };
#endif //UNION_FIND_H #endif //UNION_FIND_H
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 btVector3.h   btVector3.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 SIMD__VECTOR3_H #ifndef SIMD__VECTOR3_H
#define SIMD__VECTOR3_H #define SIMD__VECTOR3_H
#include "btQuadWord.h" #include "btScalar.h"
#include "btScalar.h"
#include "btMinMax.h"
/**@brief btVector3 can be used to represent 3D points and vectors. /**@brief btVector3 can be used to represent 3D points and vectors.
* It has an un-used w component to suit 16-byte alignment when btVector3 i s stored in containers. This extra component can be used by derived classes (Quaternion?) or by user * It has an un-used w component to suit 16-byte alignment when btVector3 i s stored in containers. This extra component can be used by derived classes (Quaternion?) or by user
* Ideally, this class should be replaced by a platform optimized SIMD vers ion that keeps the data in registers * Ideally, this class should be replaced by a platform optimized SIMD vers ion that keeps the data in registers
*/ */
class btVector3 : public btQuadWord {
ATTRIBUTE_ALIGNED16(class) btVector3
{
public: public:
/**@brief No initialization constructor */
SIMD_FORCE_INLINE btVector3() {}
/**@brief Constructor from btQuadWordStorage (btVector3 inherits from thi #if defined (__SPU__) && defined (__CELLOS_LV2__)
s so is also valid) union {
* Note: Vector3 derives from btQuadWordStorage*/ vec_float4 mVec128;
SIMD_FORCE_INLINE btVector3(const btQuadWordStorage& q) btScalar m_floats[4];
: btQuadWord(q) };
public:
vec_float4 get128() const
{ {
return mVec128;
} }
public:
#else //__CELLOS_LV2__ __SPU__
#ifdef BT_USE_SSE // WIN32
union {
__m128 mVec128;
btScalar m_floats[4];
};
SIMD_FORCE_INLINE __m128 get128() const
{
return mVec128;
}
SIMD_FORCE_INLINE void set128(__m128 v128)
{
mVec128 = v128;
}
#else
btScalar m_floats[4];
#endif
#endif //__CELLOS_LV2__ __SPU__
public:
/**@brief No initialization constructor */
SIMD_FORCE_INLINE btVector3() {}
/**@brief Constructor from scalars /**@brief Constructor from scalars
* @param x X value * @param x X value
* @param y Y value * @param y Y value
* @param z Z value * @param z Z value
*/ */
SIMD_FORCE_INLINE btVector3(const btScalar& x, const btScalar& y, co nst btScalar& z) SIMD_FORCE_INLINE btVector3(const btScalar& x, const btScalar& y, co nst btScalar& z)
:btQuadWord(x,y,z,btScalar(0.))
{ {
m_floats[0] = x;
m_floats[1] = y;
m_floats[2] = z;
m_floats[3] = btScalar(0.);
} }
// SIMD_FORCE_INLINE btVector3(const btScalar& x, const btScalar& y, co
nst btScalar& z,const btScalar& w)
// : btQuadWord(x,y,z,w)
// {
// }
/**@brief Add a vector to this one /**@brief Add a vector to this one
* @param The vector to add to this one */ * @param The vector to add to this one */
SIMD_FORCE_INLINE btVector3& operator+=(const btVector3& v) SIMD_FORCE_INLINE btVector3& operator+=(const btVector3& v)
{ {
m_floats[0] += v.x(); m_floats[1] += v.y(); m_floats[2] += v .z(); m_floats[0] += v.m_floats[0]; m_floats[1] += v.m_floats[1];m _floats[2] += v.m_floats[2];
return *this; return *this;
} }
/**@brief Subtract a vector from this one /**@brief Subtract a vector from this one
* @param The vector to subtract */ * @param The vector to subtract */
SIMD_FORCE_INLINE btVector3& operator-=(const btVector3& v) SIMD_FORCE_INLINE btVector3& operator-=(const btVector3& v)
{ {
m_floats[0] -= v.x(); m_floats[1] -= v.y(); m_floats[2] -= v .z(); m_floats[0] -= v.m_floats[0]; m_floats[1] -= v.m_floats[1];m _floats[2] -= v.m_floats[2];
return *this; return *this;
} }
/**@brief Scale the vector /**@brief Scale the vector
* @param s Scale factor */ * @param s Scale factor */
SIMD_FORCE_INLINE btVector3& operator*=(const btScalar& s) SIMD_FORCE_INLINE btVector3& operator*=(const btScalar& s)
{ {
m_floats[0] *= s; m_floats[1] *= s; m_floats[2] *= s; m_floats[0] *= s; m_floats[1] *= s;m_floats[2] *= s;
return *this; return *this;
} }
/**@brief Inversely scale the vector /**@brief Inversely scale the vector
* @param s Scale factor to divide by */ * @param s Scale factor to divide by */
SIMD_FORCE_INLINE btVector3& operator/=(const btScalar& s) SIMD_FORCE_INLINE btVector3& operator/=(const btScalar& s)
{ {
btFullAssert(s != btScalar(0.0)); btFullAssert(s != btScalar(0.0));
return *this *= btScalar(1.0) / s; return *this *= btScalar(1.0) / s;
} }
/**@brief Return the dot product /**@brief Return the dot product
* @param v The other vector in the dot product */ * @param v The other vector in the dot product */
SIMD_FORCE_INLINE btScalar dot(const btVector3& v) const SIMD_FORCE_INLINE btScalar dot(const btVector3& v) const
{ {
return m_floats[0] * v.x() + m_floats[1] * v.y() + m_floats[ 2] * v.z(); return m_floats[0] * v.m_floats[0] + m_floats[1] * v.m_float s[1] +m_floats[2] * v.m_floats[2];
} }
/**@brief Return the length of the vector squared */ /**@brief Return the length of the vector squared */
SIMD_FORCE_INLINE btScalar length2() const SIMD_FORCE_INLINE btScalar length2() const
{ {
return dot(*this); return dot(*this);
} }
/**@brief Return the length of the vector */ /**@brief Return the length of the vector */
SIMD_FORCE_INLINE btScalar length() const SIMD_FORCE_INLINE btScalar length() const
skipping to change at line 147 skipping to change at line 173
return btVector3( return btVector3(
btFabs(m_floats[0]), btFabs(m_floats[0]),
btFabs(m_floats[1]), btFabs(m_floats[1]),
btFabs(m_floats[2])); btFabs(m_floats[2]));
} }
/**@brief Return the cross product between this and another vector /**@brief Return the cross product between this and another vector
* @param v The other vector */ * @param v The other vector */
SIMD_FORCE_INLINE btVector3 cross(const btVector3& v) const SIMD_FORCE_INLINE btVector3 cross(const btVector3& v) const
{ {
return btVector3( return btVector3(
m_floats[1] * v.z() - m_floats[2] * v.y(), m_floats[1] * v.m_floats[2] -m_floats[2] * v.m_float
m_floats[2] * v.x() - m_floats[0] * v.z(), s[1],
m_floats[0] * v.y() - m_floats[1] * v.x()); m_floats[2] * v.m_floats[0] - m_floats[0] * v.m_floa
ts[2],
m_floats[0] * v.m_floats[1] - m_floats[1] * v.m_floa
ts[0]);
} }
SIMD_FORCE_INLINE btScalar triple(const btVector3& v1, const btVecto r3& v2) const SIMD_FORCE_INLINE btScalar triple(const btVector3& v1, const btVecto r3& v2) const
{ {
return m_floats[0] * (v1.y() * v2.z() - v1.z() * v2.y()) + return m_floats[0] * (v1.m_floats[1] * v2.m_floats[2] - v1.m
m_floats[1] * (v1.z() * v2.x() - v1.x() * v2.z()) + _floats[2] * v2.m_floats[1]) +
m_floats[2] * (v1.x() * v2.y() - v1.y() * v2.x()); m_floats[1] * (v1.m_floats[2] * v2.m_floats[0] - v1.
m_floats[0] * v2.m_floats[2]) +
m_floats[2] * (v1.m_floats[0] * v2.m_floats[1] - v1.
m_floats[1] * v2.m_floats[0]);
} }
/**@brief Return the axis with the smallest value /**@brief Return the axis with the smallest value
* Note return values are 0,1,2 for x, y, or z */ * Note return values are 0,1,2 for x, y, or z */
SIMD_FORCE_INLINE int minAxis() const SIMD_FORCE_INLINE int minAxis() const
{ {
return m_floats[0] < m_floats[1] ? (m_floats[0] < m_floats[2 ] ? 0 : 2) : (m_floats[1] < m_floats[2] ? 1 : 2); return m_floats[0] < m_floats[1] ? (m_floats[0] <m_floats[2] ? 0 : 2) : (m_floats[1] <m_floats[2] ? 1 : 2);
} }
/**@brief Return the axis with the largest value /**@brief Return the axis with the largest value
* Note return values are 0,1,2 for x, y, or z */ * Note return values are 0,1,2 for x, y, or z */
SIMD_FORCE_INLINE int maxAxis() const SIMD_FORCE_INLINE int maxAxis() const
{ {
return m_floats[0] < m_floats[1] ? (m_floats[1] < m_floats[2 ] ? 2 : 1) : (m_floats[0] < m_floats[2] ? 2 : 0); return m_floats[0] < m_floats[1] ? (m_floats[1] <m_floats[2] ? 2 : 1) : (m_floats[0] <m_floats[2] ? 2 : 0);
} }
SIMD_FORCE_INLINE int furthestAxis() const SIMD_FORCE_INLINE int furthestAxis() const
{ {
return absolute().minAxis(); return absolute().minAxis();
} }
SIMD_FORCE_INLINE int closestAxis() const SIMD_FORCE_INLINE int closestAxis() const
{ {
return absolute().maxAxis(); return absolute().maxAxis();
} }
SIMD_FORCE_INLINE void setInterpolate3(const btVector3& v0, const bt Vector3& v1, btScalar rt) SIMD_FORCE_INLINE void setInterpolate3(const btVector3& v0, const bt Vector3& v1, btScalar rt)
{ {
btScalar s = btScalar(1.0) - rt; btScalar s = btScalar(1.0) - rt;
m_floats[0] = s * v0.x() + rt * v1.x(); m_floats[0] = s * v0.m_floats[0] + rt * v1.m_floats[0];
m_floats[1] = s * v0.y() + rt * v1.y(); m_floats[1] = s * v0.m_floats[1] + rt * v1.m_floats[1];
m_floats[2] = s * v0.z() + rt * v1.z(); m_floats[2] = s * v0.m_floats[2] + rt * v1.m_floats[2];
//don't do the unused w component //don't do the unused w component
// m_co[3] = s * v0[3] + rt * v1[3]; // m_co[3] = s * v0[3] + rt * v1[3];
} }
/**@brief Return the linear interpolation between this and another vector /**@brief Return the linear interpolation between this and another vector
* @param v The other vector * @param v The other vector
* @param t The ration of this to v (t = 0 => return this, t=1 => return other) */ * @param t The ration of this to v (t = 0 => return this, t=1 => return other) */
SIMD_FORCE_INLINE btVector3 lerp(const btVector3& v, const btScalar& t) const SIMD_FORCE_INLINE btVector3 lerp(const btVector3& v, const btScalar& t) const
{ {
return btVector3(m_floats[0] + (v.x() - m_floats[0]) * t, return btVector3(m_floats[0] + (v.m_floats[0] - m_floats[0])
m_floats[1] + (v.y() - m_floats[1]) * t, * t,
m_floats[2] + (v.z() - m_floats[2]) * t); m_floats[1] + (v.m_floats[1] - m_floats[1]) * t,
m_floats[2] + (v.m_floats[2] -m_floats[2]) * t);
} }
/**@brief Elementwise multiply this vector by the other /**@brief Elementwise multiply this vector by the other
* @param v The other vector */ * @param v The other vector */
SIMD_FORCE_INLINE btVector3& operator*=(const btVector3& v) SIMD_FORCE_INLINE btVector3& operator*=(const btVector3& v)
{ {
m_floats[0] *= v.x(); m_floats[1] *= v.y(); m_floats[2] *= v .z(); m_floats[0] *= v.m_floats[0]; m_floats[1] *= v.m_floats[1];m _floats[2] *= v.m_floats[2];
return *this; return *this;
} }
/**@brief Return the x value */
SIMD_FORCE_INLINE const btScalar& getX() const { return m_fl
oats[0]; }
/**@brief Return the y value */
SIMD_FORCE_INLINE const btScalar& getY() const { return m_fl
oats[1]; }
/**@brief Return the z value */
SIMD_FORCE_INLINE const btScalar& getZ() const { return m_fl
oats[2]; }
/**@brief Set the x value */
SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x;}
;
/**@brief Set the y value */
SIMD_FORCE_INLINE void setY(btScalar y) { m_floats[1] = y;}
;
/**@brief Set the z value */
SIMD_FORCE_INLINE void setZ(btScalar z) {m_floats[2] = z;};
/**@brief Set the w value */
SIMD_FORCE_INLINE void setW(btScalar w) { m_floats[3] = w;}
;
/**@brief Return the x value */
SIMD_FORCE_INLINE const btScalar& x() const { return m_float
s[0]; }
/**@brief Return the y value */
SIMD_FORCE_INLINE const btScalar& y() const { return m_float
s[1]; }
/**@brief Return the z value */
SIMD_FORCE_INLINE const btScalar& z() const { return m_float
s[2]; }
/**@brief Return the w value */
SIMD_FORCE_INLINE const btScalar& w() const { return m_float
s[3]; }
//SIMD_FORCE_INLINE btScalar& operator[](int i) { return
(&m_floats[0])[i]; }
//SIMD_FORCE_INLINE const btScalar& operator[](int i) const { return
(&m_floats[0])[i]; }
///operator btScalar*() replaces operator[], using implicit conversi
on. We added operator != and operator == to avoid pointer comparisons.
SIMD_FORCE_INLINE operator btScalar *() { return &
m_floats[0]; }
SIMD_FORCE_INLINE operator const btScalar *() const { return &
m_floats[0]; }
SIMD_FORCE_INLINE bool operator==(const btVector3& other) c
onst
{
return ((m_floats[3]==other.m_floats[3]) && (m_floats[2]==ot
her.m_floats[2]) && (m_floats[1]==other.m_floats[1]) && (m_floats[0]==other
.m_floats[0]));
}
SIMD_FORCE_INLINE bool operator!=(const btVector3& other) c
onst
{
return !(*this == other);
}
/**@brief Set each element to the max of the current values and the
values of another btVector3
* @param other The other btVector3 to compare with
*/
SIMD_FORCE_INLINE void setMax(const btVector3& other)
{
btSetMax(m_floats[0], other.m_floats[0]);
btSetMax(m_floats[1], other.m_floats[1]);
btSetMax(m_floats[2], other.m_floats[2]);
btSetMax(m_floats[3], other.w());
}
/**@brief Set each element to the min of the current values and the value
s of another btVector3
* @param other The other btVector3 to compare with
*/
SIMD_FORCE_INLINE void setMin(const btVector3& other)
{
btSetMin(m_floats[0], other.m_floats[0]);
btSetMin(m_floats[1], other.m_floats[1]);
btSetMin(m_floats[2], other.m_floats[2]);
btSetMin(m_floats[3], other.w());
}
SIMD_FORCE_INLINE void setValue(const btScalar& x, const bt
Scalar& y, const btScalar& z)
{
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
m_floats[3] = 0.f;
}
void getSkewSymmetricMatrix(btVector3* v0,btVector3* v1,b
tVector3* v2) const
{
v0->setValue(0. ,-z() ,y());
v1->setValue(z() ,0. ,-x(
));
v2->setValue(-y() ,x() ,0.);
}
}; };
/**@brief Return the sum of two vectors (Point symantics)*/ /**@brief Return the sum of two vectors (Point symantics)*/
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator+(const btVector3& v1, const btVector3& v2) operator+(const btVector3& v1, const btVector3& v2)
{ {
return btVector3(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z()); return btVector3(v1.m_floats[0] + v2.m_floats[0], v1.m_floats[1] + v 2.m_floats[1], v1.m_floats[2] + v2.m_floats[2]);
} }
/**@brief Return the elementwise product of two vectors */ /**@brief Return the elementwise product of two vectors */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator*(const btVector3& v1, const btVector3& v2) operator*(const btVector3& v1, const btVector3& v2)
{ {
return btVector3(v1.x() * v2.x(), v1.y() * v2.y(), v1.z() * v2.z()); return btVector3(v1.m_floats[0] * v2.m_floats[0], v1.m_floats[1] * v 2.m_floats[1], v1.m_floats[2] * v2.m_floats[2]);
} }
/**@brief Return the difference between two vectors */ /**@brief Return the difference between two vectors */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator-(const btVector3& v1, const btVector3& v2) operator-(const btVector3& v1, const btVector3& v2)
{ {
return btVector3(v1.x() - v2.x(), v1.y() - v2.y(), v1.z() - v2.z()); return btVector3(v1.m_floats[0] - v2.m_floats[0], v1.m_floats[1] - v 2.m_floats[1], v1.m_floats[2] - v2.m_floats[2]);
} }
/**@brief Return the negative of the vector */ /**@brief Return the negative of the vector */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator-(const btVector3& v) operator-(const btVector3& v)
{ {
return btVector3(-v.x(), -v.y(), -v.z()); return btVector3(-v.m_floats[0], -v.m_floats[1], -v.m_floats[2]);
} }
/**@brief Return the vector scaled by s */ /**@brief Return the vector scaled by s */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator*(const btVector3& v, const btScalar& s) operator*(const btVector3& v, const btScalar& s)
{ {
return btVector3(v.x() * s, v.y() * s, v.z() * s); return btVector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s);
} }
/**@brief Return the vector scaled by s */ /**@brief Return the vector scaled by s */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator*(const btScalar& s, const btVector3& v) operator*(const btScalar& s, const btVector3& v)
{ {
return v * s; return v * s;
} }
/**@brief Return the vector inversely scaled by s */ /**@brief Return the vector inversely scaled by s */
skipping to change at line 266 skipping to change at line 367
operator/(const btVector3& v, const btScalar& s) operator/(const btVector3& v, const btScalar& s)
{ {
btFullAssert(s != btScalar(0.0)); btFullAssert(s != btScalar(0.0));
return v * (btScalar(1.0) / s); return v * (btScalar(1.0) / s);
} }
/**@brief Return the vector inversely scaled by s */ /**@brief Return the vector inversely scaled by s */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
operator/(const btVector3& v1, const btVector3& v2) operator/(const btVector3& v1, const btVector3& v2)
{ {
return btVector3(v1.x() / v2.x(),v1.y() / v2.y(),v1.z() / v2.z()); return btVector3(v1.m_floats[0] / v2.m_floats[0],v1.m_floats[1] / v2 .m_floats[1],v1.m_floats[2] / v2.m_floats[2]);
} }
/**@brief Return the dot product between two vectors */ /**@brief Return the dot product between two vectors */
SIMD_FORCE_INLINE btScalar SIMD_FORCE_INLINE btScalar
dot(const btVector3& v1, const btVector3& v2) dot(const btVector3& v1, const btVector3& v2)
{ {
return v1.dot(v2); return v1.dot(v2);
} }
/**@brief Return the distance squared between two vectors */ /**@brief Return the distance squared between two vectors */
skipping to change at line 320 skipping to change at line 421
/**@brief Return the linear interpolation between two vectors /**@brief Return the linear interpolation between two vectors
* @param v1 One vector * @param v1 One vector
* @param v2 The other vector * @param v2 The other vector
* @param t The ration of this to v (t = 0 => return v1, t=1 => return v2) */ * @param t The ration of this to v (t = 0 => return v1, t=1 => return v2) */
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
lerp(const btVector3& v1, const btVector3& v2, const btScalar& t) lerp(const btVector3& v1, const btVector3& v2, const btScalar& t)
{ {
return v1.lerp(v2, t); return v1.lerp(v2, t);
} }
/**@brief Test if each element of the vector is equivalent */
SIMD_FORCE_INLINE bool operator==(const btVector3& p1, const btVector3& p2)
{
return p1.x() == p2.x() && p1.y() == p2.y() && p1.z() == p2.z();
}
SIMD_FORCE_INLINE btScalar btVector3::distance2(const btVector3& v) const SIMD_FORCE_INLINE btScalar btVector3::distance2(const btVector3& v) const
{ {
return (v - *this).length2(); return (v - *this).length2();
} }
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();
} }
skipping to change at line 394 skipping to change at line 489
maxVal = m_floats[0]; maxVal = m_floats[0];
} }
if (m_floats[1] > maxVal) if (m_floats[1] > maxVal)
{ {
maxIndex = 1; maxIndex = 1;
maxVal = m_floats[1]; maxVal = m_floats[1];
} }
if (m_floats[2] > maxVal) if (m_floats[2] > maxVal)
{ {
maxIndex = 2; maxIndex = 2;
maxVal = m_floats[2]; maxVal =m_floats[2];
} }
if (m_floats[3] > maxVal) if (m_floats[3] > maxVal)
{ {
maxIndex = 3; maxIndex = 3;
maxVal = m_floats[3]; maxVal = m_floats[3];
} }
return maxIndex; return maxIndex;
} }
skipping to change at line 423 skipping to change at line 518
minVal = m_floats[0]; minVal = m_floats[0];
} }
if (m_floats[1] < minVal) if (m_floats[1] < minVal)
{ {
minIndex = 1; minIndex = 1;
minVal = m_floats[1]; minVal = m_floats[1];
} }
if (m_floats[2] < minVal) if (m_floats[2] < minVal)
{ {
minIndex = 2; minIndex = 2;
minVal = m_floats[2]; minVal =m_floats[2];
} }
if (m_floats[3] < minVal) if (m_floats[3] < minVal)
{ {
minIndex = 3; minIndex = 3;
minVal = m_floats[3]; minVal = m_floats[3];
} }
return minIndex; return minIndex;
} }
SIMD_FORCE_INLINE int closestAxis4() const SIMD_FORCE_INLINE int closestAxis4() const
{ {
return absolute4().maxAxis4(); return absolute4().maxAxis4();
} }
/**@brief Set x,y,z and zero w
* @param x Value of x
* @param y Value of y
* @param z Value of z
*/
/* void getValue(btScalar *m) const
{
m[0] = m_floats[0];
m[1] = m_floats[1];
m[2] =m_floats[2];
}
*/
/**@brief Set the values
* @param x Value of x
* @param y Value of y
* @param z Value of z
* @param w Value of w
*/
SIMD_FORCE_INLINE void setValue(const btScalar& x, const bt
Scalar& y, const btScalar& z,const btScalar& w)
{
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
m_floats[3]=w;
}
}; };
///btSwapVector3Endian swaps vector endianness, useful for network and cros s-platform serialization ///btSwapVector3Endian swaps vector endianness, useful for network and cros s-platform serialization
SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScal ar& destVal) SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScal ar& destVal)
{ {
#ifdef BT_USE_DOUBLE_PRECISION #ifdef BT_USE_DOUBLE_PRECISION
unsigned char* dest = (unsigned char*) &destVal; unsigned char* dest = (unsigned char*) &destVal;
unsigned char* src = (unsigned char*) &sourceVal; unsigned char* src = (unsigned char*) &sourceVal;
dest[0] = src[7]; dest[0] = src[7];
dest[1] = src[6]; dest[1] = src[6];
 End of changes. 32 change blocks. 
50 lines changed or deleted 202 lines changed or added


 gim_math.h   gim_math.h 
skipping to change at line 102 skipping to change at line 102
#define GIM_IS_NEGATIVE(value) (value <= -G_EPSILON) #define GIM_IS_NEGATIVE(value) (value <= -G_EPSILON)
#define GIM_IS_POSISITVE(value) (value >= G_EPSILON) #define GIM_IS_POSISITVE(value) (value >= G_EPSILON)
#define GIM_NEAR_EQUAL(v1,v2) GIM_IS_ZERO((v1-v2)) #define GIM_NEAR_EQUAL(v1,v2) GIM_IS_ZERO((v1-v2))
///returns a clamped number ///returns a clamped number
#define GIM_CLAMP(number,minval,maxval) (number<minval?minval:(number>maxva l?maxval:number)) #define GIM_CLAMP(number,minval,maxval) (number<minval?minval:(number>maxva l?maxval:number))
#define GIM_GREATER(x, y) fabsf(x) > (y) #define GIM_GREATER(x, y) btFabs(x) > (y)
///Swap numbers ///Swap numbers
#define GIM_SWAP_NUMBERS(a,b){ \ #define GIM_SWAP_NUMBERS(a,b){ \
a = a+b; \ a = a+b; \
b = a-b; \ b = a-b; \
a = a-b; \ a = a-b; \
}\ }\
#define GIM_INV_SQRT(va,isva)\ #define GIM_INV_SQRT(va,isva)\
{\ {\
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gim_tri_collision.h   gim_tri_collision.h 
skipping to change at line 270 skipping to change at line 270
if(u<-G_EPSILON) if(u<-G_EPSILON)
{ {
return false; return false;
} }
else if(v<-G_EPSILON) else if(v<-G_EPSILON)
{ {
return false; return false;
} }
else else
{ {
float sumuv; btScalar sumuv;
sumuv = u+v; sumuv = u+v;
if(sumuv<-G_EPSILON) if(sumuv<-G_EPSILON)
{ {
return false; return false;
} }
else if(sumuv-1.0f>G_EPSILON) else if(sumuv-1.0f>G_EPSILON)
{ {
return false; return false;
} }
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 rigidBodyArrayNode.h   rigidBodyArrayNode.h 
skipping to change at line 76 skipping to change at line 76
public: public:
std::vector<rigid_body_t::pointer>& rigid_bodies(); std::vector<rigid_body_t::pointer>& rigid_bodies();
public: public:
//Attributes //Attributes
static MObject ia_collisionShape; static MObject ia_collisionShape;
static MObject ia_solver; static MObject ia_solver;
static MObject ia_numBodies; static MObject ia_numBodies;
static MObject ia_active; //ia_active is obsolete and redundant -> use ia_mass == 0 for (ia_ac tive==false), and ia_mass > 0 for (ia_active == true)
static MObject ia_mass; static MObject ia_mass;
static MObject ia_restitution; static MObject ia_restitution;
static MObject ia_friction; static MObject ia_friction;
static MObject ia_linearDamping; static MObject ia_linearDamping;
static MObject ia_angularDamping; static MObject ia_angularDamping;
static MObject ia_initialPosition; static MObject ia_initialPosition;
static MObject ia_initialRotation; static MObject ia_initialRotation;
static MObject ia_initialVelocity; static MObject ia_initialVelocity;
static MObject ia_initialSpin; static MObject ia_initialSpin;
static MObject ia_fileIO; static MObject ia_fileIO;
static MObject ia_fioFiles; static MObject ia_fioFiles;
static MObject ia_fioPositionAttribute;
static MObject ia_fioRotationAttribute;
static MObject io_position; static MObject io_position;
static MObject io_rotation; static MObject io_rotation;
static MObject ca_rigidBodies; static MObject ca_rigidBodies;
static MObject ca_rigidBodyParam; static MObject ca_rigidBodyParam;
static MObject ca_solver;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
void update(); void update();
void computeRigidBodies(const MPlug& plug, MDataBlock& data); void computeRigidBodies(const MPlug& plug, MDataBlock& data);
void computeRigidBodyParam(const MPlug& plug, MDataBlock& data); void computeRigidBodyParam(const MPlug& plug, MDataBlock& data);
void computeWorldMatrix(const MPlug& plug, MDataBlock& data); void computeWorldMatrix(const MPlug& plug, MDataBlock& data);
 End of changes. 3 change blocks. 
3 lines changed or deleted 2 lines changed or added


 rigidBodyNode.h   rigidBodyNode.h 
skipping to change at line 70 skipping to change at line 70
public: public:
rigid_body_t::pointer rigid_body(); rigid_body_t::pointer rigid_body();
public: public:
//Attributes //Attributes
static MObject ia_collisionShape; static MObject ia_collisionShape;
static MObject ia_solver; static MObject ia_solver;
static MObject ia_active;
static MObject ia_mass; static MObject ia_mass;
static MObject ia_restitution; static MObject ia_restitution;
static MObject ia_friction; static MObject ia_friction;
static MObject ia_linearDamping; static MObject ia_linearDamping;
static MObject ia_angularDamping; static MObject ia_angularDamping;
static MObject ia_initialPosition; static MObject ia_initialPosition;
static MObject ia_initialRotation; static MObject ia_initialRotation;
static MObject ia_initialVelocity; static MObject ia_initialVelocity;
static MObject ia_initialSpin; static MObject ia_initialSpin;
static MObject ca_rigidBody; static MObject ca_rigidBody;
static MObject ca_rigidBodyParam; static MObject ca_rigidBodyParam;
static MObject ca_solver;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
void update(); void update();
void computeRigidBody(const MPlug& plug, MDataBlock& data); void computeRigidBody(const MPlug& plug, MDataBlock& data);
void computeWorldMatrix(const MPlug& plug, MDataBlock& data); void computeWorldMatrix(const MPlug& plug, MDataBlock& data);
void computeRigidBodyParam(const MPlug& plug, MDataBlock& data); void computeRigidBodyParam(const MPlug& plug, MDataBlock& data);
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/