BasicDemo.h   BasicDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 BASIC_DEMO_H #ifndef BASIC_DEMO_H
#define BASIC_DEMO_H #define BASIC_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
class btCollisionDispatcher; class btCollisionDispatcher;
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
///BasicDemo is good starting point for learning the code base and porting. ///BasicDemo is good starting point for learning the code base and porting.
class BasicDemo : public GlutDemoApplication
class BasicDemo : public PlatformDemoApplication
{ {
//keep the collision shapes, for deletion/cleanup //keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes; btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btBroadphaseInterface* m_broadphase; btBroadphaseInterface* m_broadphase;
btCollisionDispatcher* m_dispatcher; btCollisionDispatcher* m_dispatcher;
btConstraintSolver* m_solver; btConstraintSolver* m_solver;
 End of changes. 3 change blocks. 
1 lines changed or deleted 9 lines changed or added


 BenchmarkDemo.h   BenchmarkDemo.h 
skipping to change at line 34 skipping to change at line 34
class btRigidBody; class btRigidBody;
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
class btCollisionDispatcher; class btCollisionDispatcher;
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
#ifndef USE_GLUT_DEMO_APPLICATION #ifndef USE_GRAPHICAL_BENCHMARK
///empty placeholder ///empty placeholder
class DemoApplication class DemoApplication
{ {
protected: protected:
btDynamicsWorld* m_dynamicsWorld; btDynamicsWorld* m_dynamicsWorld;
btScalar m_defaultContactProcessingThreshold;
public: public:
DemoApplication()
:m_defaultContactProcessingThreshold(BT_LARGE_FLOAT)
{
}
virtual void myinit() {} virtual void myinit() {}
virtual btDynamicsWorld* getDynamicsWorld() virtual btDynamicsWorld* getDynamicsWorld()
{ {
return m_dynamicsWorld; return m_dynamicsWorld;
} }
btScalar getDeltaTimeMicroseconds() btScalar getDeltaTimeMicroseconds()
{ {
return 1.f; return 1.f;
} }
void renderme() {} void renderme() {}
void setCameraDistance(btScalar dist){} void setCameraDistance(btScalar dist){}
void clientResetScene(){} void clientResetScene(){}
btRigidBody* localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape); btRigidBody* localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape);
}; };
///BenchmarkDemo is provides several performance tests ///BenchmarkDemo is provides several performance tests
class BenchmarkDemo : public DemoApplication #define PlatformDemoApplication DemoApplication
#else //USE_GRAPHICAL_BENCHMARK
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else #else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
class BenchmarkDemo : public GlutDemoApplication #define PlatformDemoApplication GlutDemoApplication
#endif #endif
#endif //USE_GRAPHICAL_BENCHMARK
class BenchmarkDemo : public PlatformDemoApplication
{ {
//keep the collision shapes, for deletion/cleanup //keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes; btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btAlignedObjectArray<class RagDoll*> m_ragdolls; btAlignedObjectArray<class RagDoll*> m_ragdolls;
btBroadphaseInterface* m_overlappingPairCache; btBroadphaseInterface* m_overlappingPairCache;
btCollisionDispatcher* m_dispatcher; btCollisionDispatcher* m_dispatcher;
 End of changes. 6 change blocks. 
3 lines changed or deleted 17 lines changed or added


 Box.h   Box.h 
skipping to change at line 26 skipping to change at line 26
#ifndef __BOX_H__ #ifndef __BOX_H__
#define __BOX_H__ #define __BOX_H__
#ifndef PE_REF #ifndef PE_REF
#define PE_REF(a) a& #define PE_REF(a) a&
#endif #endif
#include <math.h> #include <math.h>
//#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h" ///only use a system-wide vectormath_aos.h on CELLOS_LV2 or if USE_SYSTEM_V
ECTORMATH
#if defined(__CELLOS_LV2__) || defined (USE_SYSTEM_VECTORMATH)
#include <vectormath_aos.h> #include <vectormath_aos.h>
#else
#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h"
#endif
using namespace Vectormath::Aos; using namespace Vectormath::Aos;
enum FeatureType { F, E, V }; enum FeatureType { F, E, V };
//------------------------------------------------------------------------- --- //------------------------------------------------------------------------- ---
// Box // Box
//------------------------------------------------------------------------- --- //------------------------------------------------------------------------- ---
///The Box is an internal class used by the boxBoxDistance calculation. ///The Box is an internal class used by the boxBoxDistance calculation.
class Box class Box
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 Box2dDemo.h   Box2dDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 BOX2D_DEMO_H #ifndef BOX2D_DEMO_H
#define BOX2D_DEMO_H #define BOX2D_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
class btCollisionDispatcher; class btCollisionDispatcher;
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
class GL_DialogDynamicsWorld;
///Box2dDemo is good starting point for learning the code base and porting. ///Box2dDemo is good starting point for learning the code base and porting.
class Box2dDemo : public GlutDemoApplication class Box2dDemo : public PlatformDemoApplication
{ {
//keep the collision shapes, for deletion/cleanup //keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes; btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btBroadphaseInterface* m_broadphase; btBroadphaseInterface* m_broadphase;
btCollisionDispatcher* m_dispatcher; btCollisionDispatcher* m_dispatcher;
btConstraintSolver* m_solver; btConstraintSolver* m_solver;
btDefaultCollisionConfiguration* m_collisionConfiguration; btDefaultCollisionConfiguration* m_collisionConfiguration;
GL_DialogDynamicsWorld* m_dialogDynamicsWorld;
public: public:
Box2dDemo() Box2dDemo() : m_dialogDynamicsWorld(0)
{ {
} }
virtual ~Box2dDemo() virtual ~Box2dDemo()
{ {
exitPhysics(); exitPhysics();
} }
virtual void reshape(int w, int h);
void initPhysics(); void initPhysics();
void exitPhysics(); void exitPhysics();
virtual void clientMoveAndDisplay(); virtual void clientMoveAndDisplay();
virtual void displayCallback(); virtual void displayCallback();
static DemoApplication* Create() static DemoApplication* Create()
{ {
Box2dDemo* demo = new Box2dDemo; Box2dDemo* demo = new Box2dDemo;
demo->myinit(); demo->myinit();
demo->initPhysics(); demo->initPhysics();
return demo; return demo;
} }
virtual void mouseFunc(int button, int state, int x, int y);
virtual void mouseMotionFunc(int x,int y);
}; };
#endif //BOX2D_DEMO_H #endif //BOX2D_DEMO_H
 End of changes. 8 change blocks. 
2 lines changed or deleted 18 lines changed or added


 CollisionInterfaceDemo.h   CollisionInterfaceDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 COLLISION_INTERFACE_DEMO_H #ifndef COLLISION_INTERFACE_DEMO_H
#define COLLISION_INTERFACE_DEMO_H #define COLLISION_INTERFACE_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
///CollisionInterfaceDemo shows how to use the collision detection without dynamics (btCollisionWorld/CollisionObject) ///CollisionInterfaceDemo shows how to use the collision detection without dynamics (btCollisionWorld/CollisionObject)
class CollisionInterfaceDemo : public GlutDemoApplication class CollisionInterfaceDemo : public PlatformDemoApplication
{ {
public: public:
void initPhysics(); void initPhysics();
virtual void clientMoveAndDisplay(); virtual void clientMoveAndDisplay();
virtual void displayCallback(); virtual void displayCallback();
virtual void clientResetScene(); virtual void clientResetScene();
 End of changes. 3 change blocks. 
1 lines changed or deleted 7 lines changed or added


 ConcaveDemo.h   ConcaveDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 CONCAVE_DEMO_H #ifndef CONCAVE_DEMO_H
#define CONCAVE_DEMO_H #define CONCAVE_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
class btCollisionDispatcher; class btCollisionDispatcher;
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
class btTriangleIndexVertexArray; class btTriangleIndexVertexArray;
///ConcaveDemo shows usage of static concave triangle meshes ///ConcaveDemo shows usage of static concave triangle meshes
///It also shows per-triangle material (friction/restitution) through Custo mMaterialCombinerCallback ///It also shows per-triangle material (friction/restitution) through Custo mMaterialCombinerCallback
class ConcaveDemo : public GlutDemoApplication class ConcaveDemo : public PlatformDemoApplication
{ {
//keep the collision shapes, for deletion/cleanup //keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes; btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btTriangleIndexVertexArray* m_indexVertexArrays; btTriangleIndexVertexArray* m_indexVertexArrays;
btBroadphaseInterface* m_broadphase; btBroadphaseInterface* m_broadphase;
btCollisionDispatcher* m_dispatcher; btCollisionDispatcher* m_dispatcher;
 End of changes. 3 change blocks. 
1 lines changed or deleted 8 lines changed or added


 ConstraintDemo.h   ConstraintDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 CONSTRAINT_DEMO_H #ifndef CONSTRAINT_DEMO_H
#define CONSTRAINT_DEMO_H #define CONSTRAINT_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
///ConstraintDemo shows how to create a constraint, like Hinge or btGeneric D6constraint ///ConstraintDemo shows how to create a constraint, like Hinge or btGeneric D6constraint
class ConstraintDemo : public GlutDemoApplication class ConstraintDemo : public PlatformDemoApplication
{ {
//keep track of variables to delete memory at the end //keep track of variables to delete memory at the end
btAlignedObjectArray<btCollisionShape*> m_collisionShapes; btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
class btBroadphaseInterface* m_overlappingPairCache; class btBroadphaseInterface* m_overlappingPairCache;
class btCollisionDispatcher* m_dispatcher; class btCollisionDispatcher* m_dispatcher;
class btConstraintSolver* m_constraintSolver; class btConstraintSolver* m_constraintSolver;
class btDefaultCollisionConfiguration* m_collisionConfiguration; class btDefaultCollisionConfiguration* m_collisionConfiguration;
void setupEmptyDynamicsWorld();
public: public:
virtual ~ConstraintDemo(); virtual ~ConstraintDemo();
void initPhysics(); void initPhysics();
void exitPhysics();
virtual void clientMoveAndDisplay(); virtual void clientMoveAndDisplay();
virtual void displayCallback(); virtual void displayCallback();
static DemoApplication* Create() static DemoApplication* Create()
{ {
ConstraintDemo* demo = new ConstraintDemo(); ConstraintDemo* demo = new ConstraintDemo();
demo->myinit(); demo->myinit();
demo->initPhysics(); demo->initPhysics();
return demo; return demo;
} }
virtual void keyboardCallback(unsigned char key, int x, int y);
// for cone-twist motor driving // for cone-twist motor driving
float m_Time; float m_Time;
class btConeTwistConstraint* m_ctc; class btConeTwistConstraint* m_ctc;
}; };
#endif //CONSTRAINT_DEMO_H #endif //CONSTRAINT_DEMO_H
 End of changes. 6 change blocks. 
1 lines changed or deleted 13 lines changed or added


 ConvexDecomposition.h   ConvexDecomposition.h 
skipping to change at line 39 skipping to change at line 39
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------*/ -----------------------------------------------------------------------*/
// http://codesuppository.blogspot.com // http://codesuppository.blogspot.com
// //
// mailto: jratcliff@infiniplex.net // mailto: jratcliff@infiniplex.net
// //
// http://www.amillionpixels.us // http://www.amillionpixels.us
// //
#ifdef WIN32 #ifdef _WIN32
#include <memory.h> //memcpy #include <memory.h> //memcpy
#endif #endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
extern unsigned int MAXDEPTH ; extern unsigned int MAXDEPTH ;
extern float CONCAVE_PERCENT ; extern float CONCAVE_PERCENT ;
extern float MERGE_PERCENT ; extern float MERGE_PERCENT ;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 ConvexDecompositionDemo.h   ConvexDecompositionDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 CONVEX_DECOMPOSITION_DEMO_H #ifndef CONVEX_DECOMPOSITION_DEMO_H
#define CONVEX_DECOMPOSITION_DEMO_H #define CONVEX_DECOMPOSITION_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
class btCollisionDispatcher; class btCollisionDispatcher;
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
class btTriangleMesh; class btTriangleMesh;
///ConvexDecompositionDemo shows automatic convex decomposition of a concav e mesh ///ConvexDecompositionDemo shows automatic convex decomposition of a concav e mesh
class ConvexDecompositionDemo : public GlutDemoApplication class ConvexDecompositionDemo : public PlatformDemoApplication
{ {
void setupEmptyDynamicsWorld();
public: public:
//keep the collision shapes, for deletion/cleanup //keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes; btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btAlignedObjectArray<btTriangleMesh*> m_trimeshes; btAlignedObjectArray<btTriangleMesh*> m_trimeshes;
btBroadphaseInterface* m_broadphase; btBroadphaseInterface* m_broadphase;
btCollisionDispatcher* m_dispatcher; btCollisionDispatcher* m_dispatcher;
 End of changes. 4 change blocks. 
1 lines changed or deleted 9 lines changed or added


 DemoApplication.h   DemoApplication.h 
skipping to change at line 93 skipping to change at line 93
bool m_singleStep; bool m_singleStep;
bool m_idle; bool m_idle;
int m_lastKey; int m_lastKey;
void showProfileInfo(int& xOffset,int& yStart, int yIncr); void showProfileInfo(int& xOffset,int& yStart, int 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;
btScalar m_defaultContactProcessingThreshold;
public: public:
DemoApplication(); DemoApplication();
virtual ~DemoApplication(); virtual ~DemoApplication();
btDynamicsWorld* getDynamicsWorld() btDynamicsWorld* getDynamicsWorld()
{ {
return m_dynamicsWorld; return m_dynamicsWorld;
skipping to change at line 149 skipping to change at line 150
void setCameraUp(const btVector3& camUp) void setCameraUp(const btVector3& camUp)
{ {
m_cameraUp = camUp; m_cameraUp = camUp;
} }
void setCameraForwardAxis(int axis) void setCameraForwardAxis(int axis)
{ {
m_forwardAxis = axis; m_forwardAxis = axis;
} }
void myinit(); virtual void myinit();
void toggleIdle(); void toggleIdle();
virtual void updateCamera(); virtual void updateCamera();
btVector3 getCameraPosition() btVector3 getCameraPosition()
{ {
return m_cameraPosition; return m_cameraPosition;
} }
btVector3 getCameraTargetPosition() btVector3 getCameraTargetPosition()
{ {
return m_cameraTargetPosition; return m_cameraTargetPosition;
} }
btScalar getDeltaTimeMicroseconds() btScalar getDeltaTimeMicroseconds()
{ {
#ifdef USE_BT_CLOCK #ifdef USE_BT_CLOCK
btScalar dt = m_clock.getTimeMicroseconds(); btScalar dt = (btScalar)m_clock.getTimeMicroseconds();
m_clock.reset(); m_clock.reset();
return dt; return dt;
#else #else
return btScalar(16666.); return btScalar(16666.);
#endif #endif
} }
///glut callbacks ///glut callbacks
float getCameraDistance(); float getCameraDistance();
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 GLDebugFont.h   GLDebugFont.h 
skipping to change at line 19 skipping to change at line 19
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 BT_DEBUG_FONT_H #ifndef BT_DEBUG_FONT_H
#define BT_DEBUG_FONT_H #define BT_DEBUG_FONT_H
#include "LinearMath/btVector3.h"
void GLDebugDrawStringInternal(int x,int y,const char* string,const btVec
tor3& rgb);
void GLDebugDrawString(int x,int y,const char* string); void GLDebugDrawString(int x,int y,const char* string);
void GLDebugResetFont(int screenWidth,int screenHeight); void GLDebugResetFont(int screenWidth,int screenHeight);
#endif //BT_DEBUG_FONT_H #endif //BT_DEBUG_FONT_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 GenericJointDemo.h   GenericJointDemo.h 
skipping to change at line 22 skipping to change at line 22
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.
Written by: Marten Svanfeldt Written by: Marten Svanfeldt
*/ */
#ifndef GENERIGJOINTDEMO_H #ifndef GENERIGJOINTDEMO_H
#define GENERIGJOINTDEMO_H #define GENERIGJOINTDEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "Ragdoll.h" #include "Ragdoll.h"
class GenericJointDemo : public GlutDemoApplication class GenericJointDemo : public PlatformDemoApplication
{ {
btAlignedObjectArray<class RagDoll*> m_ragdolls; btAlignedObjectArray<class RagDoll*> m_ragdolls;
public: public:
void initPhysics(); void initPhysics();
void spawnRagdoll(bool random = false); void spawnRagdoll(bool random = false);
virtual void clientMoveAndDisplay(); virtual void clientMoveAndDisplay();
 End of changes. 3 change blocks. 
1 lines changed or deleted 8 lines changed or added


 GimpactTestDemo.h   GimpactTestDemo.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 TEST_CONCAVE_DEMO_H #ifndef TEST_CONCAVE_DEMO_H
#define TEST_CONCAVE_DEMO_H #define TEST_CONCAVE_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
class btTriangleIndexVertexArray; class btTriangleIndexVertexArray;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
//#define BULLET_TRIANGLE_COLLISION 1 //#define BULLET_TRIANGLE_COLLISION 1
#define BULLET_GIMPACT 1 #define BULLET_GIMPACT 1
//#define BULLET_GIMPACT_CONVEX_DECOMPOSITION 1 //#define BULLET_GIMPACT_CONVEX_DECOMPOSITION 1
#define TEST_GIMPACT_TORUS #define TEST_GIMPACT_TORUS
#ifdef BULLET_GIMPACT #ifdef BULLET_GIMPACT
skipping to change at line 47 skipping to change at line 54
#include "BulletCollision/Gimpact/btConcaveConcaveCollisionAlgorithm.h" #include "BulletCollision/Gimpact/btConcaveConcaveCollisionAlgorithm.h"
#include "BulletCollision/Gimpact/btGIMPACTMeshShape.h" #include "BulletCollision/Gimpact/btGIMPACTMeshShape.h"
#endif #endif
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
///GimpactConcaveDemo shows usage of static concave triangle meshes ///GimpactConcaveDemo shows usage of static concave triangle meshes
///It also shows per-triangle material (friction/restitution) through Custo mMaterialCombinerCallback ///It also shows per-triangle material (friction/restitution) through Custo mMaterialCombinerCallback
class GimpactConcaveDemo : public GlutDemoApplication class GimpactConcaveDemo : public PlatformDemoApplication
{ {
public: public:
GimpactConcaveDemo() GimpactConcaveDemo()
: m_trimeshShape(NULL), : m_steps_done(0),
m_trimeshShape(NULL),
m_trimeshShape2(NULL), m_trimeshShape2(NULL),
m_indexVertexArrays(NULL), m_indexVertexArrays(NULL),
m_indexVertexArrays2(NULL), m_indexVertexArrays2(NULL),
m_collisionConfiguration(NULL),
m_dispatcher(NULL), kinematicTorus(NULL),
m_broadphase(NULL),
kinematicTorus(NULL), m_gimpactCollisionCreateFunc(NULL),
m_constraintSolver(NULL), m_collisionConfiguration(NULL),
m_gimpactCollisionCreateFunc(NULL),
m_steps_done(0) m_dispatcher(NULL),
m_broadphase(NULL),
m_constraintSolver(NULL)
{ {
} }
virtual ~GimpactConcaveDemo(); virtual ~GimpactConcaveDemo();
void initGImpactCollision(); void initGImpactCollision();
void initPhysics(); void initPhysics();
virtual void clientMoveAndDisplay(); virtual void clientMoveAndDisplay();
 End of changes. 5 change blocks. 
9 lines changed or deleted 20 lines changed or added


 GlutStuff.h   GlutStuff.h 
skipping to change at line 18 skipping to change at line 18
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 GLUT_STUFF_H #ifndef GLUT_STUFF_H
#define GLUT_STUFF_H #define GLUT_STUFF_H
#ifdef WIN32//for glut.h #ifdef _WIN32//for glut.h
#include <windows.h> #include <windows.h>
#endif #endif
//think different //think different
#if defined(__APPLE__) && !defined (VMDMESA) #if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/glu.h> #include <OpenGL/glu.h>
#include <GLUT/glut.h> #include <GLUT/glut.h>
#else #else
#include <GL/glut.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#include <windows.h> #include <windows.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif #else
#endif #include <GL/glut.h>
#endif //_WINDOWS
#endif //APPLE
#ifdef _WINDOWS
#define BT_ACTIVE_ALT VK_LMENU
#else
#define BT_KEY_K 'k' #define BT_KEY_K 'k'
#define BT_KEY_LEFT GLUT_KEY_LEFT #define BT_KEY_LEFT GLUT_KEY_LEFT
#define BT_KEY_RIGHT GLUT_KEY_RIGHT #define BT_KEY_RIGHT GLUT_KEY_RIGHT
#define BT_KEY_UP GLUT_KEY_UP #define BT_KEY_UP GLUT_KEY_UP
#define BT_KEY_DOWN GLUT_KEY_DOWN #define BT_KEY_DOWN GLUT_KEY_DOWN
#define BT_KEY_F1 GLUT_KEY_F1 #define BT_KEY_F1 GLUT_KEY_F1
#define BT_KEY_F2 GLUT_KEY_F2 #define BT_KEY_F2 GLUT_KEY_F2
#define BT_KEY_F3 GLUT_KEY_F3 #define BT_KEY_F3 GLUT_KEY_F3
#define BT_KEY_F4 GLUT_KEY_F4 #define BT_KEY_F4 GLUT_KEY_F4
#define BT_KEY_F5 GLUT_KEY_F5 #define BT_KEY_F5 GLUT_KEY_F5
#define BT_KEY_PAGEUP GLUT_KEY_PAGE_UP #define BT_KEY_PAGEUP GLUT_KEY_PAGE_UP
#define BT_KEY_PAGEDOWN GLUT_KEY_PAGE_DOWN #define BT_KEY_PAGEDOWN GLUT_KEY_PAGE_DOWN
#define BT_KEY_END GLUT_KEY_END #define BT_KEY_END GLUT_KEY_END
#define BT_KEY_HOME GLUT_KEY_HOME #define BT_KEY_HOME GLUT_KEY_HOME
#define BT_ACTIVE_ALT GLUT_ACTIVE_ALT #define BT_ACTIVE_ALT GLUT_ACTIVE_ALT
#define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT #define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT
#define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT #define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT
#endif
#if BT_USE_FREEGLUT #if BT_USE_FREEGLUT
#include "GL/freeglut_ext.h" //to be able to return from glutMainLoop() #include "GL/freeglut_ext.h" //to be able to return from glutMainLoop()
#endif #endif
class DemoApplication; class DemoApplication;
int glutmain(int argc, char **argv,int width,int height,const char* title,D emoApplication* demoApp); int glutmain(int argc, char **argv,int width,int height,const char* title,D emoApplication* demoApp);
#if defined(BT_USE_DOUBLE_PRECISION) #if defined(BT_USE_DOUBLE_PRECISION)
 End of changes. 5 change blocks. 
4 lines changed or deleted 10 lines changed or added


 MiniCLTask.h   MiniCLTask.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 MINICL__TASK_H #ifndef MINICL__TASK_H
#define MINICL__TASK_H #define MINICL__TASK_H
#include "../PlatformDefinitions.h" #include "BulletMultiThreaded/PlatformDefinitions.h"
#include "LinearMath/btScalar.h" #include "LinearMath/btScalar.h"
#include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btAlignedAllocator.h"
enum #define MINICL_MAX_ARGLENGTH (sizeof(void*))
{ #define MINI_CL_MAX_ARG 16
CMD_MINICL_1= 1, #define MINI_CL_MAX_KERNEL_NAME 256
CMD_MINICL_ADDVECTOR
};
struct float8
{
float s0;
float s1;
float s2;
float s3;
float s4;
float s5;
float s6;
float s7;
float8(float scalar)
{
s0=s1=s2=s3=s4=s5=s6=s7=scalar;
}
};
#define MINICL_MAX_ARGLENGTH 128 struct MiniCLKernel;
#define MINI_CL_MAX_ARG 8
ATTRIBUTE_ALIGNED16(struct) MiniCLTaskDesc ATTRIBUTE_ALIGNED16(struct) MiniCLTaskDesc
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
MiniCLTaskDesc() MiniCLTaskDesc()
{ {
for (int i=0;i<MINI_CL_MAX_ARG;i++) for (int i=0;i<MINI_CL_MAX_ARG;i++)
{ {
m_argSizes[i]=0; m_argSizes[i]=0;
} }
} }
uint32_t m_taskId; uint32_t m_taskId;
uint32_t m_kernelProgramId; uint32_t m_firstWorkUnit;
uint32_t m_firstWorkUnit; uint32_t m_lastWorkUnit;
uint32_t m_lastWorkUnit;
char m_argData[MINI_CL_MAX_ARG][MINICL_MAX_ARGLENGTH]; MiniCLKernel* m_kernel;
int m_argSizes[MINI_CL_MAX_ARG];
void* m_argData[MINI_CL_MAX_ARG];
int m_argSizes[MINI_CL_MAX_ARG];
}; };
extern "C" int gMiniCLNumOutstandingTasks;
void processMiniCLTask(void* userPtr, void* lsMemory); void processMiniCLTask(void* userPtr, void* lsMemory);
void* createMiniCLLocalStoreMemory(); void* createMiniCLLocalStoreMemory();
#endif //MINICL__TASK_H #endif //MINICL__TASK_H
 End of changes. 7 change blocks. 
31 lines changed or deleted 14 lines changed or added


 MiniCLTaskScheduler.h   MiniCLTaskScheduler.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 MINICL_TASK_SCHEDULER_H #ifndef MINICL_TASK_SCHEDULER_H
#define MINICL_TASK_SCHEDULER_H #define MINICL_TASK_SCHEDULER_H
#include <assert.h> #include <assert.h>
#include "PlatformDefinitions.h" #include "BulletMultiThreaded/PlatformDefinitions.h"
#include <stdlib.h> #include <stdlib.h>
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "MiniCLTask/MiniCLTask.h" #include "MiniCLTask/MiniCLTask.h"
//just add your commands here, try to keep them globally unique for debuggi ng purposes //just add your commands here, try to keep them globally unique for debuggi ng purposes
#define CMD_SAMPLE_TASK_COMMAND 10 #define CMD_SAMPLE_TASK_COMMAND 10
struct MiniCLKernel;
/// MiniCLTaskScheduler handles SPU processing of collision pairs. /// MiniCLTaskScheduler handles SPU processing of collision pairs.
/// When PPU issues a task, it will look for completed task buffers /// When PPU issues a task, it will look for completed task buffers
/// PPU will do postprocessing, dependent on workunit output (not likely) /// PPU will do postprocessing, dependent on workunit output (not likely)
class MiniCLTaskScheduler class MiniCLTaskScheduler
{ {
// track task buffers that are being used, and total busy tasks // track task buffers that are being used, and total busy tasks
btAlignedObjectArray<bool> m_taskBusy; btAlignedObjectArray<bool> m_taskBusy;
btAlignedObjectArray<MiniCLTaskDesc> m_spuSampleTaskDesc; btAlignedObjectArray<MiniCLTaskDesc> m_spuSampleTaskDesc;
btAlignedObjectArray<const MiniCLKernel*> m_kernels;
int m_numBusyTasks; int m_numBusyTasks;
// the current task and the current entry to insert a new work unit // the current task and the current entry to insert a new work unit
int m_currentTask; int m_currentTask;
bool m_initialized; bool m_initialized;
void postProcess(int taskId, int outputSize); void postProcess(int taskId, int outputSize);
class btThreadSupportInterface* m_threadInterface; class btThreadSupportInterface* m_threadInterface;
skipping to change at line 62 skipping to change at line 66
int m_maxNumOutstandingTasks; int m_maxNumOutstandingTasks;
public: public:
MiniCLTaskScheduler(btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks); MiniCLTaskScheduler(btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks);
~MiniCLTaskScheduler(); ~MiniCLTaskScheduler();
///call initialize in the beginning of the frame, before addCollisio nPairToTask ///call initialize in the beginning of the frame, before addCollisio nPairToTask
void initialize(); void initialize();
void issueTask(int firstWorkUnit, int lastWorkUnit,int kernelProgram Id,char* argData,int* argSizes); void issueTask(int firstWorkUnit, int lastWorkUnit, MiniCLKernel* ke rnel);
///call flush to submit potential outstanding work to SPUs and wait for all involved SPUs to be finished ///call flush to submit potential outstanding work to SPUs and wait for all involved SPUs to be finished
void flush(); void flush();
class btThreadSupportInterface* getThreadSupportInterface() class btThreadSupportInterface* getThreadSupportInterface()
{ {
return m_threadInterface; return m_threadInterface;
} }
int findProgramCommandIdByName(const char* programName) const int findProgramCommandIdByName(const char* programName) const;
{
return CMD_MINICL_ADDVECTOR;//hardcoded temp value, todo: im
plement multi-program support
}
int getMaxNumOutstandingTasks() const int getMaxNumOutstandingTasks() const
{ {
return m_maxNumOutstandingTasks; return m_maxNumOutstandingTasks;
} }
void registerKernel(MiniCLKernel* kernel)
{
m_kernels.push_back(kernel);
}
}; };
typedef void (*kernelLauncherCB)(MiniCLTaskDesc* taskDesc, int guid);
struct MiniCLKernel struct MiniCLKernel
{ {
MiniCLTaskScheduler* m_scheduler; MiniCLTaskScheduler* m_scheduler;
int m_kernelProgramCommandId; // int m_kernelProgramCommandId;
char m_argData[MINI_CL_MAX_ARG][MINICL_MAX_ARGLENGTH]; char m_name[MINI_CL_MAX_KERNEL_NAME];
unsigned int m_numArgs;
kernelLauncherCB m_launcher;
void* m_pCode;
void updateLauncher();
MiniCLKernel* registerSelf();
void* m_argData[MINI_CL_MAX_ARG];
int m_argSizes[MINI_CL_MAX_ARG]; int m_argSizes[MINI_CL_MAX_ARG];
}; };
#if defined(USE_LIBSPE2) && defined(__SPU__) #if defined(USE_LIBSPE2) && defined(__SPU__)
////////////////////MAIN///////////////////////////// ////////////////////MAIN/////////////////////////////
#include "../SpuLibspe2Support.h" #include "../SpuLibspe2Support.h"
#include <spu_intrinsics.h> #include <spu_intrinsics.h>
#include <spu_mfcio.h> #include <spu_mfcio.h>
#include <SpuFakeDma.h> #include <SpuFakeDma.h>
 End of changes. 9 change blocks. 
9 lines changed or deleted 23 lines changed or added


 PlatformDefinitions.h   PlatformDefinitions.h 
#ifndef TYPE_DEFINITIONS_H #ifndef TYPE_DEFINITIONS_H
#define TYPE_DEFINITIONS_H #define TYPE_DEFINITIONS_H
///This file provides some platform/compiler checks for common definitions ///This file provides some platform/compiler checks for common definitions
#ifdef WIN32 #ifdef _WIN32
typedef union typedef union
{ {
unsigned int u; unsigned int u;
void *p; void *p;
} addr64; } addr64;
#define USE_WIN32_THREADING 1 #define USE_WIN32_THREADING 1
#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)
#else #else
#endif //__MINGW32__ #endif //__MINGW32__
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
#ifndef __PHYSICS_COMMON_H__ #ifndef __PHYSICS_COMMON_H__
#ifndef __BT_SKIP_UINT64_H
typedef unsigned long int uint64_t; typedef unsigned long int uint64_t;
#endif //__BT_SKIP_UINT64_H
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
#endif //__PHYSICS_COMMON_H__ #endif //__PHYSICS_COMMON_H__
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
#include <malloc.h> #include <malloc.h>
#define memalign(alignment, size) malloc(size); #define memalign(alignment, size) malloc(size);
#include <string.h> //memcpy #include <string.h> //memcpy
#include <stdio.h> #include <stdio.h>
 End of changes. 3 change blocks. 
1 lines changed or deleted 3 lines changed or added


 PpuAddressSpace.h   PpuAddressSpace.h 
#ifndef __PPU_ADDRESS_SPACE_H #ifndef __PPU_ADDRESS_SPACE_H
#define __PPU_ADDRESS_SPACE_H #define __PPU_ADDRESS_SPACE_H
#ifdef WIN32 #ifdef _WIN32
//stop those casting warnings until we have a better solution for ppu_addre ss_t / void* / uint64 conversions //stop those casting warnings until we have a better solution for ppu_addre ss_t / void* / uint64 conversions
#pragma warning (disable: 4311) #pragma warning (disable: 4311)
#pragma warning (disable: 4312) #pragma warning (disable: 4312)
#endif //WIN32 #endif //_WIN32
#if defined(_WIN64) || defined(__LP64__) || defined(__x86_64__) || defined( USE_ADDR64) #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64__) || defined( USE_ADDR64)
typedef uint64_t ppu_address_t; typedef uint64_t ppu_address_t;
#else #else
typedef uint32_t ppu_address_t; typedef uint32_t ppu_address_t;
#endif #endif
#endif #endif
 End of changes. 4 change blocks. 
2 lines changed or deleted 4 lines changed or added


 RenderTexture.h   RenderTexture.h 
skipping to change at line 36 skipping to change at line 36
{ {
int m_height; int m_height;
int m_width; int m_width;
unsigned char* m_buffer; unsigned char* m_buffer;
public: public:
renderTexture(int width,int height); renderTexture(int width,int height);
~renderTexture(); ~renderTexture();
///rgba input is in range [0..1] for each component
inline void setPixel(int x,int y,const btVector4& rgba) inline void setPixel(int x,int y,const btVector4& rgba)
{ {
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4]; unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
pixel[0] = (unsigned char)(255*rgba.getX()); pixel[0] = (unsigned char)(255.*rgba.getX());
pixel[1] = (unsigned char)(255*rgba.getY()); pixel[1] = (unsigned char)(255.*rgba.getY());
pixel[2] = (unsigned char)(255*rgba.getZ()); pixel[2] = (unsigned char)(255.*rgba.getZ());
pixel[3] = (unsigned char)(255*rgba.getW()); pixel[3] = (unsigned char)(255.*rgba.getW());
}
inline void addPixel(int x,int y,const btVector4& rgba)
{
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
pixel[0] = (unsigned char)btMin(btScalar(255.f),((btScalar)p
ixel[0] + btScalar(255.f)*rgba.getX()));
pixel[1] = (unsigned char)btMin(btScalar(255.f),((btScalar)p
ixel[1] + btScalar(255.f)*rgba.getY()));
pixel[2] = (unsigned char)btMin(btScalar(255.f),((btScalar)p
ixel[2] + btScalar(255.f)*rgba.getZ()));
// pixel[3] = (unsigned char)btMin(btScalar(255.f),((btScalar)p
ixel[3] + btScalar(255.f)*rgba.getW()));
} }
inline btVector4 getPixel(int x,int y) inline btVector4 getPixel(int x,int y)
{ {
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4]; unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
return btVector4(pixel[0]*1.f/255.f, return btVector4(pixel[0]*1.f/255.f,
pixel[1]*1.f/255.f, pixel[1]*1.f/255.f,
pixel[2]*1.f/255.f, pixel[2]*1.f/255.f,
pixel[3]*1.f/255.f); pixel[3]*1.f/255.f);
} }
 End of changes. 2 change blocks. 
4 lines changed or deleted 18 lines changed or added


 SliderConstraintDemo.h   SliderConstraintDemo.h 
skipping to change at line 60 skipping to change at line 60
virtual void displayCallback(); virtual void displayCallback();
static DemoApplication* Create() static DemoApplication* Create()
{ {
SliderConstraintDemo* demo = new SliderConstraintDemo(); SliderConstraintDemo* demo = new SliderConstraintDemo();
demo->myinit(); demo->myinit();
demo->initPhysics(); demo->initPhysics();
return demo; return demo;
} }
virtual void keyboardCallback(unsigned char key, int x, int y);
}; };
#endif //SLIDER_CONSTRAINT_DEMO_H #endif //SLIDER_CONSTRAINT_DEMO_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 SoftDemo.h   SoftDemo.h 
skipping to change at line 22 skipping to change at line 22
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.
*/ */
///btSoftBody implementation by Nathanael Presson ///btSoftBody implementation by Nathanael Presson
#ifndef SOFT_DEMO_H #ifndef SOFT_DEMO_H
#define SOFT_DEMO_H #define SOFT_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "BulletSoftBody/btSoftBody.h" #include "BulletSoftBody/btSoftBody.h"
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
class btCollisionDispatcher; class btCollisionDispatcher;
class btConstraintSolver; class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
///collisions between two btSoftBody's ///collisions between two btSoftBody's
class btSoftSoftCollisionAlgorithm; class btSoftSoftCollisionAlgorithm;
///collisions between a btSoftBody and a btRigidBody ///collisions between a btSoftBody and a btRigidBody
class btSoftRididCollisionAlgorithm; class btSoftRididCollisionAlgorithm;
class btSoftRigidDynamicsWorld; class btSoftRigidDynamicsWorld;
///CcdPhysicsDemo shows basic stacking using Bullet physics, and allows tog gle of Ccd (using key '1') ///CcdPhysicsDemo shows basic stacking using Bullet physics, and allows tog gle of Ccd (using key '1')
class SoftDemo : public GlutDemoApplication class SoftDemo : public PlatformDemoApplication
{ {
public: public:
btAlignedObjectArray<btSoftSoftCollisionAlgorithm*> m_SoftSoftCollis ionAlgorithms; btAlignedObjectArray<btSoftSoftCollisionAlgorithm*> m_SoftSoftCollis ionAlgorithms;
btAlignedObjectArray<btSoftRididCollisionAlgorithm*> m_SoftRigidColl isionAlgorithms; btAlignedObjectArray<btSoftRididCollisionAlgorithm*> m_SoftRigidColl isionAlgorithms;
btSoftBodyWorldInfo m_softBodyWorldInfo; btSoftBodyWorldInfo m_softBodyWorldInfo;
bool m_au tocam; bool m_au tocam;
 End of changes. 3 change blocks. 
1 lines changed or deleted 7 lines changed or added


 SphereTriangleDetector.h   SphereTriangleDetector.h 
skipping to change at line 33 skipping to change at line 33
/// sphere-triangle to match the btDiscreteCollisionDetectorInterface /// sphere-triangle to match the btDiscreteCollisionDetectorInterface
struct SphereTriangleDetector : public btDiscreteCollisionDetectorInterface struct SphereTriangleDetector : public btDiscreteCollisionDetectorInterface
{ {
virtual void getClosestPoints(const ClosestPointInput& input,Resu lt& output,class btIDebugDraw* debugDraw,bool swapResults=false); virtual void getClosestPoints(const ClosestPointInput& input,Resu lt& output,class btIDebugDraw* debugDraw,bool swapResults=false);
SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triang le, btScalar contactBreakingThreshold); SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triang le, btScalar contactBreakingThreshold);
virtual ~SphereTriangleDetector() {}; virtual ~SphereTriangleDetector() {};
bool collide(const btVector3& sphereCenter,btVector3 &point, btVecto
r3& resultNormal, btScalar& depth, btScalar &timeOfImpact, btScalar contact
BreakingThreshold);
private: private:
bool collide(const btVector3& sphereCenter,btVector3 &point, btVecto r3& resultNormal, btScalar& depth, btScalar &timeOfImpact, btScalar contact BreakingThreshold);
bool pointInTriangle(const btVector3 vertices[], const btVector3 &no rmal, btVector3 *p ); bool pointInTriangle(const btVector3 vertices[], const btVector3 &no rmal, btVector3 *p );
bool facecontains(const btVector3 &p,const btVector3* vertices,btVec tor3& normal); bool facecontains(const btVector3 &p,const btVector3* vertices,btVec tor3& normal);
btSphereShape* m_sphere; btSphereShape* m_sphere;
btTriangleShape* m_triangle; btTriangleShape* m_triangle;
btScalar m_contactBreakingThreshold; btScalar m_contactBreakingThreshold;
}; };
#endif //SPHERE_TRIANGLE_DETECTOR_H #endif //SPHERE_TRIANGLE_DETECTOR_H
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 SpuCollisionShapes.h   SpuCollisionShapes.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 __SPU_COLLISION_SHAPES_H #ifndef __SPU_COLLISION_SHAPES_H
#define __SPU_COLLISION_SHAPES_H #define __SPU_COLLISION_SHAPES_H
#include "../SpuDoubleBuffer.h" #include "../SpuDoubleBuffer.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionShapes/btConvexInternalShape.h" #include "BulletCollision/CollisionShapes/btConvexInternalShape.h"
#include "BulletCollision/CollisionShapes/btCylinderShape.h" #include "BulletCollision/CollisionShapes/btCylinderShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
#include "BulletCollision/CollisionShapes/btOptimizedBvh.h" #include "BulletCollision/CollisionShapes/btOptimizedBvh.h"
#include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h" #include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h" #include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btCapsuleShape.h" #include "BulletCollision/CollisionShapes/btCapsuleShape.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h" #include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" #include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btConvexHullShape.h" #include "BulletCollision/CollisionShapes/btConvexHullShape.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 SpuCollisionTaskProcess.h   SpuCollisionTaskProcess.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 SPU_COLLISION_TASK_PROCESS_H #ifndef SPU_COLLISION_TASK_PROCESS_H
#define SPU_COLLISION_TASK_PROCESS_H #define SPU_COLLISION_TASK_PROCESS_H
#include <assert.h> #include <assert.h>
#include <LinearMath/btScalar.h> #include "LinearMath/btScalar.h"
#include "PlatformDefinitions.h" #include "PlatformDefinitions.h"
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h" // for d efinitions processCollisionTask and createCollisionLocalStoreMemory #include "SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h" // for d efinitions processCollisionTask and createCollisionLocalStoreMemory
#include "btThreadSupportInterface.h" #include "btThreadSupportInterface.h"
//#include "SPUAssert.h" //#include "SPUAssert.h"
#include <string.h> #include <string.h>
#include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h" #include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h" #include "BulletCollision/CollisionShapes/btConvexShape.h"
#include <LinearMath/btAlignedAllocator.h> #include "LinearMath/btAlignedAllocator.h"
#include <stdio.h> #include <stdio.h>
#define DEBUG_SpuCollisionTaskProcess 1 #define DEBUG_SpuCollisionTaskProcess 1
#define CMD_GATHER_AND_PROCESS_PAIRLIST 1 #define CMD_GATHER_AND_PROCESS_PAIRLIST 1
class btCollisionObject; class btCollisionObject;
class btPersistentManifold; class btPersistentManifold;
class btDispatcher; class btDispatcher;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 SpuContactResult.h   SpuContactResult.h 
skipping to change at line 19 skipping to change at line 19
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 SPU_CONTACT_RESULT2_H #ifndef SPU_CONTACT_RESULT2_H
#define SPU_CONTACT_RESULT2_H #define SPU_CONTACT_RESULT2_H
#ifndef WIN32 #ifndef _WIN32
#include <stdint.h> #include <stdint.h>
#endif #endif
#include "../SpuDoubleBuffer.h" #include "../SpuDoubleBuffer.h"
#include "LinearMath/btTransform.h" #include "LinearMath/btTransform.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorI nterface.h" #include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorI nterface.h"
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 SpuConvexPenetrationDepthSolver.h   SpuConvexPenetrationDepthSolver.h 
skipping to change at line 24 skipping to change at line 24
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 SPU_CONVEX_PENETRATION_DEPTH_H #ifndef SPU_CONVEX_PENETRATION_DEPTH_H
#define SPU_CONVEX_PENETRATION_DEPTH_H #define SPU_CONVEX_PENETRATION_DEPTH_H
class btStackAlloc; class btStackAlloc;
class btIDebugDraw; class btIDebugDraw;
#include "BulletCollision/NarrowphaseCollision/btConvexPenetrationDepthSolv er.h" #include "BulletCollision/NarrowphaseCollision/btConvexPenetrationDepthSolv er.h"
#include <LinearMath/btTransform.h> #include "LinearMath/btTransform.h"
///ConvexPenetrationDepthSolver provides an interface for penetration depth calculation. ///ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
class SpuConvexPenetrationDepthSolver : public btConvexPenetrationDepthSolv er class SpuConvexPenetrationDepthSolver : public btConvexPenetrationDepthSolv er
{ {
public: public:
virtual ~SpuConvexPenetrationDepthSolver() {}; virtual ~SpuConvexPenetrationDepthSolver() {};
virtual bool calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver, virtual bool calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver,
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 SpuDoubleBuffer.h   SpuDoubleBuffer.h 
#ifndef DOUBLE_BUFFER_H #ifndef DOUBLE_BUFFER_H
#define DOUBLE_BUFFER_H #define DOUBLE_BUFFER_H
#include "SpuFakeDma.h" #include "SpuFakeDma.h"
#include <LinearMath/btScalar.h> #include "LinearMath/btScalar.h"
///DoubleBuffer ///DoubleBuffer
template<class T, int size> template<class T, int size>
class DoubleBuffer class DoubleBuffer
{ {
#if defined(__SPU__) || defined(USE_LIBSPE2) #if defined(__SPU__) || defined(USE_LIBSPE2)
ATTRIBUTE_ALIGNED128( T m_buffer0[size] ) ; ATTRIBUTE_ALIGNED128( T m_buffer0[size] ) ;
ATTRIBUTE_ALIGNED128( T m_buffer1[size] ) ; ATTRIBUTE_ALIGNED128( T m_buffer1[size] ) ;
#else #else
T m_buffer0[size]; T m_buffer0[size];
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 SpuGatheringCollisionDispatcher.h   SpuGatheringCollisionDispatcher.h 
skipping to change at line 25 skipping to change at line 25
#ifndef SPU_GATHERING_COLLISION__DISPATCHER_H #ifndef SPU_GATHERING_COLLISION__DISPATCHER_H
#define SPU_GATHERING_COLLISION__DISPATCHER_H #define SPU_GATHERING_COLLISION__DISPATCHER_H
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
///Tuning value to optimized SPU utilization ///Tuning value to optimized SPU utilization
///Too small value means Task overhead is large compared to computation (to o fine granularity) ///Too small value means Task overhead is large compared to computation (to o fine granularity)
///Too big value might render some SPUs are idle, while a few other SPUs ar e doing all work. ///Too big value might render some SPUs are idle, while a few other SPUs ar e doing all work.
//#define SPU_BATCHSIZE_BROADPHASE_PAIRS 8 //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 8
//#define SPU_BATCHSIZE_BROADPHASE_PAIRS 16 //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 16
#define SPU_BATCHSIZE_BROADPHASE_PAIRS 64 //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 64
//#define SPU_BATCHSIZE_BROADPHASE_PAIRS 128 #define SPU_BATCHSIZE_BROADPHASE_PAIRS 128
//#define SPU_BATCHSIZE_BROADPHASE_PAIRS 256 //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 256
//#define SPU_BATCHSIZE_BROADPHASE_PAIRS 512
//#define SPU_BATCHSIZE_BROADPHASE_PAIRS 1024 //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 1024
class SpuCollisionTaskProcess; class SpuCollisionTaskProcess;
///SpuGatheringCollisionDispatcher can use SPU to gather and calculate coll ision detection ///SpuGatheringCollisionDispatcher can use SPU to gather and calculate coll ision detection
///Time of Impact, Closest Points and Penetration Depth. ///Time of Impact, Closest Points and Penetration Depth.
class SpuGatheringCollisionDispatcher : public btCollisionDispatcher class SpuGatheringCollisionDispatcher : public btCollisionDispatcher
{ {
SpuCollisionTaskProcess* m_spuCollisionTaskProcess; SpuCollisionTaskProcess* m_spuCollisionTaskProcess;
 End of changes. 2 change blocks. 
2 lines changed or deleted 3 lines changed or added


 btActionInterface.h   btActionInterface.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_ACTION_INTERFACE_H #ifndef _BT_ACTION_INTERFACE_H
#define _BT_ACTION_INTERFACE_H #define _BT_ACTION_INTERFACE_H
class btIDebugDraw; class btIDebugDraw;
class btCollisionWorld; class btCollisionWorld;
#include "LinearMath/btScalar.h" #include "LinearMath/btScalar.h"
#include "btRigidBody.h"
///Basic interface to allow actions such as vehicles and characters to be u pdated inside a btDynamicsWorld ///Basic interface to allow actions such as vehicles and characters to be u pdated inside a btDynamicsWorld
class btActionInterface class btActionInterface
{ {
public: protected:
static btRigidBody& getFixedBody()
{
static btRigidBody s_fixed(0, 0,0);
s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btS
calar(0.),btScalar(0.)));
return s_fixed;
}
public:
virtual ~btActionInterface() virtual ~btActionInterface()
{ {
} }
virtual void updateAction( btCollisionWorld* collisionWorld, btScala r deltaTimeStep)=0; virtual void updateAction( btCollisionWorld* collisionWorld, btScala r deltaTimeStep)=0;
virtual void debugDraw(btIDebugDraw* debugDrawer) = 0; virtual void debugDraw(btIDebugDraw* debugDrawer) = 0;
}; };
 End of changes. 2 change blocks. 
1 lines changed or deleted 12 lines changed or added


 btAlignedObjectArray.h   btAlignedObjectArray.h 
skipping to change at line 134 skipping to change at line 134
resize (otherSize); resize (otherSize);
otherArray.copy(0, otherSize, m_data); otherArray.copy(0, otherSize, m_data);
} }
/// return the number of elements in the array /// return the number of elements in the array
SIMD_FORCE_INLINE int size() const SIMD_FORCE_INLINE int size() const
{ {
return m_size; return m_size;
} }
SIMD_FORCE_INLINE const T& at(int n) const
{
return m_data[n];
}
SIMD_FORCE_INLINE T& at(int n)
{
return m_data[n];
}
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];
} }
skipping to change at line 190 skipping to change at line 200
{ {
new ( &m_data[i]) T(fillData); new ( &m_data[i]) T(fillData);
} }
#endif //BT_USE_PLACEMENT_NEW #endif //BT_USE_PLACEMENT_NEW
} }
m_size = newsize; m_size = newsize;
} }
SIMD_FORCE_INLINE T& expandNonInitializing( )
{
int sz = size();
if( sz == capacity() )
{
reserve( allocSize(size()) );
}
m_size++;
return m_data[sz];
}
SIMD_FORCE_INLINE T& expand( const T& fillValue=T()) SIMD_FORCE_INLINE T& expand( const T& fillValue=T())
{ {
int sz = size(); int sz = size();
if( sz == capacity() ) if( sz == capacity() )
{ {
reserve( allocSize(size()) ); reserve( allocSize(size()) );
} }
m_size++; m_size++;
#ifdef BT_USE_PLACEMENT_NEW #ifdef BT_USE_PLACEMENT_NEW
new (&m_data[sz]) T(fillValue); //use the in-place n ew (not really allocating heap memory) new (&m_data[sz]) T(fillValue); //use the in-place n ew (not really allocating heap memory)
 End of changes. 2 change blocks. 
0 lines changed or deleted 22 lines changed or added


 btAxisSweep3.h   btAxisSweep3.h 
skipping to change at line 148 skipping to change at line 148
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));
virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback);
void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax ) const; void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax ) const;
///unQuantize should be conservative: aabbMin/aabbMax should be larg er then 'getAabb' result ///unQuantize should be conservative: aabbMin/aabbMax should be larg er then 'getAabb' result
void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVecto r3& aabbMax ) const; void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVecto r3& aabbMax ) const;
bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
btOverlappingPairCache* getOverlappingPairCache() btOverlappingPairCache* getOverlappingPairCache()
{ {
return m_pairCache; return m_pairCache;
skipping to change at line 279 skipping to change at line 280
{ {
if (m_pEdges[axis][i].IsMax()) if (m_pEdges[axis][i].IsMax())
{ {
rayCallback.process(getHandle(m_pEdges[axis] [i].m_handle)); rayCallback.process(getHandle(m_pEdges[axis] [i].m_handle));
} }
} }
} }
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::aabbTest(const btVector3& aabb
Min, const btVector3& aabbMax, btBroadphaseAabbCallback& callback)
{
if (m_raycastAccelerator)
{
m_raycastAccelerator->aabbTest(aabbMin,aabbMax,callback);
} else
{
//choose axis?
BP_FP_INT_TYPE axis = 0;
//for each proxy
for (BP_FP_INT_TYPE i=1;i<m_numHandles*2+1;i++)
{
if (m_pEdges[axis][i].IsMax())
{
Handle* handle = getHandle(m_pEdges[axis][i]
.m_handle);
if (TestAabbAgainstAabb2(aabbMin,aabbMax,han
dle->m_aabbMin,handle->m_aabbMax))
{
callback.process(handle);
}
}
}
}
}
template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::getAabb(btBroadphaseProxy* proxy ,btVector3& aabbMin, btVector3& aabbMax ) const void btAxisSweep3Internal<BP_FP_INT_TYPE>::getAabb(btBroadphaseProxy* proxy ,btVector3& aabbMin, btVector3& aabbMax ) const
{ {
Handle* pHandle = static_cast<Handle*>(proxy); Handle* pHandle = static_cast<Handle*>(proxy);
aabbMin = pHandle->m_aabbMin; aabbMin = pHandle->m_aabbMin;
aabbMax = pHandle->m_aabbMax; aabbMax = pHandle->m_aabbMax;
} }
template <typename BP_FP_INT_TYPE> template <typename BP_FP_INT_TYPE>
void btAxisSweep3Internal<BP_FP_INT_TYPE>::unQuantize(btBroadphaseProxy* pr oxy,btVector3& aabbMin, btVector3& aabbMax ) const void btAxisSweep3Internal<BP_FP_INT_TYPE>::unQuantize(btBroadphaseProxy* pr oxy,btVector3& aabbMin, btVector3& aabbMax ) const
{ {
 End of changes. 2 change blocks. 
0 lines changed or deleted 29 lines changed or added


 btBoxShape.h   btBoxShape.h 
skipping to change at line 43 skipping to change at line 43
btVector3 getHalfExtentsWithMargin() const btVector3 getHalfExtentsWithMargin() const
{ {
btVector3 halfExtents = getHalfExtentsWithoutMargin(); btVector3 halfExtents = getHalfExtentsWithoutMargin();
btVector3 margin(getMargin(),getMargin(),getMargin()); btVector3 margin(getMargin(),getMargin(),getMargin());
halfExtents += margin; halfExtents += margin;
return halfExtents; return halfExtents;
} }
const btVector3& getHalfExtentsWithoutMargin() const const btVector3& getHalfExtentsWithoutMargin() const
{ {
return m_implicitShapeDimensions;//changed in Bullet 2.63: a ssume the scaling and margin are included return m_implicitShapeDimensions;//scaling is included, marg in is not
} }
virtual btVector3 localGetSupportingVertex(const btVector3& ve c) const virtual btVector3 localGetSupportingVertex(const btVector3& ve c) const
{ {
btVector3 halfExtents = getHalfExtentsWithoutMargin(); btVector3 halfExtents = getHalfExtentsWithoutMargin();
btVector3 margin(getMargin(),getMargin(),getMargin()); btVector3 margin(getMargin(),getMargin(),getMargin());
halfExtents += margin; halfExtents += margin;
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExte nts.x()), return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExte nts.x()),
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()), btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 btBroadphaseInterface.h   btBroadphaseInterface.h 
skipping to change at line 25 skipping to change at line 25
#ifndef BROADPHASE_INTERFACE_H #ifndef BROADPHASE_INTERFACE_H
#define BROADPHASE_INTERFACE_H #define BROADPHASE_INTERFACE_H
struct btDispatcherInfo; struct btDispatcherInfo;
class btDispatcher; class btDispatcher;
#include "btBroadphaseProxy.h" #include "btBroadphaseProxy.h"
class btOverlappingPairCache; class btOverlappingPairCache;
struct btBroadphaseRayCallback struct btBroadphaseAabbCallback
{
virtual ~btBroadphaseAabbCallback() {}
virtual bool process(const btBroadphaseProxy* proxy) = 0;
};
struct btBroadphaseRayCallback : public btBroadphaseAabbCallback
{ {
///added some cached data to accelerate ray-AABB tests ///added some cached data to accelerate ray-AABB tests
btVector3 m_rayDirectionInverse; btVector3 m_rayDirectionInverse;
unsigned int m_signs[3]; unsigned int m_signs[3];
btScalar m_lambda_max; btScalar m_lambda_max;
virtual ~btBroadphaseRayCallback() {} virtual ~btBroadphaseRayCallback() {}
virtual bool process(const btBroadphaseProxy* proxy) = 0;
}; };
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
///The btBroadphaseInterface class provides an interface to detect aabb-ove rlapping object pairs. ///The btBroadphaseInterface class provides an interface to detect aabb-ove rlapping object pairs.
///Some implementations for this broadphase interface include btAxisSweep3, bt32BitAxisSweep3 and btDbvtBroadphase. ///Some implementations for this broadphase interface include btAxisSweep3, bt32BitAxisSweep3 and btDbvtBroadphase.
///The actual overlapping pair management, storage, adding and removing of pairs is dealt by the btOverlappingPairCache class. ///The actual overlapping pair management, storage, adding and removing of pairs is dealt by the btOverlappingPairCache class.
class btBroadphaseInterface class btBroadphaseInterface
{ {
public: public:
virtual ~btBroadphaseInterface() {} virtual ~btBroadphaseInterface() {}
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) =0; 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) =0;
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)=0; virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)=0;
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aa bbMin,const btVector3& aabbMax, btDispatcher* dispatcher)=0; virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aa bbMin,const btVector3& aabbMax, btDispatcher* dispatcher)=0;
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const =0; virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const =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)) = 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)) = 0;
virtual void aabbTest(const btVector3& aabbMin, const btVector3&
aabbMax, btBroadphaseAabbCallback& callback) = 0;
///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 ///reset broadphase internal structures, to ensure determinism/repro ducability
virtual void resetPool(btDispatcher* dispatcher) {}; virtual void resetPool(btDispatcher* dispatcher) { (void) dispatcher ; };
virtual void printStats() = 0; virtual void printStats() = 0;
}; };
#endif //BROADPHASE_INTERFACE_H #endif //BROADPHASE_INTERFACE_H
 End of changes. 4 change blocks. 
3 lines changed or deleted 11 lines changed or added


 btBroadphaseProxy.h   btBroadphaseProxy.h 
skipping to change at line 140 skipping to change at line 140
static SIMD_FORCE_INLINE bool isPolyhedral(int proxyType) static SIMD_FORCE_INLINE bool isPolyhedral(int proxyType)
{ {
return (proxyType < IMPLICIT_CONVEX_SHAPES_START_HERE); return (proxyType < IMPLICIT_CONVEX_SHAPES_START_HERE);
} }
static SIMD_FORCE_INLINE bool isConvex(int proxyType) static SIMD_FORCE_INLINE bool isConvex(int proxyType)
{ {
return (proxyType < CONCAVE_SHAPES_START_HERE); return (proxyType < CONCAVE_SHAPES_START_HERE);
} }
static SIMD_FORCE_INLINE bool isNonMoving(int proxyType)
{
return (isConcave(proxyType) && !(proxyType==GIMPACT_SHAPE_P
ROXYTYPE));
}
static SIMD_FORCE_INLINE bool isConcave(int proxyType) static SIMD_FORCE_INLINE bool isConcave(int proxyType)
{ {
return ((proxyType > CONCAVE_SHAPES_START_HERE) && return ((proxyType > CONCAVE_SHAPES_START_HERE) &&
(proxyType < CONCAVE_SHAPES_END_HERE)); (proxyType < CONCAVE_SHAPES_END_HERE));
} }
static SIMD_FORCE_INLINE bool isCompound(int proxyType) static SIMD_FORCE_INLINE bool isCompound(int proxyType)
{ {
return (proxyType == COMPOUND_SHAPE_PROXYTYPE); return (proxyType == COMPOUND_SHAPE_PROXYTYPE);
} }
static SIMD_FORCE_INLINE bool isSoftBody(int proxyType)
{
return (proxyType == SOFTBODY_SHAPE_PROXYTYPE);
}
static SIMD_FORCE_INLINE bool isInfinite(int proxyType) static SIMD_FORCE_INLINE bool isInfinite(int proxyType)
{ {
return (proxyType == STATIC_PLANE_PROXYTYPE); return (proxyType == STATIC_PLANE_PROXYTYPE);
} }
static SIMD_FORCE_INLINE bool isConvex2d(int proxyType) static SIMD_FORCE_INLINE bool isConvex2d(int proxyType)
{ {
return (proxyType == BOX_2D_SHAPE_PROXYTYPE) || (proxyType = = CONVEX_2D_SHAPE_PROXYTYPE); return (proxyType == BOX_2D_SHAPE_PROXYTYPE) || (proxyType = = CONVEX_2D_SHAPE_PROXYTYPE);
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 12 lines changed or added


 btBulletCollisionCommon.h   btBulletCollisionCommon.h 
skipping to change at line 64 skipping to change at line 64
#include "BulletCollision/BroadphaseCollision/btAxisSweep3.h" #include "BulletCollision/BroadphaseCollision/btAxisSweep3.h"
#include "BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h" #include "BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h"
#include "BulletCollision/BroadphaseCollision/btDbvtBroadphase.h" #include "BulletCollision/BroadphaseCollision/btDbvtBroadphase.h"
///Math library & Utils ///Math library & Utils
#include "LinearMath/btQuaternion.h" #include "LinearMath/btQuaternion.h"
#include "LinearMath/btTransform.h" #include "LinearMath/btTransform.h"
#include "LinearMath/btDefaultMotionState.h" #include "LinearMath/btDefaultMotionState.h"
#include "LinearMath/btQuickprof.h" #include "LinearMath/btQuickprof.h"
#include "LinearMath/btIDebugDraw.h" #include "LinearMath/btIDebugDraw.h"
#include "LinearMath/btSerializer.h"
#endif //BULLET_COLLISION_COMMON_H #endif //BULLET_COLLISION_COMMON_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 btBvhTriangleMeshShape.h   btBvhTriangleMeshShape.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 BVH_TRIANGLE_MESH_SHAPE_H #ifndef BVH_TRIANGLE_MESH_SHAPE_H
#define BVH_TRIANGLE_MESH_SHAPE_H #define BVH_TRIANGLE_MESH_SHAPE_H
#include "btTriangleMeshShape.h" #include "btTriangleMeshShape.h"
#include "btOptimizedBvh.h" #include "btOptimizedBvh.h"
#include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btAlignedAllocator.h"
#include "btTriangleInfoMap.h"
///The btBvhTriangleMeshShape is a static-triangle mesh shape with several optimizations, such as bounding volume hierarchy and cache friendly travers al for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabb Compression for better memory usage. ///The btBvhTriangleMeshShape is a static-triangle mesh shape with several optimizations, such as bounding volume hierarchy and cache friendly travers al for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabb Compression for better memory usage.
///It takes a triangle mesh as input, for example a btTriangleMesh or btTri angleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle mesh deformations by a refit or partialRefit method. ///It takes a triangle mesh as input, for example a btTriangleMesh or btTri angleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle mesh deformations by a refit or partialRefit method.
///Instead of building the bounding volume hierarchy acceleration structure , it is also possible to serialize (save) and deserialize (load) the struct ure from disk. ///Instead of building the bounding volume hierarchy acceleration structure , it is also possible to serialize (save) and deserialize (load) the struct ure from disk.
///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example. ///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example.
ATTRIBUTE_ALIGNED16(class) btBvhTriangleMeshShape : public btTriangleMeshSh ape ATTRIBUTE_ALIGNED16(class) btBvhTriangleMeshShape : public btTriangleMeshSh ape
{ {
btOptimizedBvh* m_bvh; btOptimizedBvh* m_bvh;
btTriangleInfoMap* m_triangleInfoMap;
bool m_useQuantizedAabbCompression; bool m_useQuantizedAabbCompression;
bool m_ownsBvh; bool m_ownsBvh;
bool m_pad[11];////need padding due to alignment bool m_pad[11];////need padding due to alignment
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_ownsBvh (false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;}; btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_triangl eInfoMap(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;} ;
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true); btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
///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
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bv hAabbMax, bool buildBvh = true); btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bv hAabbMax, bool buildBvh = true);
virtual ~btBvhTriangleMeshShape(); virtual ~btBvhTriangleMeshShape();
bool getOwnsBvh () const bool getOwnsBvh () const
{ {
return m_ownsBvh; return m_ownsBvh;
skipping to change at line 74 skipping to change at line 77
virtual void setLocalScaling(const btVector3& scaling); virtual void setLocalScaling(const btVector3& scaling);
btOptimizedBvh* getOptimizedBvh() btOptimizedBvh* getOptimizedBvh()
{ {
return m_bvh; return m_bvh;
} }
void setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localS caling=btVector3(1,1,1)); void setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localS caling=btVector3(1,1,1));
void buildOptimizedBvh();
bool usesQuantizedAabbCompression() const bool usesQuantizedAabbCompression() const
{ {
return m_useQuantizedAabbCompression; return m_useQuantizedAabbCompression;
} }
void setTriangleInfoMap(btTriangleInfoMap* triangleInfoMap)
{
m_triangleInfoMap = triangleInfoMap;
}
const btTriangleInfoMap* getTriangleInfoMap() const
{
return m_triangleInfoMap;
}
btTriangleInfoMap* getTriangleInfoMap()
{
return m_triangleInfoMap;
}
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
virtual void serializeSingleBvh(btSerializer* serializer) const;
virtual void serializeSingleTriangleInfoMap(btSerializer* seriali
zer) const;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btTriangleMeshShapeData
{
btCollisionShapeData m_collisionShapeData;
btStridingMeshInterfaceData m_meshInterface;
btQuantizedBvhFloatData *m_quantizedFloatBvh;
btQuantizedBvhDoubleData *m_quantizedDoubleBvh;
btTriangleInfoMapData *m_triangleInfoMap;
float m_collisionMargin;
char m_pad3[4];
};
SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBu
fferSize() const
{
return sizeof(btTriangleMeshShapeData);
} }
;
#endif //BVH_TRIANGLE_MESH_SHAPE_H #endif //BVH_TRIANGLE_MESH_SHAPE_H
 End of changes. 6 change blocks. 
2 lines changed or deleted 59 lines changed or added


 btCapsuleShape.h   btCapsuleShape.h 
skipping to change at line 45 skipping to change at line 45
btCapsuleShape(btScalar radius,btScalar height); btCapsuleShape(btScalar radius,btScalar height);
///CollisionShape Interface ///CollisionShape Interface
virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const;
/// btConvexShape Interface /// btConvexShape Interface
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
virtual void setMargin(btScalar collisionMargin)
{
//correct the m_implicitShapeDimensions for the margin
btVector3 oldMargin(getMargin(),getMargin(),getMargin());
btVector3 implicitShapeDimensionsWithMargin = m_implicitShap
eDimensions+oldMargin;
btConvexInternalShape::setMargin(collisionMargin);
btVector3 newMargin(getMargin(),getMargin(),getMargin());
m_implicitShapeDimensions = implicitShapeDimensionsWithMargi
n - newMargin;
}
virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVe ctor3& aabbMax) const virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVe ctor3& aabbMax) const
{ {
btVector3 halfExtents(getRadius(),getRadius(),getRad ius()); btVector3 halfExtents(getRadius(),getRadius(),getRad ius());
halfExtents[m_upAxis] = getRadius() + getHalfHeight( ); halfExtents[m_upAxis] = getRadius() + getHalfHeight( );
halfExtents += btVector3(getMargin(),getMargin(),get Margin()); halfExtents += btVector3(getMargin(),getMargin(),get Margin());
btMatrix3x3 abs_b = t.getBasis().absolute(); btMatrix3x3 abs_b = t.getBasis().absolute();
btVector3 center = t.getOrigin(); btVector3 center = t.getOrigin();
btVector3 extent = btVector3(abs_b[0].dot(halfExtent s),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents)); btVector3 extent = btVector3(abs_b[0].dot(halfExtent s),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
aabbMin = center - extent; aabbMin = center - extent;
skipping to change at line 90 skipping to change at line 102
{ {
btVector3 oldMargin(getMargin(),getMargin(),getMargin()); btVector3 oldMargin(getMargin(),getMargin(),getMargin());
btVector3 implicitShapeDimensionsWithMargin = m_implicitShap eDimensions+oldMargin; btVector3 implicitShapeDimensionsWithMargin = m_implicitShap eDimensions+oldMargin;
btVector3 unScaledImplicitShapeDimensionsWithMargin = implic itShapeDimensionsWithMargin / m_localScaling; btVector3 unScaledImplicitShapeDimensionsWithMargin = implic itShapeDimensionsWithMargin / m_localScaling;
btConvexInternalShape::setLocalScaling(scaling); btConvexInternalShape::setLocalScaling(scaling);
m_implicitShapeDimensions = (unScaledImplicitShapeDimensions WithMargin * m_localScaling) - oldMargin; m_implicitShapeDimensions = (unScaledImplicitShapeDimensions WithMargin * m_localScaling) - oldMargin;
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///btCapsuleShapeX represents a capsule around the Z axis ///btCapsuleShapeX represents a capsule around the Z axis
///the total height is height+2*radius, so the height is just the height be tween the center of each 'sphere' of the capsule caps. ///the total height is height+2*radius, so the height is just the height be tween the center of each 'sphere' of the capsule caps.
class btCapsuleShapeX : public btCapsuleShape class btCapsuleShapeX : public btCapsuleShape
{ {
public: public:
btCapsuleShapeX(btScalar radius,btScalar height); btCapsuleShapeX(btScalar radius,btScalar height);
skipping to change at line 123 skipping to change at line 141
btCapsuleShapeZ(btScalar radius,btScalar height); btCapsuleShapeZ(btScalar radius,btScalar height);
//debugging //debugging
virtual const char* getName()const virtual const char* getName()const
{ {
return "CapsuleZ"; return "CapsuleZ";
} }
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCapsuleShapeData
{
btConvexInternalShapeData m_convexInternalShapeData;
int m_upAxis;
char m_padding[4];
};
SIMD_FORCE_INLINE int btCapsuleShape::calculateSerializeBufferSize
() const
{
return sizeof(btCapsuleShapeData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btCapsuleShape::serialize(void* data
Buffer, btSerializer* serializer) const
{
btCapsuleShapeData* shapeData = (btCapsuleShapeData*) dataBuffer;
btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeDa
ta,serializer);
shapeData->m_upAxis = m_upAxis;
return "btCapsuleShapeData";
}
#endif //BT_CAPSULE_SHAPE_H #endif //BT_CAPSULE_SHAPE_H
 End of changes. 3 change blocks. 
0 lines changed or deleted 54 lines changed or added


 btCollisionDispatcher.h   btCollisionDispatcher.h 
skipping to change at line 44 skipping to change at line 44
#define USE_DISPATCH_REGISTRY_ARRAY 1 #define USE_DISPATCH_REGISTRY_ARRAY 1
class btCollisionDispatcher; class btCollisionDispatcher;
///user can override this nearcallback for collision filtering and more fin egrained control over collision detection ///user can override this nearcallback for collision filtering and more fin egrained control over collision detection
typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollision Dispatcher& dispatcher, const btDispatcherInfo& dispatchInfo); typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollision Dispatcher& dispatcher, const btDispatcherInfo& dispatchInfo);
///btCollisionDispatcher supports algorithms that handle ConvexConvex and C onvexConcave collision pairs. ///btCollisionDispatcher supports algorithms that handle ConvexConvex and C onvexConcave collision pairs.
///Time of Impact, Closest Points and Penetration Depth. ///Time of Impact, Closest Points and Penetration Depth.
class btCollisionDispatcher : public btDispatcher class btCollisionDispatcher : public btDispatcher
{ {
int m_count; int m_dispatcherFlags;
btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr; btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr;
bool m_useIslands;
bool m_staticWarningReported;
btManifoldResult m_defaultManifoldResult; btManifoldResult m_defaultManifoldResult;
btNearCallback m_nearCallback; btNearCallback m_nearCallback;
btPoolAllocator* m_collisionAlgorithmPoolAllocator; btPoolAllocator* m_collisionAlgorithmPoolAllocator;
btPoolAllocator* m_persistentManifoldPoolAllocator; btPoolAllocator* m_persistentManifoldPoolAllocator;
btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLL ISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES]; btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLL ISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES];
btCollisionConfiguration* m_collisionConfiguration; btCollisionConfiguration* m_collisionConfiguration;
public: public:
enum DispatcherFlags
{
CD_STATIC_STATIC_REPORTED = 1,
CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD = 2
};
int getDispatherFlags() const
{
return m_dispatcherFlags;
}
void setDispatcherFlags(int flags)
{
(void) flags;
m_dispatcherFlags = 0;
}
///registerCollisionCreateFunc allows registration of custom/alterna tive collision create functions ///registerCollisionCreateFunc allows registration of custom/alterna tive collision create functions
void registerCollisionCreateFunc(int proxyType0,int proxyType1, b tCollisionAlgorithmCreateFunc* createFunc); void registerCollisionCreateFunc(int proxyType0,int proxyType1, b tCollisionAlgorithmCreateFunc* createFunc);
int getNumManifolds() const int getNumManifolds() const
{ {
return int( m_manifoldsPtr.size()); return int( m_manifoldsPtr.size());
} }
btPersistentManifold** getInternalManifoldPointer() btPersistentManifold** getInternalManifoldPointer()
{ {
 End of changes. 3 change blocks. 
5 lines changed or deleted 18 lines changed or added


 btCollisionObject.h   btCollisionObject.h 
skipping to change at line 30 skipping to change at line 30
//island management, m_activationState1 //island management, m_activationState1
#define ACTIVE_TAG 1 #define ACTIVE_TAG 1
#define ISLAND_SLEEPING 2 #define ISLAND_SLEEPING 2
#define WANTS_DEACTIVATION 3 #define WANTS_DEACTIVATION 3
#define DISABLE_DEACTIVATION 4 #define DISABLE_DEACTIVATION 4
#define DISABLE_SIMULATION 5 #define DISABLE_SIMULATION 5
struct btBroadphaseProxy; struct btBroadphaseProxy;
class btCollisionShape; class btCollisionShape;
struct btCollisionShapeData;
#include "LinearMath/btMotionState.h" #include "LinearMath/btMotionState.h"
#include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
typedef btAlignedObjectArray<class btCollisionObject*> btCollisionObjectArr ay; typedef btAlignedObjectArray<class btCollisionObject*> btCollisionObjectArr ay;
#ifdef BT_USE_DOUBLE_PRECISION
#define btCollisionObjectData btCollisionObjectDoubleData
#define btCollisionObjectDataName "btCollisionObjectDoubleData"
#else
#define btCollisionObjectData btCollisionObjectFloatData
#define btCollisionObjectDataName "btCollisionObjectFloatData"
#endif
/// btCollisionObject can be used to manage collision detection objects. /// btCollisionObject can be used to manage collision detection objects.
/// btCollisionObject maintains all information that is needed for a collis ion detection: Shape, Transform and AABB proxy. /// btCollisionObject maintains all information that is needed for a collis ion detection: Shape, Transform and AABB proxy.
/// They can be added to the btCollisionWorld. /// They can be added to the btCollisionWorld.
ATTRIBUTE_ALIGNED16(class) btCollisionObject ATTRIBUTE_ALIGNED16(class) btCollisionObject
{ {
protected: protected:
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; btVector3 m_anisotropicFriction;
bool m_hasAnisotropicFriction; int m_hasAnisotropicFriction;
btScalar m_contactProcessingThreshold; 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;
int m_islandTag1; int m_islandTag1;
int m_companionId; int m_companionId;
int m_activationState1; int m_activationState1;
btScalar m_deactivationTime; btScalar m_deactivationTime;
btScalar m_friction; btScalar m_friction;
btScalar m_restitution; btScalar m_restitution;
///users can point to their objects, m_userPointer is not used by Bu
llet, see setUserPointer/getUserPointer
void* m_userObjectPointer;
///m_internalType is reserved to distinguish Bullet's btCollisionObj ect, btRigidBody, btSoftBody, btGhostObject etc. ///m_internalType is reserved to distinguish Bullet's btCollisionObj ect, btRigidBody, btSoftBody, btGhostObject etc.
///do not assign your own m_internalType unless you write a new dyna mics object class. ///do not assign your own m_internalType unless you write a new dyna mics object class.
int m_internalType; int m_internalType;
///users can point to their objects, m_userPointer is not used by Bu
llet, see setUserPointer/getUserPointer
void* m_userObjectPointer;
///time of impact calculation ///time of impact calculation
btScalar m_hitFraction; btScalar m_hitFraction;
///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm :: ///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm ::
btScalar m_ccdSweptSphereRadius; btScalar m_ccdSweptSphereRadius;
/// Don't do continuous collision detection if the motion (in one st ep) is less then m_ccdMotionThreshold /// Don't do continuous collision detection if the motion (in one st ep) is less then m_ccdMotionThreshold
btScalar m_ccdMotionThreshold; btScalar m_ccdMotionThreshold;
/// If some object should have elaborate collision filtering by sub- classes /// If some object should have elaborate collision filtering by sub- classes
bool m_checkCollideWith; int m_checkCollideWith;
char m_pad[7];
virtual bool checkCollideWithOverride(btCollisionObject* /* co */ ) virtual bool checkCollideWithOverride(btCollisionObject* /* co */ )
{ {
return true; return true;
} }
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
enum CollisionFlags enum CollisionFlags
{ {
CF_STATIC_OBJECT= 1, CF_STATIC_OBJECT= 1,
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,
CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing
CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/S
PU processing
}; };
enum CollisionObjectTypes enum CollisionObjectTypes
{ {
CO_COLLISION_OBJECT =1, CO_COLLISION_OBJECT =1,
CO_RIGID_BODY, CO_RIGID_BODY,
///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_SOFT_BODY,
skipping to change at line 144 skipping to change at line 153
{ {
return m_anisotropicFriction; return m_anisotropicFriction;
} }
void setAnisotropicFriction(const btVector3& anisotropicFriction) void setAnisotropicFriction(const btVector3& anisotropicFriction)
{ {
m_anisotropicFriction = anisotropicFriction; m_anisotropicFriction = anisotropicFriction;
m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) || (anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f); m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) || (anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f);
} }
bool hasAnisotropicFriction() const bool hasAnisotropicFriction() const
{ {
return m_hasAnisotropicFriction; return m_hasAnisotropicFriction!=0;
} }
///the constraint solver can discard solving contacts, if the distan ce is above this threshold. 0 by default. ///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 ///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) void setContactProcessingThreshold( btScalar contactProcessingThr eshold)
{ {
m_contactProcessingThreshold = contactProcessingThreshold; m_contactProcessingThreshold = contactProcessingThreshold;
} }
btScalar getContactProcessingThreshold() const btScalar getContactProcessingThreshold() const
{ {
skipping to change at line 410 skipping to change at line 419
m_userObjectPointer = userPointer; m_userObjectPointer = userPointer;
} }
inline bool checkCollideWith(btCollisionObject* co) inline bool checkCollideWith(btCollisionObject* co)
{ {
if (m_checkCollideWith) if (m_checkCollideWith)
return checkCollideWithOverride(co); return checkCollideWithOverride(co);
return true; return true;
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, class btSerializ
er* serializer) const;
virtual void serializeSingleObject(class btSerializer* serializer) c
onst;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCollisionObjectDoubleData
{
void *m_broadphaseHandle;
void *m_collisionShape;
btCollisionShapeData *m_rootCollisionShape;
char *m_name;
btTransformDoubleData m_worldTransform;
btTransformDoubleData m_interpolationWorldTransform;
btVector3DoubleData m_interpolationLinearVelocity;
btVector3DoubleData m_interpolationAngularVelocity;
btVector3DoubleData m_anisotropicFriction;
double m_contactProcessingThreshold
;
double m_deactivationTime;
double m_friction;
double m_restitution;
double m_hitFraction;
double m_ccdSweptSphereRadius;
double m_ccdMotionThreshold;
int m_hasAnisotropicFric
tion;
int m_collisionFlags;
int m_islandTag1;
int m_companionId;
int m_activationState1;
int m_internalType;
int m_checkCollideWith;
char m_padding[4];
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCollisionObjectFloatData
{
void *m_broadphaseHandle;
void *m_collisionShape;
btCollisionShapeData *m_rootCollisionShape;
char *m_name;
btTransformFloatData m_worldTransform;
btTransformFloatData m_interpolationWorldTransform;
btVector3FloatData m_interpolationLinearVelocity;
btVector3FloatData m_interpolationAngularVelocity;
btVector3FloatData m_anisotropicFriction;
float m_contactProcessingThreshold
;
float m_deactivationTime;
float m_friction;
float m_restitution;
float m_hitFraction;
float m_ccdSweptSphereRadius;
float m_ccdMotionThreshold;
int m_hasAnisotropicFric
tion;
int m_collisionFlags;
int m_islandTag1;
int m_companionId;
int m_activationState1;
int m_internalType;
int m_checkCollideWith;
};
SIMD_FORCE_INLINE int btCollisionObject::calculateSerializeBufferS
ize() const
{
return sizeof(btCollisionObjectData);
}
#endif //COLLISION_OBJECT_H #endif //COLLISION_OBJECT_H
 End of changes. 10 change blocks. 
12 lines changed or deleted 107 lines changed or added


 btCollisionShape.h   btCollisionShape.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 COLLISION_SHAPE_H #ifndef COLLISION_SHAPE_H
#define COLLISION_SHAPE_H #define COLLISION_SHAPE_H
#include "LinearMath/btTransform.h" #include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h" #include "LinearMath/btMatrix3x3.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" //for th e shape types #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" //for th e shape types
class btSerializer;
///The btCollisionShape class provides an interface for collision shapes th at can be shared among btCollisionObjects. ///The btCollisionShape class provides an interface for collision shapes th at can be shared among btCollisionObjects.
class btCollisionShape class btCollisionShape
{ {
protected: protected:
int m_shapeType; int m_shapeType;
void* m_userPointer; void* m_userPointer;
public: public:
skipping to change at line 49 skipping to change at line 50
} }
///getAabb returns the axis aligned bounding box in the coordinate f rame of the given transform t. ///getAabb returns the axis aligned bounding box in the coordinate f rame of the given transform t.
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const =0; virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const =0;
virtual void getBoundingSphere(btVector3& center,btScalar& radius ) const; virtual void getBoundingSphere(btVector3& center,btScalar& radius ) const;
///getAngularMotionDisc returns the maximus radius needed for Conser vative Advancement to handle time-of-impact with rotations. ///getAngularMotionDisc returns the maximus radius needed for Conser vative Advancement to handle time-of-impact with rotations.
virtual btScalar getAngularMotionDisc() const; virtual btScalar getAngularMotionDisc() const;
virtual btScalar getContactBreakingThreshold() const; virtual btScalar getContactBreakingThreshold(btScalar default ContactThresholdFactor) const;
///calculateTemporalAabb calculates the enclosing aabb for the movin g object over interval [0..timeStep) ///calculateTemporalAabb calculates the enclosing aabb for the movin g object over interval [0..timeStep)
///result is conservative ///result is conservative
void calculateTemporalAabb(const btTransform& curTrans,const btVecto r3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAa bbMin,btVector3& temporalAabbMax) const; void calculateTemporalAabb(const btTransform& curTrans,const btVecto r3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAa bbMin,btVector3& temporalAabbMax) const;
#ifndef __SPU__
SIMD_FORCE_INLINE bool isPolyhedral() const SIMD_FORCE_INLINE bool isPolyhedral() const
{ {
return btBroadphaseProxy::isPolyhedral(getShapeType()); return btBroadphaseProxy::isPolyhedral(getShapeType());
} }
SIMD_FORCE_INLINE bool isConvex2d() const SIMD_FORCE_INLINE bool isConvex2d() const
{ {
return btBroadphaseProxy::isConvex2d(getShapeType()); return btBroadphaseProxy::isConvex2d(getShapeType());
} }
SIMD_FORCE_INLINE bool isConvex() const SIMD_FORCE_INLINE bool isConvex() const
{ {
return btBroadphaseProxy::isConvex(getShapeType()); return btBroadphaseProxy::isConvex(getShapeType());
} }
SIMD_FORCE_INLINE bool isNonMoving() const
{
return btBroadphaseProxy::isNonMoving(getShapeType());
}
SIMD_FORCE_INLINE bool isConcave() const SIMD_FORCE_INLINE bool isConcave() const
{ {
return btBroadphaseProxy::isConcave(getShapeType()); return btBroadphaseProxy::isConcave(getShapeType());
} }
SIMD_FORCE_INLINE bool isCompound() const SIMD_FORCE_INLINE bool isCompound() const
{ {
return btBroadphaseProxy::isCompound(getShapeType()); return btBroadphaseProxy::isCompound(getShapeType());
} }
SIMD_FORCE_INLINE bool isSoftBody() const
{
return btBroadphaseProxy::isSoftBody(getShapeType());
}
///isInfinite is used to catch simulation error (aabb check) ///isInfinite is used to catch simulation error (aabb check)
SIMD_FORCE_INLINE bool isInfinite() const SIMD_FORCE_INLINE bool isInfinite() const
{ {
return btBroadphaseProxy::isInfinite(getShapeType()); return btBroadphaseProxy::isInfinite(getShapeType());
} }
#ifndef __SPU__
virtual void setLocalScaling(const btVector3& scaling) =0; virtual void setLocalScaling(const btVector3& scaling) =0;
virtual const btVector3& getLocalScaling() const =0; virtual const btVector3& getLocalScaling() const =0;
virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const = 0; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const = 0;
//debugging support //debugging support
virtual const char* getName()const =0 ; virtual const char* getName()const =0 ;
#endif //__SPU__ #endif //__SPU__
int getShapeType() const { return m_shapeType; } int getShapeType() const { return m_shapeType; }
virtual void setMargin(btScalar margin) = 0; virtual void setMargin(btScalar margin) = 0;
skipping to change at line 109 skipping to change at line 118
void setUserPointer(void* userPtr) void setUserPointer(void* userPtr)
{ {
m_userPointer = userPtr; m_userPointer = userPtr;
} }
void* getUserPointer() const void* getUserPointer() const
{ {
return m_userPointer; return m_userPointer;
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
virtual void serializeSingleShape(btSerializer* serializer) const
;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCollisionShapeData
{
char *m_name;
int m_shapeType;
char m_padding[4];
};
SIMD_FORCE_INLINE int btCollisionShape::calculateSerializeBufferSi
ze() const
{
return sizeof(btCollisionShapeData);
}
#endif //COLLISION_SHAPE_H #endif //COLLISION_SHAPE_H
 End of changes. 8 change blocks. 
3 lines changed or deleted 37 lines changed or added


 btCollisionWorld.h   btCollisionWorld.h 
skipping to change at line 24 skipping to change at line 24
*/ */
/** /**
* @mainpage Bullet Documentation * @mainpage Bullet Documentation
* *
* @section intro_sec Introduction * @section intro_sec Introduction
* Bullet Collision Detection & Physics SDK * Bullet Collision Detection & Physics SDK
* *
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Lib rary is Open Source and free for commercial use, under the ZLib license ( h ttp://opensource.org/licenses/zlib-license.php ). * Bullet is a Collision Detection and Rigid Body Dynamics Library. The Lib rary is Open Source and free for commercial use, under the ZLib license ( h ttp://opensource.org/licenses/zlib-license.php ).
* *
* The main documentation is Bullet_User_Manual.pdf, included in the source code distribution.
* There is the Physics Forum for feedback and general Collision Detection and Physics discussions. * There is the Physics Forum for feedback and general Collision Detection and Physics discussions.
* Please visit http://www.bulletphysics.com * Please visit http://www.bulletphysics.com
* *
* @section install_sec Installation * @section install_sec Installation
* *
* @subsection step1 Step 1: Download * @subsection step1 Step 1: Download
* You can download the Bullet Physics Library from the Google Code reposit ory: http://code.google.com/p/bullet/downloads/list * You can download the Bullet Physics Library from the Google Code reposit ory: http://code.google.com/p/bullet/downloads/list
* @subsection step2 Step 2: Building
* Bullet comes with autogenerated Project Files for Microsoft Visual Studi
o 6, 7, 7.1 and 8.
* The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (r
eplace 8 with your version).
* *
* Under other platforms, like Linux or Mac OS-X, Bullet can be build using * @subsection step2 Step 2: Building
either using make, cmake, http://www.cmake.org , or jam, http://www.perfor * Bullet main build system for all platforms is cmake, you can download ht
ce.com/jam/jam.html . cmake can autogenerate Xcode, KDevelop, MSVC and othe tp://www.cmake.org
r build systems. just run cmake . in the root of Bullet. * cmake can autogenerate projectfiles for Microsoft Visual Studio, Apple X
* So if you are not using MSVC or cmake, you can run ./autogen.sh ./config code, KDevelop and Unix Makefiles.
ure to create both Makefile and Jamfile and then run make or jam. * The easiest is to run the CMake cmake-gui graphical user interface and c
* Jam is a build system that can build the library, demos and also autogen hoose the options and generate projectfiles.
erate the MSVC Project Files. * You can also use cmake in the command-line. Here are some examples for v
* If you don't have jam installed, you can make jam from the included jam- arious platforms:
2.5 sources, or download jam from ftp://ftp.perforce.com/jam * cmake . -G "Visual Studio 9 2008"
* cmake . -G Xcode
* cmake . -G "Unix Makefiles"
* Although cmake is recommended, you can also use autotools for UNIX: ./au
togen.sh ./configure to create a Makefile and then run make.
* *
* @subsection step3 Step 3: Testing demos * @subsection step3 Step 3: Testing demos
* Try to run and experiment with BasicDemo executable as a starting point. * Try to run and experiment with BasicDemo executable as a starting point.
* Bullet can be used in several ways, as Full Rigid Body simulation, as Co llision Detector Library or Low Level / Snippets like the GJK Closest Point calculation. * Bullet can be used in several ways, as Full Rigid Body simulation, as Co llision Detector Library or Low Level / Snippets like the GJK Closest Point calculation.
* The Dependencies can be seen in this documentation under Directories * The Dependencies can be seen in this documentation under Directories
* *
* @subsection step4 Step 4: Integrating in your application, full Rigid Bo dy and Soft Body simulation * @subsection step4 Step 4: Integrating in your application, full Rigid Bo dy and Soft Body simulation
* Check out BasicDemo how to create a btDynamicsWorld, btRigidBody and btC ollisionShape, Stepping the simulation and synchronizing your graphics obje ct transform. * Check out BasicDemo how to create a btDynamicsWorld, btRigidBody and btC ollisionShape, Stepping the simulation and synchronizing your graphics obje ct transform.
* Check out SoftDemo how to use soft body dynamics, using btSoftRigidDynam icsWorld. * Check out SoftDemo how to use soft body dynamics, using btSoftRigidDynam icsWorld.
* @subsection step5 Step 5 : Integrate the Collision Detection Library (wi thout Dynamics and other Extras) * @subsection step5 Step 5 : Integrate the Collision Detection Library (wi thout Dynamics and other Extras)
* Bullet Collision Detection can also be used without the Dynamics/Extras. * Bullet Collision Detection can also be used without the Dynamics/Extras.
* Check out btCollisionWorld and btCollisionObject, and the CollisionInter faceDemo. * Check out btCollisionWorld and btCollisionObject, and the CollisionInter faceDemo.
* @subsection step6 Step 6 : Use Snippets like the GJK Closest Point calcu lation. * @subsection step6 Step 6 : Use Snippets like the GJK Closest Point calcu lation.
* Bullet has been designed in a modular way keeping dependencies to a mini mum. The ConvexHullDistance demo demonstrates direct use of btGjkPairDetect or. * Bullet has been designed in a modular way keeping dependencies to a mini mum. The ConvexHullDistance demo demonstrates direct use of btGjkPairDetect or.
* *
* @section copyright Copyright * @section copyright Copyright
* Copyright (C) 2005-2008 Erwin Coumans, some contributions Copyright Gino * For up-to-data information and copyright and contributors list check out
van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter( the Bullet_User_Manual.pdf
res), Stephane Redon
* Special thanks to all visitors of the Bullet Physics forum, and in parti
cular above contributors, John McCutchan, Nathanael Presson, Dave Eberle, D
irk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky,
* Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul v
an Waveren, Marten Svanfeldt.
* *
*/ */
#ifndef COLLISION_WORLD_H #ifndef COLLISION_WORLD_H
#define COLLISION_WORLD_H #define COLLISION_WORLD_H
class btStackAlloc; class btStackAlloc;
class btCollisionShape; class btCollisionShape;
class btConvexShape; class btConvexShape;
class btBroadphaseInterface; class btBroadphaseInterface;
class btSerializer;
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h" #include "LinearMath/btTransform.h"
#include "btCollisionObject.h" #include "btCollisionObject.h"
#include "btCollisionDispatcher.h" #include "btCollisionDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" #include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
///CollisionWorld is interface and container for the collision detection ///CollisionWorld is interface and container for the collision detection
class btCollisionWorld class btCollisionWorld
{ {
skipping to change at line 97 skipping to change at line 100
btStackAlloc* m_stackAlloc; btStackAlloc* m_stackAlloc;
btBroadphaseInterface* m_broadphasePairCache; btBroadphaseInterface* m_broadphasePairCache;
btIDebugDraw* m_debugDrawer; btIDebugDraw* m_debugDrawer;
///m_forceUpdateAllAabbs can be set to false as an optimization to o nly update active object AABBs ///m_forceUpdateAllAabbs can be set to false as an optimization to o nly update active object AABBs
///it is true by default, because it is error-prone (setting the pos ition of static objects wouldn't update their AABB) ///it is true by default, because it is error-prone (setting the pos ition of static objects wouldn't update their AABB)
bool m_forceUpdateAllAabbs; bool m_forceUpdateAllAabbs;
void serializeCollisionObjects(btSerializer* serializer);
public: public:
//this constructor doesn't own the dispatcher and paircache/broadpha se //this constructor doesn't own the dispatcher and paircache/broadpha se
btCollisionWorld(btDispatcher* dispatcher,btBroadphaseInterface* bro adphasePairCache, btCollisionConfiguration* collisionConfiguration); btCollisionWorld(btDispatcher* dispatcher,btBroadphaseInterface* bro adphasePairCache, btCollisionConfiguration* collisionConfiguration);
virtual ~btCollisionWorld(); virtual ~btCollisionWorld();
void setBroadphase(btBroadphaseInterface* pairCache) void setBroadphase(btBroadphaseInterface* pairCache)
{ {
m_broadphasePairCache = pairCache; m_broadphasePairCache = pairCache;
skipping to change at line 148 skipping to change at line 153
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;
} }
virtual void debugDrawWorld();
virtual void debugDrawObject(const btTransform& worldTransform, cons
t btCollisionShape* shape, const btVector3& color);
///LocalShapeInfo gives extra information for complex shapes ///LocalShapeInfo gives extra information for complex shapes
///Currently, only btTriangleMeshShape is available, so it just cont ains triangleIndex and subpart ///Currently, only btTriangleMeshShape is available, so it just cont ains triangleIndex and subpart
struct LocalShapeInfo struct LocalShapeInfo
{ {
int m_shapePart; int m_shapePart;
int m_triangleIndex; int m_triangleIndex;
//const btCollisionShape* m_shapeTemp; //const btCollisionShape* m_shapeTemp;
//const btTransform* m_shapeLocalTransform; //const btTransform* m_shapeLocalTransform;
}; };
skipping to change at line 343 skipping to change at line 352
} else } else
{ {
///need to transform normal into worldspace ///need to transform normal into worldspace
m_hitNormalWorld = m_hitCollisionObject->get WorldTransform().getBasis()*convexResult.m_hitNormalLocal; m_hitNormalWorld = m_hitCollisionObject->get WorldTransform().getBasis()*convexResult.m_hitNormalLocal;
} }
m_hitPointWorld = convexResult.m_hitPointLocal; m_hitPointWorld = convexResult.m_hitPointLocal;
return convexResult.m_hitFraction; return convexResult.m_hitFraction;
} }
}; };
///ContactResultCallback is used to report contact points
struct ContactResultCallback
{
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
ContactResultCallback()
:m_collisionFilterGroup(btBroadphaseProxy::DefaultFi
lter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual ~ContactResultCallback()
{
}
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_
collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & pro
xy0->m_collisionFilterMask);
return collides;
}
virtual btScalar addSingleResult(btManifoldPoint& cp,
const btCollisionObject* colObj0,int partId0,int index0,const btCollisi
onObject* colObj1,int partId1,int index1) = 0;
};
int getNumCollisionObjects() const int getNumCollisionObjects() const
{ {
return int(m_collisionObjects.size()); return int(m_collisionObjects.size());
} }
/// rayTest performs a raycast on all objects in the btCollisionWorl d, and calls the resultCallback /// rayTest performs a raycast on all objects in the btCollisionWorl d, and calls the resultCallback
/// This allows for several queries: first hit, all hits, any hit, d ependent on the value returned by the callback. /// This allows for several queries: first hit, all hits, any hit, d ependent on the value returned by the callback.
void rayTest(const btVector3& rayFromWorld, const btVector3& rayT oWorld, RayResultCallback& resultCallback) const; virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
// convexTest performs a swept convex cast on all objects in the btC /// convexTest performs a swept convex cast on all objects in the bt
ollisionWorld, and calls the resultCallback CollisionWorld, and calls the resultCallback
// This allows for several queries: first hit, all hits, any hit, de /// This allows for several queries: first hit, all hits, any hit, d
pendent on the value return by the callback. ependent on the value return by the callback.
void convexSweepTest (const btConvexShape* castShape, const btTra nsform& from, const btTransform& to, ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration = btScalar(0.)) const; void convexSweepTest (const btConvexShape* castShape, const btTra nsform& from, const btTransform& to, ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration = btScalar(0.)) const;
///contactTest performs a discrete collision test between colObj aga
inst all objects in the btCollisionWorld, and calls the resultCallback.
///it reports one or more contact points for every overlapping objec
t (including the one with deepest penetration)
void contactTest(btCollisionObject* colObj, ContactResultCallback
& resultCallback);
///contactTest performs a discrete collision test between two collis
ion objects and calls the resultCallback if overlap if detected.
///it reports one or more contact points (including the one with dee
pest penetration)
void contactPairTest(btCollisionObject* colObjA, btCollisionObjec
t* colObjB, ContactResultCallback& resultCallback);
/// rayTestSingle performs a raycast call and calls the resultCallba ck. It is used internally by rayTest. /// rayTestSingle performs a raycast call and calls the resultCallba ck. It is used internally by rayTest.
/// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape. /// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
/// This allows more customization. /// This allows more customization.
static void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans, static void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
btCollisionObject* collisionObject , btCollisionObject* collisionObject ,
const btCollisionShape* collisionS hape, const btCollisionShape* collisionS hape,
const btTransform& colObjWorldTran sform, const btTransform& colObjWorldTran sform,
RayResultCallback& resultCallback) ; RayResultCallback& resultCallback) ;
/// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest. /// objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.
skipping to change at line 407 skipping to change at line 450
bool getForceUpdateAllAabbs() const bool getForceUpdateAllAabbs() const
{ {
return m_forceUpdateAllAabbs; return m_forceUpdateAllAabbs;
} }
void setForceUpdateAllAabbs( bool forceUpdateAllAabbs) void setForceUpdateAllAabbs( bool forceUpdateAllAabbs)
{ {
m_forceUpdateAllAabbs = forceUpdateAllAabbs; m_forceUpdateAllAabbs = forceUpdateAllAabbs;
} }
///Preliminary serialization test for Bullet 2.76. Loading those fil
es requires a separate parser (Bullet/Demos/SerializeDemo)
virtual void serialize(btSerializer* serializer);
}; };
#endif //COLLISION_WORLD_H #endif //COLLISION_WORLD_H
 End of changes. 12 change blocks. 
28 lines changed or deleted 80 lines changed or added


 btCompoundShape.h   btCompoundShape.h 
skipping to change at line 65 skipping to change at line 65
{ {
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 ///increment m_updateRevision when adding/removing/replacing child s hapes, so that some caches can be updated
int m_up dateRevision; int m_up dateRevision;
btScalar m_collisionMargin;
protected:
btVector3 m_localScaling;
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 117 skipping to change at line 122
return &m_children[0]; return &m_children[0];
} }
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const; virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto r3& aabbMax) const;
/** Re-calculate the local Aabb. Is called at the end of removeChild Shapes. /** Re-calculate the local Aabb. Is called at the end of removeChild Shapes.
Use this yourself if you modify the children or their transforms. */ Use this yourself if you modify the children or their transforms. */
virtual void recalculateLocalAabb(); virtual void recalculateLocalAabb();
virtual void setLocalScaling(const btVector3& scaling) virtual void setLocalScaling(const btVector3& scaling);
{
m_localScaling = scaling;
}
virtual const btVector3& getLocalScaling() const virtual const btVector3& getLocalScaling() const
{ {
return m_localScaling; return m_localScaling;
} }
virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const;
virtual void setMargin(btScalar margin) virtual void setMargin(btScalar margin)
{ {
m_collisionMargin = margin; m_collisionMargin = margin;
} }
virtual btScalar getMargin() const virtual btScalar getMargin() const
{ {
return m_collisionMargin; return m_collisionMargin;
} }
virtual const char* getName()const virtual const char* getName()const
{ {
return "Compound"; return "Compound";
} }
//this is optional, but should make collision queries faster, by cul
ling non-overlapping nodes
void createAabbTreeFromChildren();
btDbvt* getDynamicAa bbTree() btDbvt* getDynamicAa bbTree()
{ {
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 int getUpdateRevision() const
{ {
return m_updateRevision; return m_updateRevision;
} }
private: virtual int calculateSerializeBufferSize() const;
btScalar m_collisionMargin;
protected: ///fills the dataBuffer and returns the struct name (and 0 on failur
btVector3 m_localScaling; e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCompoundShapeChildData
{
btTransformFloatData m_transform;
btCollisionShapeData *m_childShape;
int m_childShapeType;
float m_childMargin;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCompoundShapeData
{
btCollisionShapeData m_collisionShapeData;
btCompoundShapeChildData *m_childShapePtr;
int m_numChildSh
apes;
float m_collisionMargin;
};
SIMD_FORCE_INLINE int btCompoundShape::calculateSerializeBufferSiz
e() const
{
return sizeof(btCompoundShapeData);
}
#endif //COMPOUND_SHAPE_H #endif //COMPOUND_SHAPE_H
 End of changes. 5 change blocks. 
12 lines changed or deleted 44 lines changed or added


 btConeTwistConstraint.h   btConeTwistConstraint.h 
skipping to change at line 41 skipping to change at line 41
#ifndef CONETWISTCONSTRAINT_H #ifndef CONETWISTCONSTRAINT_H
#define CONETWISTCONSTRAINT_H #define CONETWISTCONSTRAINT_H
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "btJacobianEntry.h" #include "btJacobianEntry.h"
#include "btTypedConstraint.h" #include "btTypedConstraint.h"
class btRigidBody; class btRigidBody;
enum btConeTwistFlags
{
BT_CONETWIST_FLAGS_LIN_CFM = 1,
BT_CONETWIST_FLAGS_LIN_ERP = 2,
BT_CONETWIST_FLAGS_ANG_CFM = 4
};
///btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc) ///btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc)
class btConeTwistConstraint : public btTypedConstraint class btConeTwistConstraint : public btTypedConstraint
{ {
#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
btTransform m_rbAFrame; btTransform m_rbAFrame;
btTransform m_rbBFrame; btTransform m_rbBFrame;
skipping to change at line 97 skipping to change at line 104
btScalar m_twistLimitRatio; btScalar m_twistLimitRatio;
btVector3 m_twistAxisA; btVector3 m_twistAxisA;
// motor // motor
bool m_bMotorEnabled; bool m_bMotorEnabled;
bool m_bNormalizedMotorStrength; bool m_bNormalizedMotorStrength;
btQuaternion m_qTarget; btQuaternion m_qTarget;
btScalar m_maxMotorImpulse; btScalar m_maxMotorImpulse;
btVector3 m_accMotorImpulse; btVector3 m_accMotorImpulse;
// parameters
int m_flags;
btScalar m_linCFM;
btScalar m_linERP;
btScalar m_angCFM;
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;
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();
virtual void buildJacobian(); virtual void buildJacobian();
virtual void getInfo1 (btConstraintInfo1* info); virtual void getInfo1 (btConstraintInfo1* info);
void getInfo1NonVirtual(btConstraintInfo1* info); void getInfo1NonVirtual(btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info); virtual void getInfo2 (btConstraintInfo2* info);
void getInfo2NonVirtual(btConstraintInfo2* info,const btTransform & transA,const btTransform& transB,const btMatrix3x3& invInertiaWorldA,cons t btMatrix3x3& invInertiaWorldB); void getInfo2NonVirtual(btConstraintInfo2* info,const btTransform & transA,const btTransform& transB,const btMatrix3x3& invInertiaWorldA,cons t btMatrix3x3& invInertiaWorldB);
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver Body& bodyB,btScalar timeStep); virtual void solveConstraintObsolete(btRigidBody& bodyA,btRigidBo dy& 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;
skipping to change at line 239 skipping to change at line 262
// q: the desired rotation of bodyA wrt bodyB. // 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: 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() // note: don't forget to enableMotor()
void setMotorTarget(const btQuaternion &q); void setMotorTarget(const btQuaternion &q);
// same as above, but q is the desired rotation of frameA wrt frameB in constraint space // same as above, but q is the desired rotation of frameA wrt frameB in constraint space
void setMotorTargetInConstraintSpace(const btQuaternion &q); void setMotorTargetInConstraintSpace(const btQuaternion &q);
btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLengt h) const; btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLengt h) const;
protected: ///override the default global value of a parameter (such as ERP or
void init(); CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constra
int.
virtual void setParam(int num, btScalar value, int axis = -1);
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
void computeConeLimitInfo(const btQuaternion& qCone, // in virtual int calculateSerializeBufferSize() const;
btScalar& swingAngle, btVector3& vSwingAxis, btScalar& swing
Limit); // all outs
void computeTwistLimitInfo(const btQuaternion& qTwist, // in ///fills the dataBuffer and returns the struct name (and 0 on failur
btScalar& twistAngle, btVector3& vTwistAxis); // all outs e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
void adjustSwingAxisToUseEllipseNormal(btVector3& vSwingAxis) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btConeTwistConstraintData
{
btTypedConstraintData m_typeConstraintData;
btTransformFloatData m_rbAFrame;
btTransformFloatData m_rbBFrame;
//limits
float m_swingSpan1;
float m_swingSpan2;
float m_twistSpan;
float m_limitSoftness;
float m_biasFactor;
float m_relaxationFactor;
float m_damping;
char m_pad[4];
};
SIMD_FORCE_INLINE int btConeTwistConstraint::calculateSerializeBufferSize(
) const
{
return sizeof(btConeTwistConstraintData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btConeTwistConstraint::serialize(void* dataB
uffer, btSerializer* serializer) const
{
btConeTwistConstraintData* cone = (btConeTwistConstraintData*) dataB
uffer;
btTypedConstraint::serialize(&cone->m_typeConstraintData,serializer)
;
m_rbAFrame.serializeFloat(cone->m_rbAFrame);
m_rbBFrame.serializeFloat(cone->m_rbBFrame);
cone->m_swingSpan1 = float(m_swingSpan1);
cone->m_swingSpan2 = float(m_swingSpan2);
cone->m_twistSpan = float(m_twistSpan);
cone->m_limitSoftness = float(m_limitSoftness);
cone->m_biasFactor = float(m_biasFactor);
cone->m_relaxationFactor = float(m_relaxationFactor);
cone->m_damping = float(m_damping);
return "btConeTwistConstraintData";
}
#endif //CONETWISTCONSTRAINT_H #endif //CONETWISTCONSTRAINT_H
 End of changes. 9 change blocks. 
11 lines changed or deleted 92 lines changed or added


 btContactConstraint.h   btContactConstraint.h 
skipping to change at line 33 skipping to change at line 33
///btContactConstraint can be automatically created to solve contact constr aints using the unified btTypedConstraint interface ///btContactConstraint can be automatically created to solve contact constr aints using the unified btTypedConstraint interface
ATTRIBUTE_ALIGNED16(class) btContactConstraint : public btTypedConstraint ATTRIBUTE_ALIGNED16(class) btContactConstraint : public btTypedConstraint
{ {
protected: protected:
btPersistentManifold m_contactManifold; btPersistentManifold m_contactManifold;
public: public:
btContactConstraint();
btContactConstraint(btPersistentManifold* contactManifold,btRigidBod y& rbA,btRigidBody& rbB); btContactConstraint(btPersistentManifold* contactManifold,btRigidBod y& rbA,btRigidBody& rbB);
void setContactManifold(btPersistentManifold* contactManifold); void setContactManifold(btPersistentManifold* contactManifold);
btPersistentManifold* getContactManifold() btPersistentManifold* getContactManifold()
{ {
return &m_contactManifold; return &m_contactManifold;
} }
const btPersistentManifold* getContactManifold() const const btPersistentManifold* getContactManifold() const
skipping to change at line 58 skipping to change at line 56
virtual ~btContactConstraint(); virtual ~btContactConstraint();
virtual void getInfo1 (btConstraintInfo1* info); virtual void getInfo1 (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info); virtual void getInfo2 (btConstraintInfo2* info);
///obsolete methods ///obsolete methods
virtual void buildJacobian(); virtual void buildJacobian();
///obsolete methods
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver
Body& bodyB,btScalar timeStep);
}; };
///resolveSingleBilateral is an obsolete methods used for vehicle friction between two dynamic objects ///resolveSingleBilateral is an obsolete methods used for vehicle friction between two dynamic objects
void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1, void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1,
btRigidBody& body2, const btVector3& pos2, btRigidBody& body2, const btVector3& pos2,
btScalar distance, const btVector3& normal,btScalar& impulse ,btScalar timeStep); btScalar distance, const btVector3& normal,btScalar& impulse ,btScalar timeStep);
#endif //CONTACT_CONSTRAINT_H #endif //CONTACT_CONSTRAINT_H
 End of changes. 2 change blocks. 
6 lines changed or deleted 0 lines changed or added


 btContactSolverInfo.h   btContactSolverInfo.h 
skipping to change at line 54 skipping to change at line 54
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 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;
int m_minimumSolverBatchSize;
}; };
struct btContactSolverInfo : public btContactSolverInfoData struct btContactSolverInfo : public btContactSolverInfoData
{ {
inline btContactSolverInfo() inline btContactSolverInfo()
{ {
m_tau = btScalar(0.6); m_tau = btScalar(0.6);
m_damping = btScalar(1.0); m_damping = btScalar(1.0);
skipping to change at line 78 skipping to change at line 79
m_erp = btScalar(0.2); m_erp = btScalar(0.2);
m_erp2 = btScalar(0.1); m_erp2 = btScalar(0.1);
m_globalCfm = btScalar(0.); m_globalCfm = btScalar(0.);
m_sor = btScalar(1.); 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_USE_WARMSTARTING | SOLVER_SIMD;// | SO LVER_RANDMIZE_ORDER; m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SO LVER_RANDMIZE_ORDER;
m_restingContactRestitutionThreshold = 2;//resting contact l ifetime threshold to disable restitution m_restingContactRestitutionThreshold = 2;//resting contact l ifetime threshold to disable restitution
m_minimumSolverBatchSize = 128; //try to combine islands unt il the amount of constraints reaches this limit
} }
}; };
#endif //CONTACT_SOLVER_INFO #endif //CONTACT_SOLVER_INFO
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 btConvexConvexAlgorithm.h   btConvexConvexAlgorithm.h 
skipping to change at line 35 skipping to change at line 35
#include "btCollisionDispatcher.h" #include "btCollisionDispatcher.h"
#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
///The convexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations between two conve x objects. ///The convexConvexAlgorithm collision algorithm implements time of impact, 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. ///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 ///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;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 btConvexHull.h   btConvexHull.h 
skipping to change at line 22 skipping to change at line 22
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.
*/ */
///includes modifications/improvements by John Ratcliff, see BringOutYourDe ad below. ///includes modifications/improvements by John Ratcliff, see BringOutYourDe ad below.
#ifndef CD_HULL_H #ifndef CD_HULL_H
#define CD_HULL_H #define CD_HULL_H
#include "LinearMath/btVector3.h" #include "btVector3.h"
#include "LinearMath/btAlignedObjectArray.h" #include "btAlignedObjectArray.h"
typedef btAlignedObjectArray<unsigned int> TUIntArray; typedef btAlignedObjectArray<unsigned int> TUIntArray;
class HullResult class HullResult
{ {
public: public:
HullResult(void) HullResult(void)
{ {
mPolygons = true; mPolygons = true;
mNumOutputVertices = 0; mNumOutputVertices = 0;
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 btConvexHullShape.h   btConvexHullShape.h 
skipping to change at line 83 skipping to change at line 83
virtual int getNumEdges() const; virtual int getNumEdges() const;
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const; virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
virtual void getVertex(int i,btVector3& vtx) const; virtual void getVertex(int i,btVector3& vtx) const;
virtual int getNumPlanes() const; virtual int getNumPlanes() const;
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport ,int i ) const; virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport ,int i ) const;
virtual bool isInside(const btVector3& pt,btScalar tolerance) const; virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
///in case we receive negative scaling ///in case we receive negative scaling
virtual void setLocalScaling(const btVector3& scaling); virtual void setLocalScaling(const btVector3& scaling);
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btConvexHullShapeData
{
btConvexInternalShapeData m_convexInternalShapeData;
btVector3FloatData *m_unscaledPointsFloatPtr;
btVector3DoubleData *m_unscaledPointsDoublePtr;
int m_numUnscaledPoints;
char m_padding3[4];
};
SIMD_FORCE_INLINE int btConvexHullShape::calculateSerializeBufferS
ize() const
{
return sizeof(btConvexHullShapeData);
}
#endif //CONVEX_HULL_SHAPE_H #endif //CONVEX_HULL_SHAPE_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 27 lines changed or added


 btConvexInternalShape.h   btConvexInternalShape.h 
skipping to change at line 53 skipping to change at line 53
} }
virtual btVector3 localGetSupportingVertex(const btVector3& ve c)const; virtual btVector3 localGetSupportingVertex(const btVector3& ve c)const;
const btVector3& getImplicitShapeDimensions() const const btVector3& getImplicitShapeDimensions() const
{ {
return m_implicitShapeDimensions; return m_implicitShapeDimensions;
} }
///warning: use setImplicitShapeDimensions with care
///changing a collision shape while the body is in the world is not
recommended,
///it is best to remove the body from the world, then make the chang
e, and re-add it
///alternatively flush the contact points, see documentation for 'cl
eanProxyFromPairs'
void setImplicitShapeDimensions(const btVector3& dimensions)
{
m_implicitShapeDimensions = dimensions;
}
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabb Max) const void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabb Max) const
{ {
getAabbSlow(t,aabbMin,aabbMax); getAabbSlow(t,aabbMin,aabbMax);
} }
virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btV ector3& aabbMax) const; virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btV ector3& aabbMax) const;
virtual void setLocalScaling(const btVector3& scaling); virtual void setLocalScaling(const btVector3& scaling);
virtual const btVector3& getLocalScaling() const virtual const btVector3& getLocalScaling() const
skipping to change at line 98 skipping to change at line 107
return 0; return 0;
} }
virtual void getPreferredPenetrationDirection(int index, btVector 3& penetrationVector) const virtual void getPreferredPenetrationDirection(int index, btVector 3& penetrationVector) const
{ {
(void)penetrationVector; (void)penetrationVector;
(void)index; (void)index;
btAssert(0); btAssert(0);
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btConvexInternalShapeData
{
btCollisionShapeData m_collisionShapeData;
btVector3FloatData m_localScaling;
btVector3FloatData m_implicitShapeDimensions;
float m_collisionMargin;
int m_padding;
};
SIMD_FORCE_INLINE int btConvexInternalShape::calculateSerializeBuf
ferSize() const
{
return sizeof(btConvexInternalShapeData);
}
///fills the dataBuffer and returns the struct name (and 0 on failure)
SIMD_FORCE_INLINE const char* btConvexInternalShape::serialize(voi
d* dataBuffer, btSerializer* serializer) const
{
btConvexInternalShapeData* shapeData = (btConvexInternalShapeData*)
dataBuffer;
btCollisionShape::serialize(&shapeData->m_collisionShapeData, serial
izer);
m_implicitShapeDimensions.serializeFloat(shapeData->m_implicitShapeD
imensions);
m_localScaling.serializeFloat(shapeData->m_localScaling);
shapeData->m_collisionMargin = float(m_collisionMargin);
return "btConvexInternalShapeData";
}
///btConvexInternalAabbCachingShape adds local aabb caching for convex shap es, to avoid expensive bounding box calculations ///btConvexInternalAabbCachingShape adds local aabb caching for convex shap es, to avoid expensive bounding box calculations
class btConvexInternalAabbCachingShape : public btConvexInternalShape class btConvexInternalAabbCachingShape : public btConvexInternalShape
{ {
btVector3 m_localAabbMin; btVector3 m_localAabbMin;
btVector3 m_localAabbMax; btVector3 m_localAabbMax;
bool m_isLocalAabbValid; bool m_isLocalAabbValid;
protected: protected:
btConvexInternalAabbCachingShape(); btConvexInternalAabbCachingShape();
 End of changes. 3 change blocks. 
0 lines changed or deleted 58 lines changed or added


 btCylinderShape.h   btCylinderShape.h 
skipping to change at line 107 skipping to change at line 107
{ {
return getHalfExtentsWithMargin().getX(); return getHalfExtentsWithMargin().getX();
} }
//debugging //debugging
virtual const char* getName()const virtual const char* getName()const
{ {
return "CylinderY"; return "CylinderY";
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
class btCylinderShapeX : public btCylinderShape class btCylinderShapeX : public btCylinderShape
{ {
public: public:
btCylinderShapeX (const btVector3& halfExtents); btCylinderShapeX (const btVector3& halfExtents);
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
skipping to change at line 155 skipping to change at line 160
return "CylinderZ"; return "CylinderZ";
} }
virtual btScalar getRadius() const virtual btScalar getRadius() const
{ {
return getHalfExtentsWithMargin().getX(); return getHalfExtentsWithMargin().getX();
} }
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btCylinderShapeData
{
btConvexInternalShapeData m_convexInternalShapeData;
int m_upAxis;
char m_padding[4];
};
SIMD_FORCE_INLINE int btCylinderShape::calculateSerializeBufferSiz
e() const
{
return sizeof(btCylinderShapeData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btCylinderShape::serialize(void* dat
aBuffer, btSerializer* serializer) const
{
btCylinderShapeData* shapeData = (btCylinderShapeData*) dataBuffer;
btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeDa
ta,serializer);
shapeData->m_upAxis = m_upAxis;
return "btCylinderShapeData";
}
#endif //CYLINDER_MINKOWSKI_H #endif //CYLINDER_MINKOWSKI_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 39 lines changed or added


 btDbvt.h   btDbvt.h 
skipping to change at line 34 skipping to change at line 34
// //
// Compile time configuration // Compile time configuration
// //
// Implementation profiles // Implementation profiles
#define DBVT_IMPL_GENERIC 0 // Generic implementation #define DBVT_IMPL_GENERIC 0 // Generic implementation
#define DBVT_IMPL_SSE 1 // SSE #define DBVT_IMPL_SSE 1 // SSE
// Template implementation of ICollide // Template implementation of ICollide
#ifdef WIN32 #ifdef _WIN32
#if (defined (_MSC_VER) && _MSC_VER >= 1400) #if (defined (_MSC_VER) && _MSC_VER >= 1400)
#define DBVT_USE_TEMPLATE 1 #define DBVT_USE_TEMPLATE 1
#else #else
#define DBVT_USE_TEMPLATE 0 #define DBVT_USE_TEMPLATE 0
#endif #endif
#else #else
#define DBVT_USE_TEMPLATE 0 #define DBVT_USE_TEMPLATE 0
#endif #endif
// Use only intrinsics instead of inline asm // Use only intrinsics instead of inline asm
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 (BT_USE_SSE) && defined (WIN32) #if defined (BT_USE_SSE) && defined (_WIN32)
#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 94 skipping to change at line 94
#define DBVT_CHECKTYPE static const ICollide& type checker=*(T*)1;(void)typechecker; #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__ #if !defined( __CELLOS_LV2__) && !defined(__MWERKS__)
#include <memory.h> #include <memory.h>
#endif #endif
#include <string.h> #include <string.h>
#endif #endif
#ifndef DBVT_USE_TEMPLATE #ifndef DBVT_USE_TEMPLATE
#error "DBVT_USE_TEMPLATE undefined" #error "DBVT_USE_TEMPLATE undefined"
#endif #endif
#ifndef DBVT_USE_MEMMOVE #ifndef DBVT_USE_MEMMOVE
skipping to change at line 936 skipping to change at line 936
inline void btDbvt::rayTestInternal( const btDbvtNode* ro ot, inline void btDbvt::rayTestInternal( const btDbvtNode* ro ot,
const btVect or3& rayFrom, const btVect or3& rayFrom,
const btVect or3& rayTo, const btVect or3& rayTo,
const btVect or3& rayDirectionInverse, const btVect or3& rayDirectionInverse,
unsigned int signs[3], unsigned int signs[3],
btScalar lam bda_max, btScalar lam bda_max,
const btVect or3& aabbMin, const btVect or3& aabbMin,
const btVect or3& aabbMax, const btVect or3& aabbMax,
DBVT_IPOLICY ) const DBVT_IPOLICY ) const
{ {
(void) rayTo;
DBVT_CHECKTYPE DBVT_CHECKTYPE
if(root) if(root)
{ {
btVector3 resultNormal; btVector3 resultNormal;
int depth=1; int depth=1;
int treshold=DOUBLE_STACKSIZE-2; int treshold=DOUBLE_STACKSIZE-2;
btAlignedObjectArray<const btDbvtNode*> stack; btAlignedObjectArray<const btDbvtNode*> stack;
stack.resize(DOUBLE_STACKSIZE); stack.resize(DOUBLE_STACKSIZE);
stack[0]=root; stack[0]=root;
btVector3 bounds[2]; btVector3 bounds[2];
do do
{ {
const btDbvtNode* node=stack[--depth]; const btDbvtNode* node=stack[--depth];
bounds[0] = node->volume.Mins()+aabbMin; bounds[0] = node->volume.Mins()-aabbMax;
bounds[1] = node->volume.Maxs()+aabbMax; bounds[1] = node->volume.Maxs()-aabbMin;
btScalar tmin=1.f,lambda_min=0.f; btScalar tmin=1.f,lambda_min=0.f;
unsigned int result1=false; unsigned int result1=false;
result1 = btRayAabb2(rayFrom,rayDirectionInverse,sig ns,bounds,tmin,lambda_min,lambda_max); result1 = btRayAabb2(rayFrom,rayDirectionInverse,sig ns,bounds,tmin,lambda_min,lambda_max);
if(result1) if(result1)
{ {
if(node->isinternal()) if(node->isinternal())
{ {
if(depth>treshold) if(depth>treshold)
{ {
stack.resize(stack.size()*2) ; stack.resize(stack.size()*2) ;
 End of changes. 5 change blocks. 
5 lines changed or deleted 6 lines changed or added


 btDbvtBroadphase.h   btDbvtBroadphase.h 
skipping to change at line 105 skipping to change at line 105
unsigned long m_fdcollide; unsigned long m_fdcollide;
unsigned long m_cleanup; unsigned long m_cleanup;
unsigned long m_jobcount; unsigned long m_jobcount;
} m_profiling; } m_profiling;
#endif #endif
/* Methods */ /* Methods */
btDbvtBroadphase(btOverlappingPairCache* paircache=0); btDbvtBroadphase(btOverlappingPairCache* paircache=0);
~btDbvtBroadphase(); ~btDbvtBroadphase();
void collide(btDi spatcher* dispatcher); void collide(btDi spatcher* dispatcher);
void optimize(); void optimize();
/* btBroadphaseInterface Implementation */ /* btBroadphaseInterface Implementation */
btBroadphaseProxy* createProxy(const bt Vector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispa tcher,void* multiSapProxy); btBroadphaseProxy* createProxy(const bt Vector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispa tcher,void* multiSapProxy);
void destroyProxy virtual void destroyProxy(btBroad
(btBroadphaseProxy* proxy,btDispatcher* dispatcher); phaseProxy* proxy,btDispatcher* dispatcher);
void setAabb(btBr virtual void setAabb(btBroadphase
oadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDi Proxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher
spatcher* dispatcher); * dispatcher);
virtual void rayTest(const btVector3& rayFrom,const btVector3& ra virtual void rayTest(const btVect
yTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVecto or3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,
r3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVec
tor3(0,0,0));
virtual void aabbTest(const btVec
tor3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback
);
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, virtual void getAabb(btBroadphase
btVector3& aabbMax ) const; Proxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
void calculateOve virtual void calculateOverlapping
rlappingPairs(btDispatcher* dispatcher); Pairs(btDispatcher* dispatcher);
btOverlappingPairCache* getOverlappingPairCache(); virtual btOverlappingPairCache* getOverlappingPairCache();
const btOverlappingPairCache* getOverlappingPairCache() const; virtual const btOverlappingPairCache* getOverlappingPairCache() co
void getBroadphas nst;
eAabb(btVector3& aabbMin,btVector3& aabbMax) const; virtual void getBroadphaseAabb(bt
void printStats() Vector3& aabbMin,btVector3& aabbMax) const;
; virtual void printStats();
static void benchmark(bt
BroadphaseInterface*); ///reset broadphase internal structures, to ensure determinism/repro
ducability
virtual void resetPool(btDispatcher* dispatcher);
void performDeferredRemoval(btDispatcher* dispatcher);
void setVelocityPrediction(btScalar prediction) void setVelocityPrediction(btScalar prediction)
{ {
m_prediction = prediction; m_prediction = prediction;
} }
btScalar getVelocityPrediction() const btScalar getVelocityPrediction() const
{ {
return m_prediction; return m_prediction;
} }
void performDeferredRemoval(btDispatcher* dispatcher); ///this setAabbForceUpdate is similar to setAabb but always forces t
he aabb update.
///it is not part of the btBroadphaseInterface but specific to btDbv
tBroadphase.
///it bypasses certain optimizations that prevent aabb updates (when
the aabb shrinks), see
///http://code.google.com/p/bullet/issues/detail?id=223
void setAabbForce
Update( btBroadphaseProxy* absproxy,const btVector3& aabbMin,co
nst btVector3& aabbMax,btDispatcher* /*dispatcher*/);
///reset broadphase internal structures, to ensure determinism/repro static void benchmark(bt
ducability BroadphaseInterface*);
virtual void resetPool(btDispatcher* dispatcher);
}; };
#endif #endif
 End of changes. 5 change blocks. 
24 lines changed or deleted 41 lines changed or added


 btDefaultCollisionConfiguration.h   btDefaultCollisionConfiguration.h 
skipping to change at line 111 skipping to change at line 111
virtual btPoolAllocator* getCollisionAlgorithmPool() virtual btPoolAllocator* getCollisionAlgorithmPool()
{ {
return m_collisionAlgorithmPool; return m_collisionAlgorithmPool;
} }
virtual btStackAlloc* getStackAllocator() virtual btStackAlloc* getStackAllocator()
{ {
return m_stackAlloc; return m_stackAlloc;
} }
virtual btVoronoiSimplexSolver* getSimplexSolver()
{
return m_simplexSolver;
}
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. ///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. ///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 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 ///@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. ///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. ///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. ///@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); void setConvexConvexMultipointIterations(int numPerturbationItera tions=3, int minimumPointsPerturbationThreshold = 3);
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 btDefaultMotionState.h   btDefaultMotionState.h 
#ifndef DEFAULT_MOTION_STATE_H #ifndef DEFAULT_MOTION_STATE_H
#define DEFAULT_MOTION_STATE_H #define DEFAULT_MOTION_STATE_H
#include "btMotionState.h"
///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets. ///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets.
struct btDefaultMotionState : public btMotionState struct btDefaultMotionState : public btMotionState
{ {
btTransform m_graphicsWorldTrans; btTransform m_graphicsWorldTrans;
btTransform m_centerOfMassOffset; btTransform m_centerOfMassOffset;
btTransform m_startWorldTrans; btTransform m_startWorldTrans;
void* m_userPointer; void* m_userPointer;
btDefaultMotionState(const btTransform& startTrans = btTransform::ge tIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentit y()) btDefaultMotionState(const btTransform& startTrans = btTransform::ge tIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentit y())
: m_graphicsWorldTrans(startTrans), : m_graphicsWorldTrans(startTrans),
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 btDiscreteDynamicsWorld.h   btDiscreteDynamicsWorld.h 
skipping to change at line 77 skipping to change at line 77
void updateActivationState(btScalar timeStep); void updateActivationState(btScalar timeStep);
void updateActions(btScalar timeStep); void updateActions(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 serializeRigidBodies(btSerializer* serializer);
public: public:
///this btDiscreteDynamicsWorld constructor gets created objects fro m the user, and will not delete those ///this btDiscreteDynamicsWorld constructor gets created objects fro m the user, and will not delete those
btDiscreteDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterfa ce* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration * collisionConfiguration); btDiscreteDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterfa ce* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration * collisionConfiguration);
virtual ~btDiscreteDynamicsWorld(); virtual ~btDiscreteDynamicsWorld();
///if maxSubSteps > 0, it will interpolate motion between fixedTimeS tep's ///if maxSubSteps > 0, it will interpolate motion between fixedTimeS tep's
virtual int stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.)); virtual int stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.));
skipping to change at line 132 skipping to change at line 132
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);
///removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise call btCollisionWorld::removeCollisionObj ect ///removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise call btCollisionWorld::removeCollisionObj ect
virtual void removeCollisionObject(btCollisionObject* collisionOb ject); virtual void removeCollisionObject(btCollisionObject* collisionOb ject);
void debugDrawObject(const btTransform& worldTransform, const btC
ollisionShape* shape, const btVector3& color);
void debugDrawConstraint(btTypedConstraint* constraint); 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;
skipping to change at line 188 skipping to change at line 186
void setSynchronizeAllMotionStates(bool synchronizeAll) void setSynchronizeAllMotionStates(bool synchronizeAll)
{ {
m_synchronizeAllMotionStates = synchronizeAll; m_synchronizeAllMotionStates = synchronizeAll;
} }
bool getSynchronizeAllMotionStates() const bool getSynchronizeAllMotionStates() const
{ {
return m_synchronizeAllMotionStates; return m_synchronizeAllMotionStates;
} }
///Preliminary serialization test for Bullet 2.76. Loading those fil
es requires a separate parser (see Bullet/Demos/SerializeDemo)
virtual void serialize(btSerializer* serializer);
}; };
#endif //BT_DISCRETE_DYNAMICS_WORLD_H #endif //BT_DISCRETE_DYNAMICS_WORLD_H
 End of changes. 3 change blocks. 
4 lines changed or deleted 5 lines changed or added


 btGImpactShape.h   btGImpactShape.h 
skipping to change at line 181 skipping to change at line 181
child->setMargin(margin); child->setMargin(margin);
} }
m_needs_update = true; m_needs_update = true;
} }
//! Subshape member functions //! Subshape member functions
//!@{ //!@{
//! Base method for determinig which kind of GIMPACT shape we get //! Base method for determinig which kind of GIMPACT shape we get
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() = 0; virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const = 0 ;
//! gets boxset //! gets boxset
SIMD_FORCE_INLINE btGImpactBoxSet * getBoxSet() SIMD_FORCE_INLINE btGImpactBoxSet * getBoxSet()
{ {
return &m_box_set; return &m_box_set;
} }
//! Determines if this class has a hierarchy structure for sorting i ts primitives //! Determines if this class has a hierarchy structure for sorting i ts primitives
SIMD_FORCE_INLINE bool hasBoxSet() const SIMD_FORCE_INLINE bool hasBoxSet() const
{ {
skipping to change at line 262 skipping to change at line 262
/*! /*!
\post You must call updateBound() for update the box set. \post You must call updateBound() for update the box set.
*/ */
virtual void setChildTransform(int index, const btTransform & transf orm) = 0; virtual void setChildTransform(int index, const btTransform & transf orm) = 0;
//!@} //!@}
//! virtual method for ray collision //! virtual method for ray collision
virtual void rayTest(const btVector3& rayFrom, const btVector3& rayT o, btCollisionWorld::RayResultCallback& resultCallback) const virtual void rayTest(const btVector3& rayFrom, const btVector3& rayT o, btCollisionWorld::RayResultCallback& resultCallback) const
{ {
(void) rayFrom; (void) rayTo; (void) resultCallback;
} }
//! Function for retrieve triangles. //! Function for retrieve triangles.
/*! /*!
It gives the triangles in local space It gives the triangles in local space
*/ */
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
{ {
(void) callback; (void) aabbMin; (void) aabbMax;
} }
//!@} //!@}
}; };
//! btGImpactCompoundShape allows to handle multiple btCollisionShape objec ts at once //! btGImpactCompoundShape allows to handle multiple btCollisionShape objec ts at once
/*! /*!
This class only can manage Convex subshapes This class only can manage Convex subshapes
*/ */
skipping to change at line 291 skipping to change at line 293
{ {
public: public:
//! compound primitive manager //! compound primitive manager
class CompoundPrimitiveManager:public btPrimitiveManagerBase class CompoundPrimitiveManager:public btPrimitiveManagerBase
{ {
public: public:
virtual ~CompoundPrimitiveManager() {} virtual ~CompoundPrimitiveManager() {}
btGImpactCompoundShape * m_compoundShape; btGImpactCompoundShape * m_compoundShape;
CompoundPrimitiveManager(const CompoundPrimitiveManager& com pound) CompoundPrimitiveManager(const CompoundPrimitiveManager& com pound)
: btPrimitiveManagerBase()
{ {
m_compoundShape = compound.m_compoundShape; m_compoundShape = compound.m_compoundShape;
} }
CompoundPrimitiveManager(btGImpactCompoundShape * compoundSh ape) CompoundPrimitiveManager(btGImpactCompoundShape * compoundSh ape)
{ {
m_compoundShape = compoundShape; m_compoundShape = compoundShape;
} }
CompoundPrimitiveManager() CompoundPrimitiveManager()
skipping to change at line 333 skipping to change at line 336
{ {
prim_trans.setIdentity(); prim_trans.setIdentity();
} }
const btCollisionShape* shape = m_compoundShape->get ChildShape(prim_index); const btCollisionShape* shape = m_compoundShape->get ChildShape(prim_index);
shape->getAabb(prim_trans,primbox.m_min,primbox.m_ma x); shape->getAabb(prim_trans,primbox.m_min,primbox.m_ma x);
} }
virtual void get_primitive_triangle(int prim_index,btPrimiti veTriangle & triangle) const virtual void get_primitive_triangle(int prim_index,btPrimiti veTriangle & triangle) const
{ {
btAssert(0); btAssert(0);
(void) prim_index; (void) triangle;
} }
}; };
protected: protected:
CompoundPrimitiveManager m_primitive_manager; CompoundPrimitiveManager m_primitive_manager;
btAlignedObjectArray<btTransform> m_childTransforms; btAlignedObjectArray<btTransform> m_childTransforms;
btAlignedObjectArray<btCollisionShape*> m_childShapes; btAlignedObjectArray<btCollisionShape*> m_childShapes;
public: public:
btGImpactCompoundShape(bool children_has_transform = true) btGImpactCompoundShape(bool children_has_transform = true)
{ {
(void) children_has_transform;
m_primitive_manager.m_compoundShape = this; m_primitive_manager.m_compoundShape = this;
m_box_set.setPrimitiveManager(&m_primitive_manager); m_box_set.setPrimitiveManager(&m_primitive_manager);
} }
virtual ~btGImpactCompoundShape() virtual ~btGImpactCompoundShape()
{ {
} }
//! if true, then its children must get transforms. //! if true, then its children must get transforms.
virtual bool childrenHasTransform() const virtual bool childrenHasTransform() const
skipping to change at line 454 skipping to change at line 459
} }
//! Determines if this shape has tetrahedrons //! Determines if this shape has tetrahedrons
virtual bool needsRetrieveTetrahedrons() const virtual bool needsRetrieveTetrahedrons() const
{ {
return false; return false;
} }
virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & tr iangle) const virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & tr iangle) const
{ {
(void) prim_index; (void) triangle;
btAssert(0); btAssert(0);
} }
virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const
{ {
(void) prim_index; (void) tetrahedron;
btAssert(0); btAssert(0);
} }
//! Calculates the exact inertia tensor for this shape //! Calculates the exact inertia tensor for this shape
virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const;
virtual const char* getName()const virtual const char* getName()const
{ {
return "GImpactCompound"; return "GImpactCompound";
} }
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
{ {
return CONST_GIMPACT_COMPOUND_SHAPE; return CONST_GIMPACT_COMPOUND_SHAPE;
} }
}; };
//! This class manages a sub part of a mesh supplied by the btStridingMeshI nterface interface. //! This class manages a sub part of a mesh supplied by the btStridingMeshI nterface interface.
/*! /*!
- Simply create this shape by passing the btStridingMeshInterface to the co nstructor btGImpactMeshShapePart, then you must call updateBound() after cr eating the mesh - Simply create this shape by passing the btStridingMeshInterface to the co nstructor btGImpactMeshShapePart, then you must call updateBound() after cr eating the mesh
- When making operations with this shape, you must call <b>lock</b> before accessing to the trimesh primitives, and then call <b>unlock</b> - When making operations with this shape, you must call <b>lock</b> before accessing to the trimesh primitives, and then call <b>unlock</b>
skipping to change at line 524 skipping to change at line 531
m_lock_count = 0; m_lock_count = 0;
vertexbase = 0; vertexbase = 0;
numverts = 0; numverts = 0;
stride = 0; stride = 0;
indexbase = 0; indexbase = 0;
indexstride = 0; indexstride = 0;
numfaces = 0; numfaces = 0;
} }
TrimeshPrimitiveManager(const TrimeshPrimitiveManager & mana ger) TrimeshPrimitiveManager(const TrimeshPrimitiveManager & mana ger)
: btPrimitiveManagerBase()
{ {
m_meshInterface = manager.m_meshInterface; m_meshInterface = manager.m_meshInterface;
m_part = manager.m_part; m_part = manager.m_part;
m_margin = manager.m_margin; m_margin = manager.m_margin;
m_scale = manager.m_scale; m_scale = manager.m_scale;
m_lock_count = 0; m_lock_count = 0;
vertexbase = 0; vertexbase = 0;
numverts = 0; numverts = 0;
stride = 0; stride = 0;
indexbase = 0; indexbase = 0;
skipping to change at line 717 skipping to change at line 725
//! Gets the number of children //! Gets the number of children
virtual int getNumChildShapes() const virtual int getNumChildShapes() const
{ {
return m_primitive_manager.get_primitive_count(); return m_primitive_manager.get_primitive_count();
} }
//! Gets the children //! Gets the children
virtual btCollisionShape* getChildShape(int index) virtual btCollisionShape* getChildShape(int index)
{ {
(void) index;
btAssert(0); btAssert(0);
return NULL; return NULL;
} }
//! Gets the child //! Gets the child
virtual const btCollisionShape* getChildShape(int index) const virtual const btCollisionShape* getChildShape(int index) const
{ {
(void) index;
btAssert(0); btAssert(0);
return NULL; return NULL;
} }
//! Gets the children transform //! Gets the children transform
virtual btTransform getChildTransform(int index) const virtual btTransform getChildTransform(int index) const
{ {
(void) index;
btAssert(0); btAssert(0);
return btTransform(); return btTransform();
} }
//! Sets the children transform //! Sets the children transform
/*! /*!
\post You must call updateBound() for update the box set. \post You must call updateBound() for update the box set.
*/ */
virtual void setChildTransform(int index, const btTransform & transf orm) virtual void setChildTransform(int index, const btTransform & transf orm)
{ {
(void) index;
(void) transform;
btAssert(0); btAssert(0);
} }
//! Obtains the primitive manager //! Obtains the primitive manager
virtual const btPrimitiveManagerBase * getPrimitiveManager() const virtual const btPrimitiveManagerBase * getPrimitiveManager() const
{ {
return &m_primitive_manager; return &m_primitive_manager;
} }
SIMD_FORCE_INLINE TrimeshPrimitiveManager * getTrimeshPrimitiveManag er() SIMD_FORCE_INLINE TrimeshPrimitiveManager * getTrimeshPrimitiveManag er()
skipping to change at line 762 skipping to change at line 775
return &m_primitive_manager; return &m_primitive_manager;
} }
virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const; virtual void calculateLocalInertia(btScalar mass,btVector3& inert ia) const;
virtual const char* getName()const virtual const char* getName()const
{ {
return "GImpactMeshShapePart"; return "GImpactMeshShapePart";
} }
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
{ {
return CONST_GIMPACT_TRIMESH_SHAPE_PART; return CONST_GIMPACT_TRIMESH_SHAPE_PART;
} }
//! Determines if this shape has triangles //! Determines if this shape has triangles
virtual bool needsRetrieveTriangles() const virtual bool needsRetrieveTriangles() const
{ {
return true; return true;
} }
skipping to change at line 786 skipping to change at line 799
return false; return false;
} }
virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & tr iangle) const virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & tr iangle) const
{ {
m_primitive_manager.get_bullet_triangle(prim_index,triangle) ; m_primitive_manager.get_bullet_triangle(prim_index,triangle) ;
} }
virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const
{ {
(void) prim_index;
(void) tetrahedron;
btAssert(0); btAssert(0);
} }
SIMD_FORCE_INLINE int getVertexCount() const SIMD_FORCE_INLINE int getVertexCount() const
{ {
return m_primitive_manager.get_vertex_count(); return m_primitive_manager.get_vertex_count();
} }
SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 & verte x) const SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 & verte x) const
{ {
skipping to change at line 987 skipping to change at line 1002
//! Determines if this shape has tetrahedrons //! Determines if this shape has tetrahedrons
virtual bool needsRetrieveTetrahedrons() const virtual bool needsRetrieveTetrahedrons() const
{ {
btAssert(0); btAssert(0);
return false; return false;
} }
virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & tr iangle) const virtual void getBulletTriangle(int prim_index,btTriangleShapeEx & tr iangle) const
{ {
(void) prim_index; (void) triangle;
btAssert(0); btAssert(0);
} }
virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const virtual void getBulletTetrahedron(int prim_index,btTetrahedronShapeE x & tetrahedron) const
{ {
(void) prim_index; (void) tetrahedron;
btAssert(0); btAssert(0);
} }
//! call when reading child shapes //! call when reading child shapes
virtual void lockChildShapes() const virtual void lockChildShapes() const
{ {
btAssert(0); btAssert(0);
} }
virtual void unlockChildShapes() const 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
{ {
(void) child_index; (void) t; (void) aabbMin; (void) aabbMax;
btAssert(0); btAssert(0);
} }
//! Gets the children //! Gets the children
virtual btCollisionShape* getChildShape(int index) virtual btCollisionShape* getChildShape(int index)
{ {
(void) index;
btAssert(0); btAssert(0);
return NULL; return NULL;
} }
//! Gets the child //! Gets the child
virtual const btCollisionShape* getChildShape(int index) const virtual const btCollisionShape* getChildShape(int index) const
{ {
(void) index;
btAssert(0); btAssert(0);
return NULL; return NULL;
} }
//! Gets the children transform //! Gets the children transform
virtual btTransform getChildTransform(int index) const virtual btTransform getChildTransform(int index) const
{ {
(void) index;
btAssert(0); btAssert(0);
return btTransform(); return btTransform();
} }
//! Sets the children transform //! Sets the children transform
/*! /*!
\post You must call updateBound() for update the box set. \post You must call updateBound() for update the box set.
*/ */
virtual void setChildTransform(int index, const btTransform & transf orm) virtual void setChildTransform(int index, const btTransform & transf orm)
{ {
(void) index; (void) transform;
btAssert(0); btAssert(0);
} }
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
{ {
return CONST_GIMPACT_TRIMESH_SHAPE; return CONST_GIMPACT_TRIMESH_SHAPE;
} }
virtual const char* getName()const virtual const char* getName()const
{ {
return "GImpactMesh"; return "GImpactMesh";
} }
virtual void rayTest(const btVector3& rayFrom, const btVector3& rayT o, btCollisionWorld::RayResultCallback& resultCallback) const; virtual void rayTest(const btVector3& rayFrom, const btVector3& rayT o, btCollisionWorld::RayResultCallback& resultCallback) const;
//! Function for retrieve triangles. //! Function for retrieve triangles.
/*! /*!
It gives the triangles in local space It gives the triangles in local space
*/ */
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 int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btGImpactMeshShapeData
{
btCollisionShapeData m_collisionShapeData;
btStridingMeshInterfaceData m_meshInterface;
btVector3FloatData m_localScaling;
float m_collisionMargin;
int m_gimpactSubType;
};
SIMD_FORCE_INLINE int btGImpactMeshShape::calculateSerializeBuffer
Size() const
{
return sizeof(btGImpactMeshShapeData);
}
#endif //GIMPACT_MESH_SHAPE_H #endif //GIMPACT_MESH_SHAPE_H
 End of changes. 26 change blocks. 
4 lines changed or deleted 55 lines changed or added


 btGeneric6DofConstraint.h   btGeneric6DofConstraint.h 
skipping to change at line 48 skipping to change at line 48
public: public:
//! limit_parameters //! limit_parameters
//!@{ //!@{
btScalar m_loLimit;//!< joint limit btScalar m_loLimit;//!< joint limit
btScalar m_hiLimit;//!< joint limit btScalar m_hiLimit;//!< joint limit
btScalar m_targetVelocity;//!< target motor velocity btScalar m_targetVelocity;//!< target motor velocity
btScalar m_maxMotorForce;//!< max force on motor btScalar m_maxMotorForce;//!< max force on motor
btScalar m_maxLimitForce;//!< max force on limit btScalar m_maxLimitForce;//!< max force on limit
btScalar m_damping;//!< Damping. btScalar m_damping;//!< Damping.
btScalar m_limitSoftness;//! Relaxation factor btScalar m_limitSoftness;//! Relaxation factor
btScalar m_ERP;//!< Error tolerance factor when joint is at limit btScalar m_normalCFM;//!< Constraint force mixing factor
btScalar m_stopERP;//!< Error tolerance factor when joint is at limit
btScalar m_stopCFM;//!< Constraint force mixing factor when joint is at
limit
btScalar m_bounce;//!< restitution factor btScalar m_bounce;//!< restitution factor
bool m_enableMotor; bool m_enableMotor;
//!@} //!@}
//! temp_variables //! temp_variables
//!@{ //!@{
btScalar m_currentLimitError;//! How much is violated this limit btScalar m_currentLimitError;//! How much is violated this limit
btScalar m_currentPosition; //! current value of angle btScalar m_currentPosition; //! current value of angle
int m_currentLimit;//!< 0=free, 1=at lo limit, 2=at hi limit int m_currentLimit;//!< 0=free, 1=at lo limit, 2=at hi limit
skipping to change at line 70 skipping to change at line 72
//!@} //!@}
btRotationalLimitMotor() btRotationalLimitMotor()
{ {
m_accumulatedImpulse = 0.f; m_accumulatedImpulse = 0.f;
m_targetVelocity = 0; m_targetVelocity = 0;
m_maxMotorForce = 0.1f; m_maxMotorForce = 0.1f;
m_maxLimitForce = 300.0f; m_maxLimitForce = 300.0f;
m_loLimit = 1.0f; m_loLimit = 1.0f;
m_hiLimit = -1.0f; m_hiLimit = -1.0f;
m_ERP = 0.5f; m_normalCFM = 0.f;
m_stopERP = 0.2f;
m_stopCFM = 0.f;
m_bounce = 0.0f; m_bounce = 0.0f;
m_damping = 1.0f; m_damping = 1.0f;
m_limitSoftness = 0.5f; m_limitSoftness = 0.5f;
m_currentLimit = 0; m_currentLimit = 0;
m_currentLimitError = 0; m_currentLimitError = 0;
m_enableMotor = false; m_enableMotor = false;
} }
btRotationalLimitMotor(const btRotationalLimitMotor & limot) btRotationalLimitMotor(const btRotationalLimitMotor & limot)
{ {
m_targetVelocity = limot.m_targetVelocity; m_targetVelocity = limot.m_targetVelocity;
m_maxMotorForce = limot.m_maxMotorForce; m_maxMotorForce = limot.m_maxMotorForce;
m_limitSoftness = limot.m_limitSoftness; m_limitSoftness = limot.m_limitSoftness;
m_loLimit = limot.m_loLimit; m_loLimit = limot.m_loLimit;
m_hiLimit = limot.m_hiLimit; m_hiLimit = limot.m_hiLimit;
m_ERP = limot.m_ERP; m_normalCFM = limot.m_normalCFM;
m_stopERP = limot.m_stopERP;
m_stopCFM = limot.m_stopCFM;
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;
skipping to change at line 114 skipping to change at line 120
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, btSolverBody& bodyA,btRigidBody * body1, btSolverBody& bodyB); btScalar solveAngularLimits(btScalar timeStep,btVector3& axis, btScalar jacDiagABInv,btRigidBody * body0, btRigidBody * body1);
}; };
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
btVector3 m_normalCFM;//!< Constraint force mixing factor
btVector3 m_stopERP;//!< Error tolerance factor when joint is at limit
btVector3 m_stopCFM;//!< Constraint force mixing factor when j
oint is at limit
//!@} //!@}
bool m_enableMotor[3]; bool m_enableMotor[3];
btVector3 m_targetVelocity;//!< target motor velocity btVector3 m_targetVelocity;//!< target motor velocity
btVector3 m_maxMotorForce;//!< max force on motor btVector3 m_maxMotorForce;//!< max force on motor
btVector3 m_currentLimitError;//! How much is violated this limit btVector3 m_currentLimitError;//! How much is violated this limit
btVector3 m_currentLinearDiff;//! Current relative offset of constrai nt frames btVector3 m_currentLinearDiff;//! Current relative offset of constrai nt frames
int m_currentLimit[3];//!< 0=free, 1=at lower li mit, 2=at upper 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_normalCFM.setValue(0.f, 0.f, 0.f);
m_stopERP.setValue(0.2f, 0.2f, 0.2f);
m_stopCFM.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++) for(int i=0; i < 3; i++)
{ {
m_enableMotor[i] = false; m_enableMotor[i] = false;
m_targetVelocity[i] = btScalar(0.f); m_targetVelocity[i] = btScalar(0.f);
m_maxMotorForce[i] = btScalar(0.f); m_maxMotorForce[i] = btScalar(0.f);
} }
skipping to change at line 163 skipping to change at line 175
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;
m_normalCFM = other.m_normalCFM;
m_stopERP = other.m_stopERP;
m_stopCFM = other.m_stopCFM;
for(int i=0; i < 3; i++) for(int i=0; i < 3; i++)
{ {
m_enableMotor[i] = other.m_enableMotor[i]; m_enableMotor[i] = other.m_enableMotor[i];
m_targetVelocity[i] = other.m_targetVelocity[i]; m_targetVelocity[i] = other.m_targetVelocity[i];
m_maxMotorForce[i] = other.m_maxMotorForce[i]; m_maxMotorForce[i] = other.m_maxMotorForce[i];
} }
} }
//! Test limit //! Test limit
/*! /*!
skipping to change at line 192 skipping to change at line 208
inline bool needApplyForce(int limitIndex) inline bool needApplyForce(int limitIndex)
{ {
if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == f alse) return false; if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == f alse) return false;
return true; return true;
} }
int testLimitValue(int limitIndex, btScalar test_value); int testLimitValue(int limitIndex, btScalar test_value);
btScalar solveLinearAxis( btScalar solveLinearAxis(
btScalar timeStep, btScalar timeStep,
btScalar jacDiagABInv, btScalar jacDiagABInv,
btRigidBody& body1,btSolverBody& bodyA,const btVector3 &pointInA, btRigidBody& body1,const btVector3 &pointInA,
btRigidBody& body2,btSolverBody& bodyB,const btVector3 &pointInB, btRigidBody& body2,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);
}; };
enum bt6DofFlags
{
BT_6DOF_FLAGS_CFM_NORM = 1,
BT_6DOF_FLAGS_CFM_STOP = 2,
BT_6DOF_FLAGS_ERP_STOP = 4
};
#define BT_6DOF_FLAGS_AXIS_SHIFT 3 // bits per axis
/// 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>
<ul> <ul>
<li> For Linear limits, use btGeneric6DofConstraint.setLinearUpperLimit, bt Generic6DofConstraint.setLinearLowerLimit. You can set the parameters with the btTranslationalLimitMotor structure accsesible through the btGeneric6Do fConstraint.getTranslationalLimitMotor method. <li> For Linear limits, use btGeneric6DofConstraint.setLinearUpperLimit, bt Generic6DofConstraint.setLinearLowerLimit. You can set the parameters with the btTranslationalLimitMotor structure accsesible through the btGeneric6Do fConstraint.getTranslationalLimitMotor method.
At this moment translational motors are not supported. May be in the future . </li> At this moment translational motors are not supported. May be in the future . </li>
<li> For Angular limits, use the btRotationalLimitMotor structure for confi guring the limit. <li> For Angular limits, use the btRotationalLimitMotor structure for confi guring the limit.
This is accessible through btGeneric6DofConstraint.getLimitMotor method, This is accessible through btGeneric6DofConstraint.getLimitMotor method,
This brings support for limit parameters and motors. </li> This brings support for limit parameters and motors. </li>
<li> Angulars limits have these possible ranges: <li> Angulars limits have these possible ranges:
<table border=1 > <table border=1 >
<tr <tr>
<td><b>AXIS</b></td> <td><b>AXIS</b></td>
<td><b>MIN ANGLE</b></td> <td><b>MIN ANGLE</b></td>
<td><b>MAX ANGLE</b></td> <td><b>MAX ANGLE</b></td>
</tr><tr>
<td>X</td> <td>X</td>
<td>-PI</td> <td>-PI</td>
<td>PI</td> <td>PI</td>
</tr><tr>
<td>Y</td> <td>Y</td>
<td>-PI/2</td> <td>-PI/2</td>
<td>PI/2</td> <td>PI/2</td>
</tr><tr>
<td>Z</td> <td>Z</td>
<td>-PI/2</td> <td>-PI</td>
<td>PI/2</td> <td>PI</td>
</tr> </tr>
</table> </table>
</li> </li>
</ul> </ul>
*/ */
class btGeneric6DofConstraint : public btTypedConstraint class btGeneric6DofConstraint : public btTypedConstraint
{ {
protected: protected:
skipping to change at line 269 skipping to change at line 295
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_calculatedLinearDiff;
btScalar m_factA;
btScalar m_factB;
bool m_hasStaticBody;
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;
bool m_useOffsetForConstraintFrame;
int m_flags;
//!@} //!@}
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,const b tTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB); int setAngularLimits(btConstraintInfo2 *info, int row_offset,const b tTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB);
int setLinearLimits(btConstraintInfo2 *info,const btTransform& trans A,const btTransform& transB,const btVector3& linVelA,const btVector3& linVe lB,const btVector3& angVelA,const btVector3& angVelB); int setLinearLimits(btConstraintInfo2 *info, int row, const btTransf orm& transA,const btTransform& transB,const btVector3& linVelA,const btVect or3& linVelB,const btVector3& angVelA,const btVector3& angVelB);
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 // tests linear limits
void calculateLinearInfo(); 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' ///for backwards compatibility during the transition to 'getInfo/get Info2'
bool m_useSolveConstraintObsolete; 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(btRigidBody& rbB, const btTransform& frameInB,
btGeneric6DofConstraint(); bool useLinearReferenceFrameB);
//! 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(const btTransform& transA,const btTransform& t ransB); void calculateTransforms(const btTransform& transA,const btTransform& t ransB);
void calculateTransforms(); void calculateTransforms();
skipping to change at line 366 skipping to change at line 397
virtual void buildJacobian(); virtual void buildJacobian();
virtual void getInfo1 (btConstraintInfo1* info); virtual void getInfo1 (btConstraintInfo1* info);
void getInfo1NonVirtual (btConstraintInfo1* info); void getInfo1NonVirtual (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info); virtual void getInfo2 (btConstraintInfo2* info);
void getInfo2NonVirtual (btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB); void getInfo2NonVirtual (btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB);
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 467 skipping to change at line 496
return m_linearLimits.isLimited(limitIndex); return m_linearLimits.isLimited(limitIndex);
} }
return m_angularLimits[limitIndex-3].isLimited(); return m_angularLimits[limitIndex-3].isLimited();
} }
virtual void calcAnchorPos(void); // overridable virtual void calcAnchorPos(void); // overridable
int get_limit_motor_info2( btRotationalLimitMotor * limot, int get_limit_motor_info2( btRotationalLimitMotor * limot,
const btTran sform& transA,const btTransform& transB,const btVector3& linVelA,const btVe ctor3& linVelB,const btVector3& angVelA,const btVector3& angVelB, const btTran sform& transA,const btTransform& transB,const btVector3& linVelA,const btVe ctor3& linVelB,const btVector3& angVelA,const btVector3& angVelB,
btConstraint btConstraint
Info2 *info, int row, btVector3& ax1, int rotational); Info2 *info, int row, btVector3& ax1, int rotational, int rotAllowed = fals
e);
// access for UseFrameOffset
bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; }
///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constra
int.
virtual void setParam(int num, btScalar value, int axis = -1);
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btGeneric6DofConstraintData
{
btTypedConstraintData m_typeConstraintData;
btTransformFloatData m_rbAFrame; // constraint axii. Assumes z is hi
nge axis.
btTransformFloatData m_rbBFrame;
btVector3FloatData m_linearUpperLimit;
btVector3FloatData m_linearLowerLimit;
btVector3FloatData m_angularUpperLimit;
btVector3FloatData m_angularLowerLimit;
int m_useLinearReferenceFrameA;
int m_useOffsetForConstraintFrame;
};
SIMD_FORCE_INLINE int btGeneric6DofConstraint::calculateSerializeB
ufferSize() const
{
return sizeof(btGeneric6DofConstraintData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btGeneric6DofConstraint::serialize(v
oid* dataBuffer, btSerializer* serializer) const
{
btGeneric6DofConstraintData* dof = (btGeneric6DofConstraintData*)dat
aBuffer;
btTypedConstraint::serialize(&dof->m_typeConstraintData,serializer);
m_frameInA.serializeFloat(dof->m_rbAFrame);
m_frameInB.serializeFloat(dof->m_rbBFrame);
int i;
for (i=0;i<3;i++)
{
dof->m_angularLowerLimit.m_floats[i] = float(m_angularLimit
s[i].m_loLimit);
dof->m_angularUpperLimit.m_floats[i] = float(m_angularLimit
s[i].m_hiLimit);
dof->m_linearLowerLimit.m_floats[i] = float(m_linearLimits.m
_lowerLimit[i]);
dof->m_linearUpperLimit.m_floats[i] = float(m_linearLimits.m
_upperLimit[i]);
}
dof->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA? 1 : 0;
dof->m_useOffsetForConstraintFrame = m_useOffsetForConstraintFrame ?
1 : 0;
return "btGeneric6DofConstraintData";
}
#endif //GENERIC_6DOF_CONSTRAINT_H #endif //GENERIC_6DOF_CONSTRAINT_H
 End of changes. 21 change blocks. 
22 lines changed or deleted 132 lines changed or added


 btGpuDefines.h   btGpuDefines.h 
skipping to change at line 191 skipping to change at line 191
inline float3 operator-(const float3& v) inline float3 operator-(const float3& v)
{ {
float3 r; r.x = -v.x; r.y = -v.y; r.z = -v.z; return r; float3 r; r.x = -v.x; r.y = -v.y; r.z = -v.z; return r;
} }
#define BT_GPU_FETCH(a, b) a[b] #define BT_GPU_FETCH(a, b) a[b]
#define BT_GPU_FETCH4(a, b) a[b] #define BT_GPU_FETCH4(a, b) a[b]
#define BT_GPU_PREF(func) btGpu_##func #define BT_GPU_PREF(func) btGpu_##func
#define BT_GPU_SAFE_CALL(func) func #define BT_GPU_SAFE_CALL(func) func
#define BT_GPU_Memset memset #define BT_GPU_Memset memset
#define BT_GPU_MemcpyToSymbol(a, b, c) memcpy(a, b, c) #define BT_GPU_MemcpyToSymbol(a, b, c) memcpy(&a, b, c)
#define BT_GPU_BindTexture(a, b, c, d) #define BT_GPU_BindTexture(a, b, c, d)
#define BT_GPU_UnbindTexture(a) #define BT_GPU_UnbindTexture(a)
static uint2 s_blockIdx, s_blockDim, s_threadIdx; static uint2 s_blockIdx, s_blockDim, s_threadIdx;
#define BT_GPU_blockIdx s_blockIdx #define BT_GPU_blockIdx s_blockIdx
#define BT_GPU_blockDim s_blockDim #define BT_GPU_blockDim s_blockDim
#define BT_GPU_threadIdx s_threadIdx #define BT_GPU_threadIdx s_threadIdx
#define BT_GPU_EXECKERNEL(numb, numt, kfunc, args) {s_blockDim.x=numt;for(i nt nb=0;nb<numb;nb++){s_blockIdx.x=nb;for(int nt=0;nt<numt;nt++){s_threadId x.x=nt;kfunc args;}}} #define BT_GPU_EXECKERNEL(numb, numt, kfunc, args) {s_blockDim.x=numt;for(i nt nb=0;nb<numb;nb++){s_blockIdx.x=nb;for(int nt=0;nt<numt;nt++){s_threadId x.x=nt;kfunc args;}}}
#define BT_GPU_CHECK_ERROR(s) #define BT_GPU_CHECK_ERROR(s)
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 btGpuUtilsSharedDefs.h   btGpuUtilsSharedDefs.h 
/* /*
Bullet Continuous Collision Detection and Physics Library, http://bulletphy sics.org Bullet Continuous Collision Detection and Physics Library, http://bulletphy sics.org
Copyright (C) 2006, 2009 Sony Computer Entertainment Inc. Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
This software is provided 'as-is', without any express or implied warranty. This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from th e use of this software. In no event will the authors be held liable for any damages arising from th e use of this software.
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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.
skipping to change at line 40 skipping to change at line 40
//Round a / b to nearest higher integer value //Round a / b to nearest higher integer value
int BT_GPU_PREF(iDivUp)(int a, int b); int BT_GPU_PREF(iDivUp)(int a, int b);
// compute grid and thread block size for a given number of elements // compute grid and thread block size for a given number of elements
void BT_GPU_PREF(computeGridSize)(int n, int blockSize, int &numBlocks, int &numThreads); void BT_GPU_PREF(computeGridSize)(int n, int blockSize, int &numBlocks, int &numThreads);
void BT_GPU_PREF(allocateArray)(void** devPtr, unsigned int size); void BT_GPU_PREF(allocateArray)(void** devPtr, unsigned int size);
void BT_GPU_PREF(freeArray)(void* devPtr); void BT_GPU_PREF(freeArray)(void* devPtr);
void BT_GPU_PREF(copyArrayFromDevice)(void* host, const void* device, unsig ned int size); void BT_GPU_PREF(copyArrayFromDevice)(void* host, const void* device, unsig ned int size);
void BT_GPU_PREF(copyArrayToDevice)(void* device, const void* host, unsigne d int size); void BT_GPU_PREF(copyArrayToDevice)(void* device, const void* host, unsigne d int size);
void BT_GPU_PREF(registerGLBufferObject(unsigned int vbo));
void* BT_GPU_PREF(mapGLBufferObject(unsigned int vbo));
void BT_GPU_PREF(unmapGLBufferObject(unsigned int vbo));
} // extern "C" } // extern "C"
#endif // BTGPUUTILSDHAREDDEFS_H #endif // BTGPUUTILSDHAREDDEFS_H
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 btHashMap.h   btHashMap.h 
skipping to change at line 50 skipping to change at line 50
++src, ++dst; ++src, ++dst;
if ( ret < 0 ) if ( ret < 0 )
ret = -1 ; ret = -1 ;
else if ( ret > 0 ) else if ( ret > 0 )
ret = 1 ; ret = 1 ;
return( ret ); return( ret );
} }
const bool equals(const btHashString& other) const bool equals(const btHashString& other) const
{ {
return (m_string == other.m_string) || return (m_string == other.m_string) ||
(0==portableStringCompare(m_string,other.m_string)); (0==portableStringCompare(m_string,other.m_string));
} }
}; };
const int BT_HASH_NULL=0xffffffff; const int BT_HASH_NULL=0xffffffff;
template <class Value> class btHashInt
class btHashKey
{ {
int m_uid; int m_uid;
public: public:
btHashInt(int uid) :m_uid(uid)
btHashKey(int uid)
:m_uid(uid)
{ {
} }
int getUid1() const int getUid1() const
{ {
return m_uid; return m_uid;
} }
bool equals(const btHashKey<Value>& other) const void setUid1(int uid)
{
m_uid = uid;
}
bool equals(const btHashInt& other) const
{ {
return getUid1() == other.getUid1(); return getUid1() == other.getUid1();
} }
//to our success //to our success
SIMD_FORCE_INLINE unsigned int getHash()const SIMD_FORCE_INLINE unsigned int getHash()const
{ {
int key = m_uid; int key = m_uid;
// Thomas Wang's hash // Thomas Wang's hash
key += ~(key << 15); key += ~(key << 15); key ^= (key >> 10); key += (key
key ^= (key >> 10); << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >>
key += (key << 3); 16);
key ^= (key >> 6); return key;
key += ~(key << 11); }
key ^= (key >> 16); };
class btHashPtr
{
union
{
const void* m_pointer;
int m_hashValues[2];
};
public:
btHashPtr(const void* ptr)
:m_pointer(ptr)
{
}
const void* getPointer() const
{
return m_pointer;
}
bool equals(const btHashPtr& other) const
{
return getPointer() == other.getPointer();
}
//to our success
SIMD_FORCE_INLINE unsigned int getHash()const
{
const bool VOID_IS_8 = ((sizeof(void*)==8));
int key = VOID_IS_8? m_hashValues[0]+m_hashValues[1] : m_has
hValues[0];
// Thomas Wang's hash
key += ~(key << 15); key ^= (key >> 10); key += (key
<< 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >>
16);
return key; return key;
} }
}; };
template <class Value> template <class Value>
class btHashKeyPtr class btHashKeyPtr
{ {
int m_uid;
public:
btHashKeyPtr(int uid) :m_uid(uid)
{
}
int getUid1() const
{
return m_uid;
}
bool equals(const btHashKeyPtr<Value>& other) const
{
return getUid1() == other.getUid1();
}
//to our success
SIMD_FORCE_INLINE unsigned int getHash()const
{
int key = m_uid;
// Thomas Wang's hash
key += ~(key << 15); key ^= (key >> 10); key += (key
<< 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >>
16);
return key;
}
};
template <class Value>
class btHashKey
{
int m_uid; int m_uid;
public: public:
btHashKeyPtr(int uid) btHashKey(int uid) :m_uid(uid)
:m_uid(uid)
{ {
} }
int getUid1() const int getUid1() const
{ {
return m_uid; return m_uid;
} }
bool equals(const btHashKeyPtr<Value>& other) const bool equals(const btHashKey<Value>& other) const
{ {
return getUid1() == other.getUid1(); return getUid1() == other.getUid1();
} }
//to our success //to our success
SIMD_FORCE_INLINE unsigned int getHash()const SIMD_FORCE_INLINE unsigned int getHash()const
{ {
int key = m_uid; int key = m_uid;
// Thomas Wang's hash // Thomas Wang's hash
key += ~(key << 15); key += ~(key << 15); key ^= (key >> 10); key += (key
key ^= (key >> 10); << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >>
key += (key << 3); 16);
key ^= (key >> 6);
key += ~(key << 11);
key ^= (key >> 16);
return key; return key;
} }
}; };
///The btHashMap template class implements a generic and lightweight hashma p. ///The btHashMap template class implements a generic and lightweight hashma p.
///A basic sample of how to use btHashMap is located in Demos\BasicDemo\mai n.cpp ///A basic sample of how to use btHashMap is located in Demos\BasicDemo\mai n.cpp
template <class Key, class Value> template <class Key, class Value>
class btHashMap class btHashMap
{ {
protected:
btAlignedObjectArray<int> m_hashTable; btAlignedObjectArray<int> m_hashTable;
btAlignedObjectArray<int> m_next; btAlignedObjectArray<int> m_next;
btAlignedObjectArray<Value> m_valueArray; btAlignedObjectArray<Value> m_valueArray;
btAlignedObjectArray<Key> m_keyArray; btAlignedObjectArray<Key> m_keyArray;
void growTables(const Key& key) void growTables(const Key& key)
{ {
int newCapacity = m_valueArray.capacity(); int newCapacity = m_valueArray.capacity();
 End of changes. 12 change blocks. 
24 lines changed or deleted 93 lines changed or added


 btHingeConstraint.h   btHingeConstraint.h 
skipping to change at line 27 skipping to change at line 27
#ifndef HINGECONSTRAINT_H #ifndef HINGECONSTRAINT_H
#define HINGECONSTRAINT_H #define HINGECONSTRAINT_H
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "btJacobianEntry.h" #include "btJacobianEntry.h"
#include "btTypedConstraint.h" #include "btTypedConstraint.h"
class btRigidBody; class btRigidBody;
#ifdef BT_USE_DOUBLE_PRECISION
#define btHingeConstraintData btHingeConstraintDoubleData
#define btHingeConstraintDataName "btHingeConstraintDoubleData"
#else
#define btHingeConstraintData btHingeConstraintFloatData
#define btHingeConstraintDataName "btHingeConstraintFloatData"
#endif //BT_USE_DOUBLE_PRECISION
enum btHingeFlags
{
BT_HINGE_FLAGS_CFM_STOP = 1,
BT_HINGE_FLAGS_ERP_STOP = 2,
BT_HINGE_FLAGS_CFM_NORM = 4
};
/// hinge constraint between two rigidbodies each with a pivotpoint that de scibes the axis location in local space /// hinge constraint between two rigidbodies each with a pivotpoint that de scibes the axis location in local space
/// axis defines the orientation of the hinge axis /// axis defines the orientation of the hinge axis
ATTRIBUTE_ALIGNED16(class) btHingeConstraint : public btTypedConstraint ATTRIBUTE_ALIGNED16(class) btHingeConstraint : public btTypedConstraint
{ {
#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
btJacobianEntry m_jacAng[3]; //2 orthogonal angular constraints+ 1 f or limit/motor btJacobianEntry m_jacAng[3]; //2 orthogonal angular constraints+ 1 f or limit/motor
skipping to change at line 63 skipping to change at line 78
btScalar m_correction; btScalar m_correction;
btScalar m_accLimitImpulse; btScalar m_accLimitImpulse;
btScalar m_hingeAngle; btScalar m_hingeAngle;
btScalar m_referenceSign; 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_useSolveConstraintObsolete;
bool m_useOffsetForConstraintFrame;
bool m_useReferenceFrameA; bool m_useReferenceFrameA;
btScalar m_accMotorImpulse; btScalar m_accMotorImpulse;
int m_flags;
btScalar m_normalCFM;
btScalar m_stopCFM;
btScalar m_stopERP;
public: public:
btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3 & pivotInA,const btVector3& pivotInB, btVector3& axisInA,btVector3& axisInB , bool useReferenceFrameA = false); btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3 & pivotInA,const btVector3& pivotInB, btVector3& axisInA,btVector3& axisInB , bool useReferenceFrameA = false);
btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVecto r3& axisInA, bool useReferenceFrameA = false); btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVecto r3& axisInA, bool useReferenceFrameA = false);
btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransfo rm& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false) ; btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransfo rm& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false) ;
btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA = false); btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA = false);
btHingeConstraint();
virtual void buildJacobian(); virtual void buildJacobian();
virtual void getInfo1 (btConstraintInfo1* info); virtual void getInfo1 (btConstraintInfo1* info);
void getInfo1NonVirtual(btConstraintInfo1* info); void getInfo1NonVirtual(btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info); virtual void getInfo2 (btConstraintInfo2* info);
void getInfo2NonVirtual(btConstraintInfo2* info,const btTransform & transA,const btTransform& transB,const btVector3& angVelA,const btVector3 & angVelB); void getInfo2NonVirtual(btConstraintInfo2* info,const btTransform & transA,const btTransform& transB,const btVector3& angVelA,const btVector3 & angVelB);
void getInfo2Internal(btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB); void getInfo2Internal(btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB);
void getInfo2InternalUsingFrameOffset(btConstraintInfo2* info,con
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver st btTransform& transA,const btTransform& transB,const btVector3& angVelA,c
Body& bodyB,btScalar timeStep); onst btVector3& angVelB);
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;
skipping to change at line 215 skipping to change at line 233
return m_enableAngularMotor; return m_enableAngularMotor;
} }
inline btScalar getMotorTargetVelosity() inline btScalar getMotorTargetVelosity()
{ {
return m_motorTargetVelocity; return m_motorTargetVelocity;
} }
inline btScalar getMaxMotorImpulse() inline btScalar getMaxMotorImpulse()
{ {
return m_maxMotorImpulse; return m_maxMotorImpulse;
} }
// access for UseFrameOffset
bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; }
///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constra
int.
virtual void setParam(int num, btScalar value, int axis = -1);
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btHingeConstraintDoubleData
{
btTypedConstraintData m_typeConstraintData;
btTransformDoubleData m_rbAFrame; // constraint axii. Assumes z is h
inge axis.
btTransformDoubleData m_rbBFrame;
int m_useReferenceFrameA;
int m_angularOnly;
int m_enableAngularMotor;
float m_motorTargetVelocity;
float m_maxMotorImpulse;
float m_lowerLimit;
float m_upperLimit;
float m_limitSoftness;
float m_biasFactor;
float m_relaxationFactor;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btHingeConstraintFloatData
{
btTypedConstraintData m_typeConstraintData;
btTransformFloatData m_rbAFrame; // constraint axii. Assumes z is hi
nge axis.
btTransformFloatData m_rbBFrame;
int m_useReferenceFrameA;
int m_angularOnly;
int m_enableAngularMotor;
float m_motorTargetVelocity;
float m_maxMotorImpulse;
float m_lowerLimit;
float m_upperLimit;
float m_limitSoftness;
float m_biasFactor;
float m_relaxationFactor;
};
SIMD_FORCE_INLINE int btHingeConstraint::calculateSerializeBufferS
ize() const
{
return sizeof(btHingeConstraintData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btHingeConstraint::serialize(void* d
ataBuffer, btSerializer* serializer) const
{
btHingeConstraintData* hingeData = (btHingeConstraintData*)dataBuffe
r;
btTypedConstraint::serialize(&hingeData->m_typeConstraintData,serial
izer);
m_rbAFrame.serialize(hingeData->m_rbAFrame);
m_rbBFrame.serialize(hingeData->m_rbBFrame);
hingeData->m_angularOnly = m_angularOnly;
hingeData->m_enableAngularMotor = m_enableAngularMotor;
hingeData->m_maxMotorImpulse = float(m_maxMotorImpulse);
hingeData->m_motorTargetVelocity = float(m_motorTargetVelocity);
hingeData->m_useReferenceFrameA = m_useReferenceFrameA;
hingeData->m_lowerLimit = float(m_lowerLimit);
hingeData->m_upperLimit = float(m_upperLimit);
hingeData->m_limitSoftness = float(m_limitSoftness);
hingeData->m_biasFactor = float(m_biasFactor);
hingeData->m_relaxationFactor = float(m_relaxationFactor);
return btHingeConstraintDataName;
}
#endif //HINGECONSTRAINT_H #endif //HINGECONSTRAINT_H
 End of changes. 7 change blocks. 
5 lines changed or deleted 121 lines changed or added


 btIDebugDraw.h   btIDebugDraw.h 
skipping to change at line 25 skipping to change at line 25
#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" #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.
///For color arguments the X,Y,Z components refer to Red, Green and Blue ea ch in the range [0..1]
class btIDebugDraw class btIDebugDraw
{ {
public: public:
enum DebugDrawModes enum DebugDrawModes
{ {
DBG_NoDebug=0, DBG_NoDebug=0,
DBG_DrawWireframe = 1, DBG_DrawWireframe = 1,
DBG_DrawAabb=2, DBG_DrawAabb=2,
DBG_DrawFeaturesText=4, DBG_DrawFeaturesText=4,
skipping to change at line 51 skipping to change at line 52
DBG_DisableBulletLCP = 512, DBG_DisableBulletLCP = 512,
DBG_EnableCCD = 1024, DBG_EnableCCD = 1024,
DBG_DrawConstraints = (1 << 11), DBG_DrawConstraints = (1 << 11),
DBG_DrawConstraintLimits = (1 << 12), DBG_DrawConstraintLimits = (1 << 12),
DBG_FastWireframe = (1<<13), DBG_FastWireframe = (1<<13),
DBG_MAX_DEBUG_DRAW_MODE DBG_MAX_DEBUG_DRAW_MODE
}; };
virtual ~btIDebugDraw() {}; virtual ~btIDebugDraw() {};
virtual void drawLine(const btVector3& from,const btVector3& to,c
onst btVector3& color)=0;
virtual void drawLine(const btVector3& from,const btVector3& to, const btVector3& fromColor, const btVector3& toColor) virtual void drawLine(const btVector3& from,const btVector3& to, const btVector3& fromColor, const btVector3& toColor)
{ {
(void) toColor;
drawLine (from, to, fromColor); drawLine (from, to, fromColor);
} }
virtual void drawBox (const btVector3& boxMin, const btVector3& b oxMax, const btVector3& color, btScalar alpha) void drawSphere(btScalar radius, const btTransform& transform, co nst btVector3& color)
{ {
btVector3 start = transform.getOrigin();
const btVector3 xoffs = transform.getBasis() * btVector3(rad
ius,0,0);
const btVector3 yoffs = transform.getBasis() * btVector3(0,r
adius,0);
const btVector3 zoffs = transform.getBasis() * btVector3(0,0
,radius);
// XY
drawLine(start-xoffs, start+yoffs, color);
drawLine(start+yoffs, start+xoffs, color);
drawLine(start+xoffs, start-yoffs, color);
drawLine(start-yoffs, start-xoffs, color);
// XZ
drawLine(start-xoffs, start+zoffs, color);
drawLine(start+zoffs, start+xoffs, color);
drawLine(start+xoffs, start-zoffs, color);
drawLine(start-zoffs, start-xoffs, color);
// YZ
drawLine(start-yoffs, start+zoffs, color);
drawLine(start+zoffs, start+yoffs, color);
drawLine(start+yoffs, start-zoffs, color);
drawLine(start-zoffs, start-yoffs, color);
} }
virtual void drawSphere (const btVector3& p, btScalar radius, con st btVector3& color) virtual void drawSphere (const btVector3& p, btScalar radius, con st btVector3& color)
{ {
btTransform tr;
tr.setIdentity();
tr.setOrigin(p);
drawSphere(radius,tr,color);
} }
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);
drawLine(v2,v0,color); drawLine(v2,v0,color);
} }
skipping to change at line 87 skipping to change at line 116
virtual void drawContactPoint(const btVector3& PointOnB,const btV ector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)=0; virtual void drawContactPoint(const btVector3& PointOnB,const btV ector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)=0;
virtual void reportErrorWarning(const char* warningString) = 0; virtual void reportErrorWarning(const char* warningString) = 0;
virtual void draw3dText(const btVector3& location,const char* tex tString) = 0; virtual void draw3dText(const btVector3& location,const char* tex tString) = 0;
virtual void setDebugMode(int debugMode) =0; virtual void setDebugMode(int debugMode) =0;
virtual int getDebugMode() const = 0; virtual int getDebugMode() const = 0;
inline void drawAabb(const btVector3& from,const btVector3& to,const btVector3& color) virtual void drawAabb(const btVector3& from,const btVector3& to,cons t btVector3& color)
{ {
btVector3 halfExtents = (to-from)* 0.5f; btVector3 halfExtents = (to-from)* 0.5f;
btVector3 center = (to+from) *0.5f; btVector3 center = (to+from) *0.5f;
int i,j; int i,j;
btVector3 edgecoord(1.f,1.f,1.f),pa,pb; btVector3 edgecoord(1.f,1.f,1.f),pa,pb;
for (i=0;i<4;i++) for (i=0;i<4;i++)
{ {
for (j=0;j<3;j++) for (j=0;j<3;j++)
skipping to change at line 116 skipping to change at line 145
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) virtual void drawTransform(const btTransform& transform, btScalar or thoLen)
{ {
btVector3 start = transform.getOrigin(); 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(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, or thoLen, 0), btVector3(0,0.7f,0));
drawLine(start, start+transform.getBasis() * btVector3(0, 0, orthoLen), btVector3(0,0,0.7f)); 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, virtual void drawArc(const btVector3& center, const btVector3& norma l, const btVector3& axis, btScalar radiusA, btScalar radiusB, btScalar minA ngle, btScalar maxAngle,
const btVector3& color, bool drawSect, btSca lar stepDegrees = btScalar(10.f)) const btVector3& color, bool drawSect, btSca lar stepDegrees = btScalar(10.f))
{ {
const btVector3& vx = axis; const btVector3& vx = axis;
btVector3 vy = normal.cross(axis); btVector3 vy = normal.cross(axis);
btScalar step = stepDegrees * SIMD_RADS_PER_DEG; btScalar step = stepDegrees * SIMD_RADS_PER_DEG;
int nSteps = (int)((maxAngle - minAngle) / step); int nSteps = (int)((maxAngle - minAngle) / step);
if(!nSteps) nSteps = 1; if(!nSteps) nSteps = 1;
btVector3 prev = center + radiusA * vx * btCos(minAngle) + r adiusB * vy * btSin(minAngle); btVector3 prev = center + radiusA * vx * btCos(minAngle) + r adiusB * vy * btSin(minAngle);
if(drawSect) if(drawSect)
{ {
skipping to change at line 149 skipping to change at line 178
btScalar angle = minAngle + (maxAngle - minAngle) * btScalar(i) / btScalar(nSteps); btScalar angle = minAngle + (maxAngle - minAngle) * btScalar(i) / btScalar(nSteps);
btVector3 next = center + radiusA * vx * btCos(angle ) + radiusB * vy * btSin(angle); btVector3 next = center + radiusA * vx * btCos(angle ) + radiusB * vy * btSin(angle);
drawLine(prev, next, color); drawLine(prev, next, color);
prev = next; prev = next;
} }
if(drawSect) if(drawSect)
{ {
drawLine(center, prev, color); drawLine(center, prev, color);
} }
} }
void drawSpherePatch(const btVector3& center, const btVector3& up, c onst btVector3& axis, btScalar radius, virtual void drawSpherePatch(const btVector3& center, const btVector 3& up, const btVector3& axis, btScalar radius,
btScalar minTh, btScalar maxTh, btScalar minPs, btScalar max Ps, const btVector3& color, btScalar stepDegrees = btScalar(10.f)) btScalar minTh, btScalar maxTh, btScalar minPs, btScalar max Ps, const btVector3& color, btScalar stepDegrees = btScalar(10.f))
{ {
btVector3 vA[74]; btVector3 vA[74];
btVector3 vB[74]; btVector3 vB[74];
btVector3 *pvA = vA, *pvB = vB, *pT; btVector3 *pvA = vA, *pvB = vB, *pT;
btVector3 npole = center + up * radius; btVector3 npole = center + up * radius;
btVector3 spole = center - up * radius; btVector3 spole = center - up * radius;
btVector3 arcStart; btVector3 arcStart;
btScalar step = stepDegrees * SIMD_RADS_PER_DEG; btScalar step = stepDegrees * SIMD_RADS_PER_DEG;
const btVector3& kv = up; const btVector3& kv = up;
skipping to change at line 251 skipping to change at line 280
if(((!i) || (i == (n_hor-1))) && ((! j) || (j == (n_vert-1)))) if(((!i) || (i == (n_hor-1))) && ((! j) || (j == (n_vert-1))))
{ {
drawLine(center, pvB[j], col or); drawLine(center, pvB[j], col or);
} }
} }
} }
pT = pvA; pvA = pvB; pvB = pT; pT = pvA; pvA = pvB; pvB = pT;
} }
} }
void drawBox(const btVector3& bbMin, const btVector3& bbMax, const b tVector3& color) virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color)
{ {
drawLine(btVector3(bbMin[0], bbMin[1], bbMin[2]), btVector3( bbMax[0], bbMin[1], bbMin[2]), 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], 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(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], 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(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], 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(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], 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(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], 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(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); 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) virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& 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(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], 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(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], 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(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], 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(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], 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(bbMin[0], bbMin[1], bbMax[2]), tr ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color);
 End of changes. 13 change blocks. 
10 lines changed or deleted 42 lines changed or added


 btKinematicCharacterController.h   btKinematicCharacterController.h 
skipping to change at line 69 skipping to change at line 70
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;
bool m_useWalkDirection; bool m_useWalkDirection;
float m_velocityTimeInterval; btScalar m_velocityTimeInterval;
int m_upAxis; int m_upAxis;
static btVector3* getUpAxisDirections();
btVector3 computeReflectionDirection (const btVector3& direction, co nst btVector3& normal); btVector3 computeReflectionDirection (const btVector3& direction, co nst btVector3& normal);
btVector3 parallelComponent (const btVector3& direction, const btVec tor3& normal); btVector3 parallelComponent (const btVector3& direction, const btVec tor3& normal);
btVector3 perpindicularComponent (const btVector3& direction, const btVector3& normal); btVector3 perpindicularComponent (const btVector3& direction, const btVector3& normal);
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:
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added


 btManifoldPoint.h   btManifoldPoint.h 
skipping to change at line 33 skipping to change at line 33
/// used to improve stability and performance of rigidbody dynamics respons e. /// used to improve stability and performance of rigidbody dynamics respons e.
class btManifoldPoint class btManifoldPoint
{ {
public: public:
btManifoldPoint() btManifoldPoint()
:m_userPersistentData(0), :m_userPersistentData(0),
m_appliedImpulse(0.f), m_appliedImpulse(0.f),
m_lateralFrictionInitialized(false), m_lateralFrictionInitialized(false),
m_appliedImpulseLateral1(0.f), m_appliedImpulseLateral1(0.f),
m_appliedImpulseLateral2(0.f), m_appliedImpulseLateral2(0.f),
m_contactMotion1(0.f),
m_contactMotion2(0.f),
m_contactCFM1(0.f),
m_contactCFM2(0.f),
m_lifeTime(0) m_lifeTime(0)
{ {
} }
btManifoldPoint( const btVector3 &pointA, const btVe ctor3 &pointB, btManifoldPoint( const btVector3 &pointA, const btVe ctor3 &pointB,
const btVector3 &normal, const btVector3 &normal,
btScalar distance ) : btScalar distance ) :
m_localPointA( pointA ), m_localPointA( pointA ),
m_localPointB( pointB ), m_localPointB( pointB ),
m_normalWorldOnB( normal ), m_normalWorldOnB( normal ),
m_distance1( distance ), m_distance1( distance ),
m_combinedFriction(btScalar(0.)), m_combinedFriction(btScalar(0.)),
m_combinedRestitution(btScalar(0.)), m_combinedRestitution(btScalar(0.)),
m_userPersistentData(0), m_userPersistentData(0),
m_appliedImpulse(0.f), m_appliedImpulse(0.f),
m_lateralFrictionInitialized(false), m_lateralFrictionInitialized(false),
m_appliedImpulseLateral1(0.f), m_appliedImpulseLateral1(0.f),
m_appliedImpulseLateral2(0.f), m_appliedImpulseLateral2(0.f),
m_contactMotion1(0.f),
m_contactMotion2(0.f),
m_contactCFM1(0.f),
m_contactCFM2(0.f),
m_lifeTime(0) m_lifeTime(0)
{ {
} }
btVector3 m_localPointA; btVector3 m_localPointA;
btVector3 m_localPointB; btVector3 m_localPointB;
btVector3 m_positionWorldOnB; btVector3 m_positionWorldOnB;
///m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity ///m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
btVector3 m_positionWorldOnA; btVector3 m_positionWorldOnA;
skipping to change at line 79 skipping to change at line 87
int m_partId1; int m_partId1;
int m_index0; int m_index0;
int m_index1; int m_index1;
mutable void* m_userPersistentData; mutable void* m_userPersistentData;
btScalar m_appliedImpulse; btScalar m_appliedImpulse;
bool m_lateralFrictionInitialized ; bool m_lateralFrictionInitialized ;
btScalar m_appliedImpulseLateral1; btScalar m_appliedImpulseLateral1;
btScalar m_appliedImpulseLateral2; btScalar m_appliedImpulseLateral2;
btScalar m_contactMotion1;
btScalar m_contactMotion2;
btScalar m_contactCFM1;
btScalar m_contactCFM2;
int m_lifeTime;//lifetim e of the contactpoint in frames int m_lifeTime;//lifetim e of the contactpoint in frames
btVector3 m_lateralFrictionDir1; btVector3 m_lateralFrictionDir1;
btVector3 m_lateralFrictionDir2; btVector3 m_lateralFrictionDir2;
btScalar getDistance() const btScalar getDistance() const
{ {
return m_distance1; return m_distance1;
} }
int getLifeTime() const int getLifeTime() const
 End of changes. 3 change blocks. 
0 lines changed or deleted 13 lines changed or added


 btManifoldResult.h   btManifoldResult.h 
skipping to change at line 35 skipping to change at line 35
#include "LinearMath/btTransform.h" #include "LinearMath/btTransform.h"
typedef bool (*ContactAddedCallback)(btManifoldPoint& cp, const btColl isionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj 1,int partId1,int index1); typedef bool (*ContactAddedCallback)(btManifoldPoint& cp, const btColl isionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj 1,int partId1,int index1);
extern ContactAddedCallback gContactAddedCallback; extern ContactAddedCallback gContactAddedCallback;
//#define DEBUG_PART_INDEX 1 //#define DEBUG_PART_INDEX 1
///btManifoldResult is a helper class to manage contact results. ///btManifoldResult is a helper class to manage contact results.
class btManifoldResult : public btDiscreteCollisionDetectorInterface::Resul t class btManifoldResult : public btDiscreteCollisionDetectorInterface::Resul t
{ {
protected:
btPersistentManifold* m_manifoldPtr; btPersistentManifold* m_manifoldPtr;
//we need this for compounds //we need this for compounds
btTransform m_rootTransA; btTransform m_rootTransA;
btTransform m_rootTransB; btTransform m_rootTransB;
btCollisionObject* m_body0; btCollisionObject* m_body0;
btCollisionObject* m_body1; btCollisionObject* m_body1;
int m_partId0; int m_partId0;
int m_partId1; int m_partId1;
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 btMatrix3x3.h   btMatrix3x3.h 
skipping to change at line 15 skipping to change at line 15
In no event will the authors be held liable for any damages arising from th e use of this software. In no event will the authors be held liable for any damages arising from th e use of this software.
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 btMatrix3x3_H #ifndef BT_MATRIX3x3_H
#define btMatrix3x3_H #define BT_MATRIX3x3_H
#include "btScalar.h"
#include "btVector3.h" #include "btVector3.h"
#include "btQuaternion.h" #include "btQuaternion.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btMatrix3x3Data btMatrix3x3DoubleData
#else
#define btMatrix3x3Data btMatrix3x3FloatData
#endif //BT_USE_DOUBLE_PRECISION
/**@brief The btMatrix3x3 class implements a 3x3 rotation matrix, to perfor m linear algebra in combination with btQuaternion, btTransform and btVector 3. /**@brief The btMatrix3x3 class implements a 3x3 rotation matrix, to perfor m linear algebra in combination with btQuaternion, btTransform and btVector 3.
* Make sure to only include a pure orthogonal matrix without scaling. */ * Make sure to only include a pure orthogonal matrix without scaling. */
class btMatrix3x3 { class btMatrix3x3 {
public:
/** @brief No initializaion constructor */
btMatrix3x3 () {}
// explicit btMatrix3x3(const btScalar *m) { setFromOpenGLSubMa ///Data storage for the matrix, each vector is a row of the matrix
trix(m); } btVector3 m_el[3];
/**@brief Constructor from Quaternion */ public:
explicit btMatrix3x3(const btQuaternion& q) { setRotation(q) /** @brief No initializaion constructor */
; } btMatrix3x3 () {}
/*
template <typename btScalar>
Matrix3x3(const btScalar& yaw, const btScalar& pitch, const
btScalar& roll)
{
setEulerYPR(yaw, pitch, roll);
}
*/
/** @brief Constructor with row major formatting */
btMatrix3x3(const btScalar& xx, const btScalar& xy, const bt
Scalar& xz,
const btScalar& yx, const btScalar& yy, co
nst btScalar& yz,
const btScalar& zx, const btScalar& zy, co
nst btScalar& zz)
{
setValue(xx, xy, xz,
yx, yy, yz,
zx, zy, zz);
}
/** @brief Copy constructor */
SIMD_FORCE_INLINE btMatrix3x3 (const btMatrix3x3& other)
{
m_el[0] = other.m_el[0];
m_el[1] = other.m_el[1];
m_el[2] = other.m_el[2];
}
/** @brief Assignment Operator */
SIMD_FORCE_INLINE btMatrix3x3& operator=(const btMatrix3x3&
other)
{
m_el[0] = other.m_el[0];
m_el[1] = other.m_el[1];
m_el[2] = other.m_el[2];
return *this;
}
/** @brief Get a column of the matrix as a vector // explicit btMatrix3x3(const btScalar *m) { setFromOpe
* @param i Column number 0 indexed */ nGLSubMatrix(m); }
SIMD_FORCE_INLINE btVector3 getColumn(int i) const
{
return btVector3(m_el[0][i],m_el[1][i],m_el[2][i]);
}
/** @brief Get a row of the matrix as a vector /**@brief Constructor from Quaternion */
* @param i Row number 0 indexed */ explicit btMatrix3x3(const btQuaternion& q) { setRotation(q); }
SIMD_FORCE_INLINE const btVector3& getRow(int i) const /*
{ template <typename btScalar>
btFullAssert(0 <= i && i < 3); Matrix3x3(const btScalar& yaw, const btScalar& pitch, const btScalar
return m_el[i]; & roll)
} {
setEulerYPR(yaw, pitch, roll);
}
*/
/** @brief Constructor with row major formatting */
btMatrix3x3(const btScalar& xx, const btScalar& xy, const btScalar&
xz,
const btScalar& yx, const btScalar& yy, const btScalar& yz,
const btScalar& zx, const btScalar& zy, const btScalar& zz)
{
setValue(xx, xy, xz,
yx, yy, yz,
zx, zy, zz);
}
/** @brief Copy constructor */
SIMD_FORCE_INLINE btMatrix3x3 (const btMatrix3x3& other)
{
m_el[0] = other.m_el[0];
m_el[1] = other.m_el[1];
m_el[2] = other.m_el[2];
}
/** @brief Assignment Operator */
SIMD_FORCE_INLINE btMatrix3x3& operator=(const btMatrix3x3& other)
{
m_el[0] = other.m_el[0];
m_el[1] = other.m_el[1];
m_el[2] = other.m_el[2];
return *this;
}
/** @brief Get a mutable reference to a row of the matrix as a vector /** @brief Get a column of the matrix as a vector
* @param i Row number 0 indexed */ * @param i Column number 0 indexed */
SIMD_FORCE_INLINE btVector3& operator[](int i) SIMD_FORCE_INLINE btVector3 getColumn(int i) const
{ {
btFullAssert(0 <= i && i < 3); return btVector3(m_el[0][i],m_el[1][i],m_el[2][i]);
return m_el[i]; }
}
/** @brief Get a const reference to a row of the matrix as a vector /** @brief Get a row of the matrix as a vector
* @param i Row number 0 indexed */ * @param i Row number 0 indexed */
SIMD_FORCE_INLINE const btVector3& operator[](int i) const SIMD_FORCE_INLINE const btVector3& getRow(int i) const
{ {
btFullAssert(0 <= i && i < 3); btFullAssert(0 <= i && i < 3);
return m_el[i]; return m_el[i];
} }
/** @brief Multiply by the target matrix on the right /** @brief Get a mutable reference to a row of the matrix as a vecto
* @param m Rotation matrix to be applied r
* Equivilant to this = this * m */ * @param i Row number 0 indexed */
btMatrix3x3& operator*=(const btMatrix3x3& m); SIMD_FORCE_INLINE btVector3& operator[](int i)
{
btFullAssert(0 <= i && i < 3);
return m_el[i];
}
/** @brief Set from a carray of btScalars /** @brief Get a const reference to a row of the matrix as a vector
* @param m A pointer to the beginning of an array of 9 btScalars */ * @param i Row number 0 indexed */
SIMD_FORCE_INLINE const btVector3& operator[](int i) const
{
btFullAssert(0 <= i && i < 3);
return m_el[i];
}
/** @brief Multiply by the target matrix on the right
* @param m Rotation matrix to be applied
* Equivilant to this = this * m */
btMatrix3x3& operator*=(const btMatrix3x3& m);
/** @brief Set from a carray of btScalars
* @param m A pointer to the beginning of an array of 9 btScalars */
void setFromOpenGLSubMatrix(const btScalar *m) void setFromOpenGLSubMatrix(const btScalar *m)
{ {
m_el[0].setValue(m[0],m[4],m[8]); m_el[0].setValue(m[0],m[4],m[8]);
m_el[1].setValue(m[1],m[5],m[9]); m_el[1].setValue(m[1],m[5],m[9]);
m_el[2].setValue(m[2],m[6],m[10]); m_el[2].setValue(m[2],m[6],m[10]);
} }
/** @brief Set the values of the matrix explicitly (row major) /** @brief Set the values of the matrix explicitly (row major)
* @param xx Top left * @param xx Top left
* @param xy Top Middle * @param xy Top Middle
* @param xz Top Right * @param xz Top Right
* @param yx Middle Left * @param yx Middle Left
* @param yy Middle Middle * @param yy Middle Middle
* @param yz Middle Right * @param yz Middle Right
* @param zx Bottom Left * @param zx Bottom Left
* @param zy Bottom Middle * @param zy Bottom Middle
* @param zz Bottom Right*/ * @param zz Bottom Right*/
void setValue(const btScalar& xx, const btScalar& xy, const void setValue(const btScalar& xx, const btScalar& xy, const btScalar
btScalar& xz, & xz,
const btScalar& yx, const btScalar const btScalar& yx, const btScalar& yy, const btScalar& yz,
& yy, const btScalar& yz, const btScalar& zx, const btScalar& zy, const btScalar& zz)
const btScalar& zx, const btScalar {
& zy, const btScalar& zz) m_el[0].setValue(xx,xy,xz);
{ m_el[1].setValue(yx,yy,yz);
m_el[0].setValue(xx,xy,xz); m_el[2].setValue(zx,zy,zz);
m_el[1].setValue(yx,yy,yz); }
m_el[2].setValue(zx,zy,zz);
}
/** @brief Set the matrix from a quaternion /** @brief Set the matrix from a quaternion
* @param q The Quaternion to match */ * @param q The Quaternion to match */
void setRotation(const btQuaternion& q) void setRotation(const btQuaternion& q)
{ {
btScalar d = q.length2(); btScalar d = q.length2();
btFullAssert(d != btScalar(0.0)); btFullAssert(d != btScalar(0.0));
btScalar s = btScalar(2.0) / d; btScalar s = btScalar(2.0) / d;
btScalar xs = q.x() * s, ys = q.y() * s, zs = q. btScalar xs = q.x() * s, ys = q.y() * s, zs = q.z() * s;
z() * s; btScalar wx = q.w() * xs, wy = q.w() * ys, wz = q.w() * zs
btScalar wx = q.w() * xs, wy = q.w() * ys, wz = q. ;
w() * zs; btScalar xx = q.x() * xs, xy = q.x() * ys, xz = q.x() * zs
btScalar xx = q.x() * xs, xy = q.x() * ys, xz = q. ;
x() * zs; btScalar yy = q.y() * ys, yz = q.y() * zs, zz = q.z() * zs
btScalar yy = q.y() * ys, yz = q.y() * zs, zz = q. ;
z() * zs; setValue(btScalar(1.0) - (yy + zz), xy - wz, xz + wy,
setValue(btScalar(1.0) - (yy + zz), xy - wz, xz + wy xy + wz, btScalar(1.0) - (xx + zz), yz - wx,
, xz - wy, yz + wx, btScalar(1.0) - (xx + yy));
xy + wz, btScalar(1.0) - (xx + zz), }
yz - wx,
xz - wy, yz + wx, btScalar(1.0) - (
xx + yy));
}
/** @brief Set the matrix from euler angles using YPR around YXZ respecti /** @brief Set the matrix from euler angles using YPR around YXZ res
vely pectively
* @param yaw Yaw about Y axis * @param yaw Yaw about Y axis
* @param pitch Pitch about X axis * @param pitch Pitch about X axis
* @param roll Roll about Z axis * @param roll Roll about Z axis
*/ */
void setEulerYPR(const btScalar& yaw, const btScalar& pitch, void setEulerYPR(const btScalar& yaw, const btScalar& pitch, const b
const btScalar& roll) tScalar& roll)
{ {
setEulerZYX(roll, pitch, yaw); setEulerZYX(roll, pitch, yaw);
} }
/** @brief Set the matrix from euler angles YPR around ZYX axes /** @brief Set the matrix from euler angles YPR around ZYX axes
* @param eulerX Roll about X axis * @param eulerX Roll about X axis
* @param eulerY Pitch around Y axis * @param eulerY Pitch around Y axis
* @param eulerZ Yaw aboud Z axis * @param eulerZ Yaw aboud Z axis
* *
* These angles are used to produce a rotation matrix. The euler * These angles are used to produce a rotation matrix. The euler
* angles are applied in ZYX order. I.e a vector is first rotated * angles are applied in ZYX order. I.e a vector is first rotated
* about X then Y and then Z * about X then Y and then Z
**/ **/
void setEulerZYX(btScalar eulerX,btScalar eulerY,btScalar eulerZ) { void setEulerZYX(btScalar eulerX,btScalar eulerY,btScalar eulerZ) {
///@todo proposed to reverse this since it's labeled zyx but takes argume nts xyz and it will match all other parts of the code ///@todo proposed to reverse this since it's labeled zyx but takes arguments xyz and it will match all other parts of the code
btScalar ci ( btCos(eulerX)); btScalar ci ( btCos(eulerX));
btScalar cj ( btCos(eulerY)); btScalar cj ( btCos(eulerY));
btScalar ch ( btCos(eulerZ)); btScalar ch ( btCos(eulerZ));
btScalar si ( btSin(eulerX)); btScalar si ( btSin(eulerX));
btScalar sj ( btSin(eulerY)); btScalar sj ( btSin(eulerY));
btScalar sh ( btSin(eulerZ)); btScalar sh ( btSin(eulerZ));
btScalar cc = ci * ch; btScalar cc = ci * ch;
btScalar cs = ci * sh; btScalar cs = ci * sh;
btScalar sc = si * ch; btScalar sc = si * ch;
btScalar ss = si * sh; btScalar ss = si * sh;
setValue(cj * ch, sj * sc - cs, sj * cc + ss, setValue(cj * ch, sj * sc - cs, sj * cc + ss,
cj * sh, sj * ss + cc, sj * cs - sc, cj * sh, sj * ss + cc, sj * cs - sc,
-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), btScalar(0.0),
btScalar(0.0), btScalar(1.0), btSca btScalar(0.0), btScalar(0.0), btScalar(1.0));
lar(0.0), }
btScalar(0.0), btScalar(0.0), btSca
lar(1.0));
}
static const btMatrix3x3& getIdentity() static const btMatrix3x3& getIdentity()
{ {
static const btMatrix3x3 identityMatrix(btScalar(1.0 static const btMatrix3x3 identityMatrix(btScalar(1.0), btSca
), btScalar(0.0), btScalar(0.0), lar(0.0), btScalar(0.0),
btScalar(0.0), btScalar(1.0), btSca btScalar(0.0), btScalar(1.0), btScalar(0.0),
lar(0.0), btScalar(0.0), btScalar(0.0), btScalar(1.0));
btScalar(0.0), btScalar(0.0), btSca return identityMatrix;
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[1] = btScalar(m_el[1].x());
m[2] = btScalar(m_el[2].x());
m[3] = btScalar(0.0);
m[4] = btScalar(m_el[0].y());
m[5] = btScalar(m_el[1].y());
m[6] = btScalar(m_el[2].y());
m[7] = btScalar(0.0);
m[8] = btScalar(m_el[0].z());
m[9] = btScalar(m_el[1].z());
m[10] = btScalar(m_el[2].z());
m[11] = btScalar(0.0);
}
/**@brief Get the matrix represented as a quaternion
* @param q The quaternion which will be set */
void getRotation(btQuaternion& q) const
{
btScalar trace = m_el[0].x() + m_el[1].y() + m_el[2].z();
btScalar temp[4];
if (trace > btScalar(0.0))
{ {
m[0] = btScalar(m_el[0].x()); btScalar s = btSqrt(trace + btScalar(1.0));
m[1] = btScalar(m_el[1].x()); temp[3]=(s * btScalar(0.5));
m[2] = btScalar(m_el[2].x()); s = btScalar(0.5) / s;
m[3] = btScalar(0.0);
m[4] = btScalar(m_el[0].y());
m[5] = btScalar(m_el[1].y());
m[6] = btScalar(m_el[2].y());
m[7] = btScalar(0.0);
m[8] = btScalar(m_el[0].z());
m[9] = btScalar(m_el[1].z());
m[10] = btScalar(m_el[2].z());
m[11] = btScalar(0.0);
}
/**@brief Get the matrix represented as a quaternion temp[0]=((m_el[2].y() - m_el[1].z()) * s);
* @param q The quaternion which will be set */ temp[1]=((m_el[0].z() - m_el[2].x()) * s);
void getRotation(btQuaternion& q) const temp[2]=((m_el[1].x() - m_el[0].y()) * s);
}
else
{ {
btScalar trace = m_el[0].x() + m_el[1].y() + m_el[2] int i = m_el[0].x() < m_el[1].y() ?
.z(); (m_el[1].y() < m_el[2].z() ? 2 : 1) :
btScalar temp[4]; (m_el[0].x() < m_el[2].z() ? 2 : 0);
int j = (i + 1) % 3;
int k = (i + 2) % 3;
if (trace > btScalar(0.0)) btScalar s = btSqrt(m_el[i][i] - m_el[j][j] - m_el[k
{ ][k] + btScalar(1.0));
btScalar s = btSqrt(trace + btScalar(1.0)); temp[i] = s * btScalar(0.5);
temp[3]=(s * btScalar(0.5)); s = btScalar(0.5) / s;
s = btScalar(0.5) / s;
temp[0]=((m_el[2].y() - m_el[1].z()) * s); temp[3] = (m_el[k][j] - m_el[j][k]) * s;
temp[1]=((m_el[0].z() - m_el[2].x()) * s); temp[j] = (m_el[j][i] + m_el[i][j]) * s;
temp[2]=((m_el[1].x() - m_el[0].y()) * s); temp[k] = (m_el[k][i] + m_el[i][k]) * s;
} }
else q.setValue(temp[0],temp[1],temp[2],temp[3]);
{ }
int i = m_el[0].x() < m_el[1].y() ?
(m_el[1].y() < m_el[2].z() ? 2 : 1)
:
(m_el[0].x() < m_el[2].z() ? 2 : 0);
int j = (i + 1) % 3;
int k = (i + 2) % 3;
btScalar s = btSqrt(m_el[i][i] - m_el[j][j] /**@brief Get the matrix represented as euler angles around YXZ, rou
- m_el[k][k] + btScalar(1.0)); ndtrip with setEulerYPR
temp[i] = s * btScalar(0.5); * @param yaw Yaw around Y axis
s = btScalar(0.5) / s; * @param pitch Pitch around X axis
* @param roll around Z axis */
void getEulerYPR(btScalar& yaw, btScalar& pitch, btScalar& roll) con
st
{
temp[3] = (m_el[k][j] - m_el[j][k]) * s; // first use the normal calculus
temp[j] = (m_el[j][i] + m_el[i][j]) * s; yaw = btScalar(btAtan2(m_el[1].x(), m_el[0].x()));
temp[k] = (m_el[k][i] + m_el[i][k]) * s; pitch = btScalar(btAsin(-m_el[2].x()));
} roll = btScalar(btAtan2(m_el[2].y(), m_el[2].z()));
q.setValue(temp[0],temp[1],temp[2],temp[3]);
}
/**@brief Get the matrix represented as euler angles around YXZ, roundtri // on pitch = +/-HalfPI
p with setEulerYPR if (btFabs(pitch)==SIMD_HALF_PI)
* @param yaw Yaw around Y axis
* @param pitch Pitch around X axis
* @param roll around Z axis */
void getEulerYPR(btScalar& yaw, btScalar& pitch, btScalar& r
oll) const
{ {
if (yaw>0)
yaw-=SIMD_PI;
else
yaw+=SIMD_PI;
// first use the normal calculus if (roll>0)
yaw = btScalar(btAtan2(m_el[1].x(), m_el[0].x())); roll-=SIMD_PI;
pitch = btScalar(btAsin(-m_el[2].x())); else
roll = btScalar(btAtan2(m_el[2].y(), m_el[2].z())); roll+=SIMD_PI;
}
// on pitch = +/-HalfPI };
if (btFabs(pitch)==SIMD_HALF_PI)
{
if (yaw>0)
yaw-=SIMD_PI;
else
yaw+=SIMD_PI;
if (roll>0) /**@brief Get the matrix represented as euler angles around ZYX
roll-=SIMD_PI; * @param yaw Yaw around X axis
else * @param pitch Pitch around Y axis
roll+=SIMD_PI; * @param roll around X axis
} * @param solution_number Which solution of two possible solutions (
1 or 2) are possible values*/
void getEulerZYX(btScalar& yaw, btScalar& pitch, btScalar& roll, uns
igned int solution_number = 1) const
{
struct Euler
{
btScalar yaw;
btScalar pitch;
btScalar roll;
}; };
/**@brief Get the matrix represented as euler angles around ZYX Euler euler_out;
* @param yaw Yaw around X axis Euler euler_out2; //second solution
* @param pitch Pitch around Y axis //get the pointer to the raw data
* @param roll around X axis
* @param solution_number Which solution of two possible solutions ( 1 or
2) are possible values*/
void getEulerZYX(btScalar& yaw, btScalar& pitch, btScalar& roll, unsigned
int solution_number = 1) const
{
struct Euler{btScalar yaw, pitch, roll;};
Euler euler_out;
Euler euler_out2; //second solution
//get the pointer to the raw data
// Check that pitch is not at a singularity // Check that pitch is not at a singularity
if (btFabs(m_el[2].x()) >= 1) if (btFabs(m_el[2].x()) >= 1)
{ {
euler_out.yaw = 0; euler_out.yaw = 0;
euler_out2.yaw = 0; euler_out2.yaw = 0;
// From difference of angles formula // From difference of angles formula
btScalar delta = btAtan2(m_el[0].x(),m_el[0].z()); btScalar delta = btAtan2(m_el[0].x(),m_el[0].z());
if (m_el[2].x() > 0) //gimbal locked up if (m_el[2].x() > 0) //gimbal locked up
{ {
euler_out.pitch = SIMD_PI / btScalar(2.0); euler_out.pitch = SIMD_PI / btScalar(2.0);
euler_out2.pitch = SIMD_PI / btScalar(2.0); euler_out2.pitch = SIMD_PI / btScalar(2.0);
euler_out.roll = euler_out.pitch + delta; euler_out.roll = euler_out.pitch + delta;
euler_out2.roll = euler_out.pitch + delta; euler_out2.roll = euler_out.pitch + delta;
} }
else // gimbal locked down else // gimbal locked down
{ {
euler_out.pitch = -SIMD_PI / btScalar(2.0); euler_out.pitch = -SIMD_PI / btScalar(2.0);
euler_out2.pitch = -SIMD_PI / btScalar(2.0); euler_out2.pitch = -SIMD_PI / btScalar(2.0);
euler_out.roll = -euler_out.pitch + delta; euler_out.roll = -euler_out.pitch + delta;
euler_out2.roll = -euler_out.pitch + delta; euler_out2.roll = -euler_out.pitch + delta;
} }
} }
else else
{ {
euler_out.pitch = - btAsin(m_el[2].x()); euler_out.pitch = - btAsin(m_el[2].x());
euler_out2.pitch = SIMD_PI - euler_out.pitch; euler_out2.pitch = SIMD_PI - euler_out.pitch;
euler_out.roll = btAtan2(m_el[2].y()/btCos(euler_out.pitch), euler_out.roll = btAtan2(m_el[2].y()/btCos(euler_out
m_el[2].z()/btCos(euler_out.pitch)); .pitch),
euler_out2.roll = btAtan2(m_el[2].y()/btCos(euler_out2.pitch), m_el[2].z()/btCos(euler_out.pitch));
euler_out2.roll = btAtan2(m_el[2].y()/btCos(euler_ou
t2.pitch),
m_el[2].z()/btCos(euler_out2.pitch)); m_el[2].z()/btCos(euler_out2.pitch));
euler_out.yaw = btAtan2(m_el[1].x()/btCos(euler_out.pitch), euler_out.yaw = btAtan2(m_el[1].x()/btCos(euler_out.
m_el[0].x()/btCos(euler_out.pitch)); pitch),
euler_out2.yaw = btAtan2(m_el[1].x()/btCos(euler_out2.pitch), m_el[0].x()/btCos(euler_out.pitch));
m_el[0].x()/btCos(euler_out2.pitch)); euler_out2.yaw = btAtan2(m_el[1].x()/btCos(euler_out
} 2.pitch),
m_el[0].x()/btCos(euler_out2.pitch));
if (solution_number == 1)
{
yaw = euler_out.yaw;
pitch = euler_out.pitch;
roll = euler_out.roll;
}
else
{
yaw = euler_out2.yaw;
pitch = euler_out2.pitch;
roll = euler_out2.roll;
}
}
/**@brief Create a scaled copy of the matrix
* @param s Scaling vector The elements of the vector will scale each col
umn */
btMatrix3x3 scaled(const btVector3& s) const
{
return btMatrix3x3(m_el[0].x() * s.x(), m_el[0].y()
* s.y(), m_el[0].z() * s.z(),
m_e
l[1].x() * s.x(), m_el[1].y() * s.y(), m_el[1].z() * s.z(),
m_e
l[2].x() * s.x(), m_el[2].y() * s.y(), m_el[2].z() * s.z());
} }
/**@brief Return the determinant of the matrix */ if (solution_number == 1)
btScalar determinant() const;
/**@brief Return the adjoint of the matrix */
btMatrix3x3 adjoint() const;
/**@brief Return the matrix with all values non negative */
btMatrix3x3 absolute() const;
/**@brief Return the transpose of the matrix */
btMatrix3x3 transpose() const;
/**@brief Return the inverse of the matrix */
btMatrix3x3 inverse() const;
btMatrix3x3 transposeTimes(const btMatrix3x3& m) const;
btMatrix3x3 timesTranspose(const btMatrix3x3& m) const;
SIMD_FORCE_INLINE btScalar tdotx(const btVector3& v) const
{
return m_el[0].x() * v.x() + m_el[1].x() * v.y() + m
_el[2].x() * v.z();
}
SIMD_FORCE_INLINE btScalar tdoty(const btVector3& v) const
{ {
return m_el[0].y() * v.x() + m_el[1].y() * v.y() + m yaw = euler_out.yaw;
_el[2].y() * v.z(); pitch = euler_out.pitch;
roll = euler_out.roll;
} }
SIMD_FORCE_INLINE btScalar tdotz(const btVector3& v) const else
{ {
return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m yaw = euler_out2.yaw;
_el[2].z() * v.z(); pitch = euler_out2.pitch;
roll = euler_out2.roll;
} }
}
/**@brief diagonalizes this matrix by the Jacobi method. /**@brief Create a scaled copy of the matrix
* @param rot stores the rotation from the coordinate system in which the * @param s Scaling vector The elements of the vector will scale each
matrix is diagonal to the original column */
* coordinate system, i.e., old_this = rot * new_this * rot^T.
* @param threshold See iteration btMatrix3x3 scaled(const btVector3& s) const
* @param iteration The iteration stops when all off-diagonal elements ar {
e less than the threshold multiplied return btMatrix3x3(m_el[0].x() * s.x(), m_el[0].y() * s.y(),
* by the sum of the absolute values of the diagonal, or when maxSteps ha m_el[0].z() * s.z(),
ve been executed. m_el[1].x() * s.x(), m_el[1].y() * s.y(), m_el[1].z(
* ) * s.z(),
* Note that this matrix is assumed to be symmetric. m_el[2].x() * s.x(), m_el[2].y() * s.y(), m_el[2].z(
*/ ) * s.z());
void diagonalize(btMatrix3x3& rot, btScalar threshold, int m }
axSteps)
/**@brief Return the determinant of the matrix */
btScalar determinant() const;
/**@brief Return the adjoint of the matrix */
btMatrix3x3 adjoint() const;
/**@brief Return the matrix with all values non negative */
btMatrix3x3 absolute() const;
/**@brief Return the transpose of the matrix */
btMatrix3x3 transpose() const;
/**@brief Return the inverse of the matrix */
btMatrix3x3 inverse() const;
btMatrix3x3 transposeTimes(const btMatrix3x3& m) const;
btMatrix3x3 timesTranspose(const btMatrix3x3& m) const;
SIMD_FORCE_INLINE btScalar tdotx(const btVector3& v) const
{
return m_el[0].x() * v.x() + m_el[1].x() * v.y() + m_el[2].x
() * v.z();
}
SIMD_FORCE_INLINE btScalar tdoty(const btVector3& v) const
{
return m_el[0].y() * v.x() + m_el[1].y() * v.y() + m_el[2].y
() * v.z();
}
SIMD_FORCE_INLINE btScalar tdotz(const btVector3& v) const
{
return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m_el[2].z
() * v.z();
}
/**@brief diagonalizes this matrix by the Jacobi method.
* @param rot stores the rotation from the coordinate system in which
the matrix is diagonal to the original
* coordinate system, i.e., old_this = rot * new_this * rot^T.
* @param threshold See iteration
* @param iteration The iteration stops when all off-diagonal element
s are less than the threshold multiplied
* by the sum of the absolute values of the diagonal, or when maxStep
s have been executed.
*
* Note that this matrix is assumed to be symmetric.
*/
void diagonalize(btMatrix3x3& rot, btScalar threshold, int maxSteps)
{
rot.setIdentity();
for (int step = maxSteps; step > 0; step--)
{ {
rot.setIdentity();
for (int step = maxSteps; step > 0; step--)
{
// find off-diagonal element [p][q] with largest mag nitude // find off-diagonal element [p][q] with largest mag nitude
int p = 0; int p = 0;
int q = 1; int q = 1;
int r = 2; int r = 2;
btScalar max = btFabs(m_el[0][1]); btScalar max = btFabs(m_el[0][1]);
btScalar v = btFabs(m_el[0][2]); btScalar v = btFabs(m_el[0][2]);
if (v > max) if (v > max)
{ {
q = 2; q = 2;
r = 1; r = 1;
max = v; max = v;
} }
v = btFabs(m_el[1][2]); v = btFabs(m_el[1][2]);
if (v > max) if (v > max)
{ {
p = 1; p = 1;
q = 2; q = 2;
r = 0; r = 0;
max = v; max = v;
} }
btScalar t = threshold * (btFabs(m_el[0][0]) + btFab s(m_el[1][1]) + btFabs(m_el[2][2])); btScalar t = threshold * (btFabs(m_el[0][0]) + btFab s(m_el[1][1]) + btFabs(m_el[2][2]));
if (max <= t) if (max <= t)
{ {
if (max <= SIMD_EPSILON * t) if (max <= SIMD_EPSILON * t)
{ {
return; return;
} }
step = 1; step = 1;
} }
// compute Jacobi rotation J which leads to a zero f or element [p][q] // compute Jacobi rotation J which leads to a zero f or element [p][q]
btScalar mpq = m_el[p][q]; btScalar mpq = m_el[p][q];
btScalar theta = (m_el[q][q] - m_el[p][p]) / (2 * mp q); btScalar theta = (m_el[q][q] - m_el[p][p]) / (2 * mp q);
btScalar theta2 = theta * theta; btScalar theta2 = theta * theta;
btScalar cos; btScalar cos;
btScalar sin; btScalar sin;
if (theta2 * theta2 < btScalar(10 / SIMD_EPSILON)) if (theta2 * theta2 < btScalar(10 / SIMD_EPSILON))
{ {
t = (theta >= 0) ? 1 / (theta + btSqrt(1 + theta2 t = (theta >= 0) ? 1 / (theta + btSqrt(1 + t
)) heta2))
: 1 / (theta - btSqrt(1 + theta2));
: 1 / (theta - btSqrt(1 + theta2)); cos = 1 / btSqrt(1 + t * t);
cos = 1 / btSqrt(1 + t * t); sin = cos * t;
sin = cos * t;
} }
else else
{ {
// approximation for large theta-value, i.e., a n // approximation for large theta-value, i.e.
early diagonal matrix , a nearly diagonal matrix
t = 1 / (theta * (2 + btScalar(0.5) / theta2)); t = 1 / (theta * (2 + btScalar(0.5) / theta2
cos = 1 - btScalar(0.5) * t * t; ));
sin = cos * t; cos = 1 - btScalar(0.5) * t * t;
sin = cos * t;
} }
// apply rotation to matrix (this = J^T * this * J) // apply rotation to matrix (this = J^T * this * J)
m_el[p][q] = m_el[q][p] = 0; m_el[p][q] = m_el[q][p] = 0;
m_el[p][p] -= t * mpq; m_el[p][p] -= t * mpq;
m_el[q][q] += t * mpq; m_el[q][q] += t * mpq;
btScalar mrp = m_el[r][p]; btScalar mrp = m_el[r][p];
btScalar mrq = m_el[r][q]; btScalar mrq = m_el[r][q];
m_el[r][p] = m_el[p][r] = cos * mrp - sin * mrq; m_el[r][p] = m_el[p][r] = cos * mrp - sin * mrq;
m_el[r][q] = m_el[q][r] = cos * mrq + sin * mrp; m_el[r][q] = m_el[q][r] = cos * mrq + sin * mrp;
// apply rotation to rot (rot = rot * J) // apply rotation to rot (rot = rot * J)
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
btVector3& row = rot[i]; btVector3& row = rot[i];
mrp = row[p]; mrp = row[p];
mrq = row[q]; mrq = row[q];
row[p] = cos * mrp - sin * mrq; row[p] = cos * mrp - sin * mrq;
row[q] = cos * mrq + sin * mrp; row[q] = cos * mrq + sin * mrp;
} }
}
} }
protected:
/**@brief Calculate the matrix cofactor
* @param r1 The first row to use for calculating the cofactor
* @param c1 The first column to use for calculating the cofactor
* @param r1 The second row to use for calculating the cofactor
* @param c1 The second column to use for calculating the cofactor
* See http://en.wikipedia.org/wiki/Cofactor_(linear_algebra) for more de
tails
*/
btScalar cofac(int r1, int c1, int r2, int c2) const
{
return m_el[r1][c1] * m_el[r2][c2] - m_el[r1][c2] *
m_el[r2][c1];
}
///Data storage for the matrix, each vector is a row of the matrix
btVector3 m_el[3];
};
SIMD_FORCE_INLINE btMatrix3x3&
btMatrix3x3::operator*=(const btMatrix3x3& m)
{
setValue(m.tdotx(m_el[0]), m.tdoty(m_el[0]), m.tdotz(m_el[0]
),
m.tdotx(m_el[1]), m.tdoty(m_el[1]), m.tdotz
(m_el[1]),
m.tdotx(m_el[2]), m.tdoty(m_el[2]), m.tdotz
(m_el[2]));
return *this;
} }
SIMD_FORCE_INLINE btScalar /**@brief Calculate the matrix cofactor
btMatrix3x3::determinant() const * @param r1 The first row to use for calculating the cofactor
* @param c1 The first column to use for calculating the cofactor
* @param r1 The second row to use for calculating the cofactor
* @param c1 The second column to use for calculating the cofactor
* See http://en.wikipedia.org/wiki/Cofactor_(linear_algebra) for mor
e details
*/
btScalar cofac(int r1, int c1, int r2, int c2) const
{ {
return btTriple((*this)[0], (*this)[1], (*this)[2]); return m_el[r1][c1] * m_el[r2][c2] - m_el[r1][c2] * m_el[r2] [c1];
} }
SIMD_FORCE_INLINE btMatrix3x3 void serialize(struct btMatrix3x3Data& dataOut) const;
btMatrix3x3::absolute() const
{
return btMatrix3x3(
btFabs(m_el[0].x()), btFabs(m_el[0].y()), btFabs(m_e
l[0].z()),
btFabs(m_el[1].x()), btFabs(m_el[1].y()), btFabs(m_e
l[1].z()),
btFabs(m_el[2].x()), btFabs(m_el[2].y()), btFabs(m_e
l[2].z()));
}
SIMD_FORCE_INLINE btMatrix3x3 void serializeFloat(struct btMatrix3x3FloatData& dataOut) const
btMatrix3x3::transpose() const ;
{
return btMatrix3x3(m_el[0].x(), m_el[1].x(), m_el[2].x(),
m_el[0].y()
, m_el[1].y(), m_el[2].y(),
m_el[0].z()
, m_el[1].z(), m_el[2].z());
}
SIMD_FORCE_INLINE btMatrix3x3 void deSerialize(const struct btMatrix3x3Data& dataIn);
btMatrix3x3::adjoint() const
{
return btMatrix3x3(cofac(1, 1, 2, 2), cofac(0, 2, 2, 1), cof
ac(0, 1, 1, 2),
cofac(1, 2,
2, 0), cofac(0, 0, 2, 2), cofac(0, 2, 1, 0),
cofac(1, 0,
2, 1), cofac(0, 1, 2, 0), cofac(0, 0, 1, 1));
}
SIMD_FORCE_INLINE btMatrix3x3 void deSerializeFloat(const struct btMatrix3x3FloatData& dataIn
btMatrix3x3::inverse() const );
{
btVector3 co(cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1,
0, 2, 1));
btScalar det = (*this)[0].dot(co);
btFullAssert(det != btScalar(0.0));
btScalar s = btScalar(1.0) / det;
return btMatrix3x3(co.x() * s, cofac(0, 2, 2, 1) * s, cofac(
0, 1, 1, 2) * s,
co.y() * s,
cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s,
co.z() * s,
cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s);
}
SIMD_FORCE_INLINE btMatrix3x3 void deSerializeDouble(const struct btMatrix3x3DoubleData& dataI
btMatrix3x3::transposeTimes(const btMatrix3x3& m) const n);
{
return btMatrix3x3(
m_el[0].x() * m[0].x() + m_el[1].x() * m[1].x() + m_
el[2].x() * m[2].x(),
m_el[0].x() * m[0].y() + m_el[1].x() * m[1].y() + m_
el[2].x() * m[2].y(),
m_el[0].x() * m[0].z() + m_el[1].x() * m[1].z() + m_
el[2].x() * m[2].z(),
m_el[0].y() * m[0].x() + m_el[1].y() * m[1].x() + m_
el[2].y() * m[2].x(),
m_el[0].y() * m[0].y() + m_el[1].y() * m[1].y() + m_
el[2].y() * m[2].y(),
m_el[0].y() * m[0].z() + m_el[1].y() * m[1].z() + m_
el[2].y() * m[2].z(),
m_el[0].z() * m[0].x() + m_el[1].z() * m[1].x() + m_
el[2].z() * m[2].x(),
m_el[0].z() * m[0].y() + m_el[1].z() * m[1].y() + m_
el[2].z() * m[2].y(),
m_el[0].z() * m[0].z() + m_el[1].z() * m[1].z() + m_
el[2].z() * m[2].z());
}
SIMD_FORCE_INLINE btMatrix3x3 };
btMatrix3x3::timesTranspose(const btMatrix3x3& m) const
{
return btMatrix3x3(
m_el[0].dot(m[0]), m_el[0].dot(m[1]), m_el[0].dot(m[
2]),
m_el[1].dot(m[0]), m_el[1].dot(m[1]), m_el[1].dot(m[
2]),
m_el[2].dot(m[0]), m_el[2].dot(m[1]), m_el[2].dot(m[
2]));
} SIMD_FORCE_INLINE btMatrix3x3&
btMatrix3x3::operator*=(const btMatrix3x3& m)
{
setValue(m.tdotx(m_el[0]), m.tdoty(m_el[0]), m.tdotz(m_el[0]),
m.tdotx(m_el[1]), m.tdoty(m_el[1]), m.tdotz(m_el[1]),
m.tdotx(m_el[2]), m.tdoty(m_el[2]), m.tdotz(m_el[2]));
return *this;
}
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btScalar
operator*(const btMatrix3x3& m, const btVector3& v) btMatrix3x3::determinant() const
{ {
return btVector3(m[0].dot(v), m[1].dot(v), m[2].dot(v)); return btTriple((*this)[0], (*this)[1], (*this)[2]);
} }
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btMatrix3x3
operator*(const btVector3& v, const btMatrix3x3& m) btMatrix3x3::absolute() const
{ {
return btVector3(m.tdotx(v), m.tdoty(v), m.tdotz(v)); return btMatrix3x3(
} btFabs(m_el[0].x()), btFabs(m_el[0].y()), btFabs(m_el[0].z()
),
btFabs(m_el[1].x()), btFabs(m_el[1].y()), btFabs(m_el[1].z()
),
btFabs(m_el[2].x()), btFabs(m_el[2].y()), btFabs(m_el[2].z()
));
}
SIMD_FORCE_INLINE btMatrix3x3 SIMD_FORCE_INLINE btMatrix3x3
operator*(const btMatrix3x3& m1, const btMatrix3x3& m2) btMatrix3x3::transpose() const
{ {
return btMatrix3x3( return btMatrix3x3(m_el[0].x(), m_el[1].x(), m_el[2].x(),
m2.tdotx( m1[0]), m2.tdoty( m1[0]), m2.tdotz( m1[0]) m_el[0].y(), m_el[1].y(), m_el[2].y(),
, m_el[0].z(), m_el[1].z(), m_el[2].z());
m2.tdotx( m1[1]), m2.tdoty( m1[1]), m2.tdotz( m1[1]) }
,
m2.tdotx( m1[2]), m2.tdoty( m1[2]), m2.tdotz( m1[2]) SIMD_FORCE_INLINE btMatrix3x3
); btMatrix3x3::adjoint() const
} {
return btMatrix3x3(cofac(1, 1, 2, 2), cofac(0, 2, 2, 1), cofac(0, 1,
1, 2),
cofac(1, 2, 2, 0), cofac(0, 0, 2, 2), cofac(0, 2, 1, 0),
cofac(1, 0, 2, 1), cofac(0, 1, 2, 0), cofac(0, 0, 1, 1));
}
SIMD_FORCE_INLINE btMatrix3x3
btMatrix3x3::inverse() const
{
btVector3 co(cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)
);
btScalar det = (*this)[0].dot(co);
btFullAssert(det != btScalar(0.0));
btScalar s = btScalar(1.0) / det;
return btMatrix3x3(co.x() * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1,
2) * s,
co.y() * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s,
co.z() * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s);
}
SIMD_FORCE_INLINE btMatrix3x3
btMatrix3x3::transposeTimes(const btMatrix3x3& m) const
{
return btMatrix3x3(
m_el[0].x() * m[0].x() + m_el[1].x() * m[1].x() + m_el[2].x(
) * m[2].x(),
m_el[0].x() * m[0].y() + m_el[1].x() * m[1].y() + m_el[2].x(
) * m[2].y(),
m_el[0].x() * m[0].z() + m_el[1].x() * m[1].z() + m_el[2].x(
) * m[2].z(),
m_el[0].y() * m[0].x() + m_el[1].y() * m[1].x() + m_el[2].y(
) * m[2].x(),
m_el[0].y() * m[0].y() + m_el[1].y() * m[1].y() + m_el[2].y(
) * m[2].y(),
m_el[0].y() * m[0].z() + m_el[1].y() * m[1].z() + m_el[2].y(
) * m[2].z(),
m_el[0].z() * m[0].x() + m_el[1].z() * m[1].x() + m_el[2].z(
) * m[2].x(),
m_el[0].z() * m[0].y() + m_el[1].z() * m[1].y() + m_el[2].z(
) * m[2].y(),
m_el[0].z() * m[0].z() + m_el[1].z() * m[1].z() + m_el[2].z(
) * m[2].z());
}
SIMD_FORCE_INLINE btMatrix3x3
btMatrix3x3::timesTranspose(const btMatrix3x3& m) const
{
return btMatrix3x3(
m_el[0].dot(m[0]), m_el[0].dot(m[1]), m_el[0].dot(m[2]),
m_el[1].dot(m[0]), m_el[1].dot(m[1]), m_el[1].dot(m[2]),
m_el[2].dot(m[0]), m_el[2].dot(m[1]), m_el[2].dot(m[2]));
}
SIMD_FORCE_INLINE btVector3
operator*(const btMatrix3x3& m, const btVector3& v)
{
return btVector3(m[0].dot(v), m[1].dot(v), m[2].dot(v));
}
SIMD_FORCE_INLINE btVector3
operator*(const btVector3& v, const btMatrix3x3& m)
{
return btVector3(m.tdotx(v), m.tdoty(v), m.tdotz(v));
}
SIMD_FORCE_INLINE btMatrix3x3
operator*(const btMatrix3x3& m1, const btMatrix3x3& m2)
{
return btMatrix3x3(
m2.tdotx( m1[0]), m2.tdoty( m1[0]), m2.tdotz( m1[0]),
m2.tdotx( m1[1]), m2.tdoty( m1[1]), m2.tdotz( m1[1]),
m2.tdotx( m1[2]), m2.tdoty( m1[2]), m2.tdotz( m1[2]));
}
/* /*
SIMD_FORCE_INLINE btMatrix3x3 btMultTransposeLeft(const btMatrix3x3& SIMD_FORCE_INLINE btMatrix3x3 btMultTransposeLeft(const btMatrix3x3& m1, co
m1, const btMatrix3x3& m2) { nst btMatrix3x3& m2) {
return btMatrix3x3( return btMatrix3x3(
m1[0][0] * m2[0][0] + m1[1][0] * m2[1][0] + m1[2][0] * m2[2][0], m1[0][0] * m2[0][0] + m1[1][0] * m2[1][0] + m1[2][0] * m2[2][0],
m1[0][0] * m2[0][1] + m1[1][0] * m2[1][1] + m1[2][0] * m2[2][1], m1[0][0] * m2[0][1] + m1[1][0] * m2[1][1] + m1[2][0] * m2[2][1],
m1[0][0] * m2[0][2] + m1[1][0] * m2[1][2] + m1[2][0] * m2[2][2], m1[0][0] * m2[0][2] + m1[1][0] * m2[1][2] + m1[2][0] * m2[2][2],
m1[0][1] * m2[0][0] + m1[1][1] * m2[1][0] + m1[2][1] * m2[2][0], m1[0][1] * m2[0][0] + m1[1][1] * m2[1][0] + m1[2][1] * m2[2][0],
m1[0][1] * m2[0][1] + m1[1][1] * m2[1][1] + m1[2][1] * m2[2][1], m1[0][1] * m2[0][1] + m1[1][1] * m2[1][1] + m1[2][1] * m2[2][1],
m1[0][1] * m2[0][2] + m1[1][1] * m2[1][2] + m1[2][1] * m2[2][2], m1[0][1] * m2[0][2] + m1[1][1] * m2[1][2] + m1[2][1] * m2[2][2],
m1[0][2] * m2[0][0] + m1[1][2] * m2[1][0] + m1[2][2] * m2[2][0], m1[0][2] * m2[0][0] + m1[1][2] * m2[1][0] + m1[2][2] * m2[2][0],
m1[0][2] * m2[0][1] + m1[1][2] * m2[1][1] + m1[2][2] * m2[2][1], m1[0][2] * m2[0][1] + m1[1][2] * m2[1][1] + m1[2][2] * m2[2][1],
m1[0][2] * m2[0][2] + m1[1][2] * m2[1][2] + m1[2][2] * m2[2][2]); m1[0][2] * m2[0][2] + m1[1][2] * m2[1][2] + m1[2][2] * m2[2][2]);
} }
*/ */
/**@brief Equality operator between two matrices /**@brief Equality operator between two matrices
* It will test all elements are equal. */ * It will test all elements are equal. */
SIMD_FORCE_INLINE bool operator==(const btMatrix3x3& m1, const btMatrix3x3& m2) SIMD_FORCE_INLINE bool operator==(const btMatrix3x3& m1, const btMatrix3x3& m2)
{ {
return ( m1[0][0] == m2[0][0] && m1[1][0] == m2[1][0] && m1[2][0] == m2[ return ( m1[0][0] == m2[0][0] && m1[1][0] == m2[1][0] && m1[2][0] ==
2][0] && m2[2][0] &&
m1[0][1] == m2[0][1] && m1[1][1] == m2[1][1] && m1[2][1] == m2[ m1[0][1] == m2[0][1] && m1[1][1] == m2[1][1] && m1[2][1] ==
2][1] && m2[2][1] &&
m1[0][2] == m2[0][2] && m1[1][2] == m2[1][2] && m1[2][2] == m2[ m1[0][2] == m2[0][2] && m1[1][2] == m2[1][2] && m1[2][2] ==
2][2] ); m2[2][2] );
} }
#endif ///for serialization
struct btMatrix3x3FloatData
{
btVector3FloatData m_el[3];
};
///for serialization
struct btMatrix3x3DoubleData
{
btVector3DoubleData m_el[3];
};
SIMD_FORCE_INLINE void btMatrix3x3::serialize(struct btMatrix3x3D
ata& dataOut) const
{
for (int i=0;i<3;i++)
m_el[i].serialize(dataOut.m_el[i]);
}
SIMD_FORCE_INLINE void btMatrix3x3::serializeFloat(struct btMa
trix3x3FloatData& dataOut) const
{
for (int i=0;i<3;i++)
m_el[i].serializeFloat(dataOut.m_el[i]);
}
SIMD_FORCE_INLINE void btMatrix3x3::deSerialize(const struct btMa
trix3x3Data& dataIn)
{
for (int i=0;i<3;i++)
m_el[i].deSerialize(dataIn.m_el[i]);
}
SIMD_FORCE_INLINE void btMatrix3x3::deSerializeFloat(const struct
btMatrix3x3FloatData& dataIn)
{
for (int i=0;i<3;i++)
m_el[i].deSerializeFloat(dataIn.m_el[i]);
}
SIMD_FORCE_INLINE void btMatrix3x3::deSerializeDouble(const struct
btMatrix3x3DoubleData& dataIn)
{
for (int i=0;i<3;i++)
m_el[i].deSerializeDouble(dataIn.m_el[i]);
}
#endif //BT_MATRIX3x3_H
 End of changes. 69 change blocks. 
541 lines changed or deleted 537 lines changed or added


 btMinkowskiPenetrationDepthSolver.h   btMinkowskiPenetrationDepthSolver.h 
skipping to change at line 25 skipping to change at line 25
#ifndef MINKOWSKI_PENETRATION_DEPTH_SOLVER_H #ifndef MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
#define MINKOWSKI_PENETRATION_DEPTH_SOLVER_H #define MINKOWSKI_PENETRATION_DEPTH_SOLVER_H
#include "btConvexPenetrationDepthSolver.h" #include "btConvexPenetrationDepthSolver.h"
///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. ///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation.
///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points. ///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points.
class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSo lver class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSo lver
{ {
protected:
static btVector3* getPenetrationDirections();
public: public:
virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver,
const btConvexShape* convexA,const btConvexShape* convexB, const btConvexShape* convexA,const btConvexShape* convexB,
const btTransform& transA,const btTransform& transB, const btTransform& transA,const btTransform& transB,
btVector3& v, btVector3& pa, btVector3& pb, btVector3& v, btVector3& pa, btVector3& pb,
class btIDebugDraw* debugDraw,btStackAlloc* stackAll oc class btIDebugDraw* debugDraw,btStackAlloc* stackAll oc
); );
}; };
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 btMultiSphereShape.h   btMultiSphereShape.h 
skipping to change at line 63 skipping to change at line 63
btScalar getSphereRadius(int index) const btScalar getSphereRadius(int index) const
{ {
return m_radiArray[index]; return m_radiArray[index];
} }
virtual const char* getName()const virtual const char* getName()const
{ {
return "MultiSphere"; return "MultiSphere";
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
struct btPositionAndRadius
{
btVector3FloatData m_pos;
float m_radius;
};
struct btMultiSphereShapeData
{
btConvexInternalShapeData m_convexInternalShapeData;
btPositionAndRadius *m_localPositionArrayPtr;
int m_localPositionArraySize;
char m_padding[4];
};
SIMD_FORCE_INLINE int btMultiSphereShape::calculateSerializeBuffer
Size() const
{
return sizeof(btMultiSphereShapeData);
}
#endif //MULTI_SPHERE_MINKOWSKI_H #endif //MULTI_SPHERE_MINKOWSKI_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 28 lines changed or added


 btMultimaterialTriangleMeshShape.h   btMultimaterialTriangleMeshShape.h 
skipping to change at line 40 skipping to change at line 40
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {m_shapeTy pe = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;} 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; m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
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;
//m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * mesh Interface->getNumSubParts(), 16)); //m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * mesh Interface->getNumSubParts(), 16));
skipping to change at line 74 skipping to change at line 73
//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; m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
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;
//m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * mesh Interface->getNumSubParts(), 16)); //m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * mesh Interface->getNumSubParts(), 16));
 End of changes. 2 change blocks. 
2 lines changed or deleted 0 lines changed or added


 btOptimizedBvh.h   btOptimizedBvh.h 
skipping to change at line 49 skipping to change at line 49
void build(btStridingMeshInterface* triangles,bool useQuantizedAa bbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax); void build(btStridingMeshInterface* triangles,bool useQuantizedAa bbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax);
void refit(btStridingMeshInterface* triangles,const btVector3& aa bbMin,const btVector3& aabbMax); void refit(btStridingMeshInterface* triangles,const btVector3& aa bbMin,const btVector3& aabbMax);
void refitPartial(btStridingMeshInterface* triangles,const btVect or3& aabbMin, const btVector3& aabbMax); void refitPartial(btStridingMeshInterface* triangles,const btVect or3& aabbMin, const btVector3& aabbMax);
void updateBvhNodes(btStridingMeshInterface* meshInterface,int fi rstNode,int endNode,int index); void updateBvhNodes(btStridingMeshInterface* meshInterface,int fi rstNode,int endNode,int index);
/// Data buffer MUST be 16 byte aligned /// Data buffer MUST be 16 byte aligned
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBuf ferSize, bool i_swapEndian) virtual bool serializeInPlace(void *o_alignedDataBuffer, unsigned i_ dataBufferSize, bool i_swapEndian) const
{ {
return btQuantizedBvh::serialize(o_alignedDataBuffer,i_dataB ufferSize,i_swapEndian); return btQuantizedBvh::serialize(o_alignedDataBuffer,i_dataB ufferSize,i_swapEndian);
} }
///deSerializeInPlace loads and initializes a BVH from a buffer in m emory 'in place' ///deSerializeInPlace loads and initializes a BVH from a buffer in m emory 'in place'
static btOptimizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian); static btOptimizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian);
}; };
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 btOverlappingPairCache.h   btOverlappingPairCache.h 
skipping to change at line 427 skipping to change at line 427
{ {
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) virtual void sortOverlappingPairs(btDispatcher* dispatcher)
{ {
(void) dispatcher;
} }
}; };
#endif //OVERLAPPING_PAIR_CACHE_H #endif //OVERLAPPING_PAIR_CACHE_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 btPersistentManifold.h   btPersistentManifold.h 
skipping to change at line 32 skipping to change at line 32
#include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btAlignedAllocator.h"
struct btCollisionResult; struct btCollisionResult;
///maximum contact breaking and merging threshold ///maximum contact breaking and merging threshold
extern btScalar gContactBreakingThreshold; extern btScalar gContactBreakingThreshold;
typedef bool (*ContactDestroyedCallback)(void* userPersistentData); typedef bool (*ContactDestroyedCallback)(void* userPersistentData);
typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,vo id* body1); typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,vo id* body1);
extern ContactDestroyedCallback gContactDestroyedCallback; extern ContactDestroyedCallback gContactDestroyedCallback;
extern ContactProcessedCallback gContactProcessedCallback;
enum btContactManifoldTypes enum btContactManifoldTypes
{ {
BT_PERSISTENT_MANIFOLD_TYPE = 1, BT_PERSISTENT_MANIFOLD_TYPE = 1,
MAX_CONTACT_MANIFOLD_TYPE MAX_CONTACT_MANIFOLD_TYPE
}; };
#define MANIFOLD_CACHE_SIZE 4 #define MANIFOLD_CACHE_SIZE 4
///btPersistentManifold is a contact point cache, it stays persistent as lo ng as objects are overlapping in the broadphase. ///btPersistentManifold is a contact point cache, it stays persistent as lo ng as objects are overlapping in the broadphase.
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 btPoint2PointConstraint.h   btPoint2PointConstraint.h 
skipping to change at line 25 skipping to change at line 25
#ifndef POINT2POINTCONSTRAINT_H #ifndef POINT2POINTCONSTRAINT_H
#define POINT2POINTCONSTRAINT_H #define POINT2POINTCONSTRAINT_H
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "btJacobianEntry.h" #include "btJacobianEntry.h"
#include "btTypedConstraint.h" #include "btTypedConstraint.h"
class btRigidBody; class btRigidBody;
#ifdef BT_USE_DOUBLE_PRECISION
#define btPoint2PointConstraintData btPoint2PointConstraintDoubleData
#define btPoint2PointConstraintDataName "btPoint2PointConstraintDoub
leData"
#else
#define btPoint2PointConstraintData btPoint2PointConstraintFloatData
#define btPoint2PointConstraintDataName "btPoint2PointConstraintFloa
tData"
#endif //BT_USE_DOUBLE_PRECISION
struct btConstraintSetting struct btConstraintSetting
{ {
btConstraintSetting() : btConstraintSetting() :
m_tau(btScalar(0.3)), m_tau(btScalar(0.3)),
m_damping(btScalar(1.)), m_damping(btScalar(1.)),
m_impulseClamp(btScalar(0.)) m_impulseClamp(btScalar(0.))
{ {
} }
btScalar m_tau; btScalar m_tau;
btScalar m_damping; btScalar m_damping;
btScalar m_impulseClamp; btScalar m_impulseClamp;
}; };
enum btPoint2PointFlags
{
BT_P2P_FLAGS_ERP = 1,
BT_P2P_FLAGS_CFM = 2
};
/// point to point constraint between two rigidbodies each with a pivotpoin t that descibes the 'ballsocket' location in local space /// point to point constraint between two rigidbodies each with a pivotpoin t that descibes the 'ballsocket' location in local space
ATTRIBUTE_ALIGNED16(class) btPoint2PointConstraint : public btTypedConstrai nt ATTRIBUTE_ALIGNED16(class) btPoint2PointConstraint : public btTypedConstrai nt
{ {
#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;
int m_flags;
btScalar m_erp;
btScalar m_cfm;
public: public:
///for backwards compatibility during the transition to 'getInfo/get Info2' ///for backwards compatibility during the transition to 'getInfo/get Info2'
bool m_useSolveConstraintObsolete; 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();
virtual void buildJacobian(); virtual void buildJacobian();
virtual void getInfo1 (btConstraintInfo1* info); virtual void getInfo1 (btConstraintInfo1* info);
void getInfo1NonVirtual (btConstraintInfo1* info); void getInfo1NonVirtual (btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info); virtual void getInfo2 (btConstraintInfo2* info);
void getInfo2NonVirtual (btConstraintInfo2* info, const btTransform& body0_trans, const btTransform& body1_trans); void getInfo2NonVirtual (btConstraintInfo2* info, const btTransform& body0_trans, const btTransform& body1_trans);
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)
{ {
m_pivotInB = pivotB; m_pivotInB = pivotB;
skipping to change at line 96 skipping to change at line 110
const btVector3& getPivotInA() const const btVector3& getPivotInA() const
{ {
return m_pivotInA; return m_pivotInA;
} }
const btVector3& getPivotInB() const const btVector3& getPivotInB() const
{ {
return m_pivotInB; return m_pivotInB;
} }
///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constra
int.
virtual void setParam(int num, btScalar value, int axis = -1);
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btPoint2PointConstraintFloatData
{
btTypedConstraintData m_typeConstraintData;
btVector3FloatData m_pivotInA;
btVector3FloatData m_pivotInB;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btPoint2PointConstraintDoubleData
{
btTypedConstraintData m_typeConstraintData;
btVector3DoubleData m_pivotInA;
btVector3DoubleData m_pivotInB;
};
SIMD_FORCE_INLINE int btPoint2PointConstraint::calculateSerializeB
ufferSize() const
{
return sizeof(btPoint2PointConstraintData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btPoint2PointConstraint::serialize(v
oid* dataBuffer, btSerializer* serializer) const
{
btPoint2PointConstraintData* p2pData = (btPoint2PointConstraintData*
)dataBuffer;
btTypedConstraint::serialize(&p2pData->m_typeConstraintData,serializ
er);
m_pivotInA.serialize(p2pData->m_pivotInA);
m_pivotInB.serialize(p2pData->m_pivotInB);
return btPoint2PointConstraintDataName;
}
#endif //POINT2POINTCONSTRAINT_H #endif //POINT2POINTCONSTRAINT_H
 End of changes. 7 change blocks. 
5 lines changed or deleted 76 lines changed or added


 btQuantizedBvh.h   btQuantizedBvh.h 
skipping to change at line 19 skipping to change at line 19
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 QUANTIZED_BVH_H #ifndef QUANTIZED_BVH_H
#define QUANTIZED_BVH_H #define QUANTIZED_BVH_H
class btSerializer;
//#define DEBUG_CHECK_DEQUANTIZATION 1 //#define DEBUG_CHECK_DEQUANTIZATION 1
#ifdef DEBUG_CHECK_DEQUANTIZATION #ifdef DEBUG_CHECK_DEQUANTIZATION
#ifdef __SPU__ #ifdef __SPU__
#define printf spu_printf #define printf spu_printf
#endif //__SPU__ #endif //__SPU__
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#endif //DEBUG_CHECK_DEQUANTIZATION #endif //DEBUG_CHECK_DEQUANTIZATION
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btAlignedAllocator.h" #include "LinearMath/btAlignedAllocator.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btQuantizedBvhData btQuantizedBvhDoubleData
#define btOptimizedBvhNodeData btOptimizedBvhNodeDoubleData
#define btQuantizedBvhDataName "btQuantizedBvhDoubleData"
#else
#define btQuantizedBvhData btQuantizedBvhFloatData
#define btOptimizedBvhNodeData btOptimizedBvhNodeFloatData
#define btQuantizedBvhDataName "btQuantizedBvhFloatData"
#endif
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/h tml/vclrf__m128.asp //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/h tml/vclrf__m128.asp
//Note: currently we have 16 bytes per quantized node //Note: currently we have 16 bytes per quantized node
#define MAX_SUBTREE_SIZE_IN_BYTES 2048 #define MAX_SUBTREE_SIZE_IN_BYTES 2048
// 10 gives the potential for 1024 parts, with at most 2^21 (2097152) (minu s one // 10 gives the potential for 1024 parts, with at most 2^21 (2097152) (minu s one
// actually) triangles each (since the sign bit is reserved // actually) triangles each (since the sign bit is reserved
#define MAX_NUM_PARTS_IN_BITS 10 #define MAX_NUM_PARTS_IN_BITS 10
///btQuantizedBvhNode is a compressed aabb node, 16 bytes. ///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
skipping to change at line 181 skipping to change at line 193
NodeArray m_leafNodes; NodeArray m_leafNodes;
NodeArray m_contiguousNodes; NodeArray m_contiguousNodes;
QuantizedNodeArray m_quantizedLeafNodes; QuantizedNodeArray m_quantizedLeafNodes;
QuantizedNodeArray m_quantizedContiguousNodes; QuantizedNodeArray m_quantizedContiguousNodes;
btTraversalMode m_traversalMode; btTraversalMode m_traversalMode;
BvhSubtreeInfoArray m_SubtreeHeaders; BvhSubtreeInfoArray m_SubtreeHeaders;
//This is only used for serialization so we don't have to add serial ization directly to btAlignedObjectArray //This is only used for serialization so we don't have to add serial ization directly to btAlignedObjectArray
int m_subtreeHeaderCount; mutable int m_subtreeHeaderCount;
///two versions, one for quantized and normal nodes. This allows cod e-reuse while maintaining readability (no template/macro!) ///two versions, one for quantized and normal nodes. This allows cod e-reuse while maintaining readability (no template/macro!)
///this might be refactored into a virtual, it is usually not calcul ated at run-time ///this might be refactored into a virtual, it is usually not calcul ated at run-time
void setInternalNodeAabbMin(int nodeIndex, const btVector3& aabbM in) void setInternalNodeAabbMin(int nodeIndex, const btVector3& aabbM in)
{ {
if (m_useQuantization) if (m_useQuantization)
{ {
quantize(&m_quantizedContiguousNodes[nodeIndex].m_qu antizedAabbMin[0] ,aabbMin,0); quantize(&m_quantizedContiguousNodes[nodeIndex].m_qu antizedAabbMin[0] ,aabbMin,0);
} else } else
{ {
skipping to change at line 419 skipping to change at line 431
SIMD_FORCE_INLINE QuantizedNodeArray& getQuantizedNodeArray() SIMD_FORCE_INLINE QuantizedNodeArray& getQuantizedNodeArray()
{ {
return m_quantizedContiguousNodes; return m_quantizedContiguousNodes;
} }
SIMD_FORCE_INLINE BvhSubtreeInfoArray& getSubtreeInfoArray() SIMD_FORCE_INLINE BvhSubtreeInfoArray& getSubtreeInfoArray()
{ {
return m_SubtreeHeaders; return m_SubtreeHeaders;
} }
////////////////////////////////////////////////////////////////////
/////Calculate space needed to store BVH for serialization /////Calculate space needed to store BVH for serialization
unsigned calculateSerializeBufferSize(); unsigned calculateSerializeBufferSize() const;
/// Data buffer MUST be 16 byte aligned /// Data buffer MUST be 16 byte aligned
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBuf ferSize, bool i_swapEndian); virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBuf ferSize, bool i_swapEndian) const;
///deSerializeInPlace loads and initializes a BVH from a buffer in m emory 'in place' ///deSerializeInPlace loads and initializes a BVH from a buffer in m emory 'in place'
static btQuantizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian); static btQuantizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian);
static unsigned int getAlignmentSerializationPadding(); static unsigned int getAlignmentSerializationPadding();
//////////////////////////////////////////////////////////////////////
virtual int calculateSerializeBufferSizeNew() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
virtual void deSerializeFloat(struct btQuantizedBvhFloatData& quanti
zedBvhFloatData);
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData& quan
tizedBvhDoubleData);
////////////////////////////////////////////////////////////////////
SIMD_FORCE_INLINE bool isQuantized() SIMD_FORCE_INLINE bool isQuantized()
{ {
return m_useQuantization; return m_useQuantization;
} }
private: private:
// Special "copy" constructor that allows for in-place deserializati on // Special "copy" constructor that allows for in-place deserializati on
// Prevents btVector3's default constructor from being called, but d oesn't inialize much else // Prevents btVector3's default constructor from being called, but d oesn't inialize much else
// ownsMemory should most likely be false if deserializing, and if y ou are not, don't call this (it also changes the function signature, which we need) // ownsMemory should most likely be false if deserializing, and if y ou are not, don't call this (it also changes the function signature, which we need)
btQuantizedBvh(btQuantizedBvh &other, bool ownsMemory); btQuantizedBvh(btQuantizedBvh &other, bool ownsMemory);
} }
; ;
struct btBvhSubtreeInfoData
{
int m_rootNodeIndex;
int m_subtreeSize;
unsigned short m_quantizedAabbMin[3];
unsigned short m_quantizedAabbMax[3];
};
struct btOptimizedBvhNodeFloatData
{
btVector3FloatData m_aabbMinOrg;
btVector3FloatData m_aabbMaxOrg;
int m_escapeIndex;
int m_subPart;
int m_triangleIndex;
char m_pad[4];
};
struct btOptimizedBvhNodeDoubleData
{
btVector3DoubleData m_aabbMinOrg;
btVector3DoubleData m_aabbMaxOrg;
int m_escapeIndex;
int m_subPart;
int m_triangleIndex;
char m_pad[4];
};
struct btQuantizedBvhNodeData
{
unsigned short m_quantizedAabbMin[3];
unsigned short m_quantizedAabbMax[3];
int m_escapeIndexOrTriangleIndex;
};
struct btQuantizedBvhFloatData
{
btVector3FloatData m_bvhAabbMin;
btVector3FloatData m_bvhAabbMax;
btVector3FloatData m_bvhQuantization;
int m_curNodeIndex;
int m_useQuantization;
int m_numContiguousLeafNodes;
int m_numQuantizedContiguousNode
s;
btOptimizedBvhNodeFloatData *m_contiguousNodesPtr;
btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr;
btBvhSubtreeInfoData *m_subTreeInfoPtr;
int m_traversalMode;
int m_numSubtreeHeaders;
};
struct btQuantizedBvhDoubleData
{
btVector3DoubleData m_bvhAabbMin;
btVector3DoubleData m_bvhAabbMax;
btVector3DoubleData m_bvhQuantization;
int m_curNodeInd
ex;
int m_useQuantiz
ation;
int m_numContigu
ousLeafNodes;
int m_numQuantiz
edContiguousNodes;
btOptimizedBvhNodeDoubleData *m_contiguousNodesPtr;
btQuantizedBvhNodeData *m_quantizedContiguousNodesP
tr;
int m_traversalM
ode;
int m_numSubtree
Headers;
btBvhSubtreeInfoData *m_subTreeInfoPtr;
};
SIMD_FORCE_INLINE int btQuantizedBvh::calculateSerializeBufferSize
New() const
{
return sizeof(btQuantizedBvhData);
}
#endif //QUANTIZED_BVH_H #endif //QUANTIZED_BVH_H
 End of changes. 8 change blocks. 
3 lines changed or deleted 116 lines changed or added


 btQuaternion.h   btQuaternion.h 
skipping to change at line 283 skipping to change at line 283
* @param t The ratio between this and q to interpolate. If t = 0 the re sult is this, if t=1 the result is q. * @param t The ratio between this and q to interpolate. If t = 0 the re sult is this, if t=1 the result is q.
* Slerp interpolates assuming constant velocity. */ * Slerp interpolates assuming constant velocity. */
btQuaternion slerp(const btQuaternion& q, const btScalar& t) const btQuaternion slerp(const btQuaternion& q, const btScalar& t) const
{ {
btScalar theta = angle(q); btScalar theta = angle(q);
if (theta != btScalar(0.0)) if (theta != btScalar(0.0))
{ {
btScalar d = btScalar(1.0) / btSin(theta); btScalar d = btScalar(1.0) / btSin(theta);
btScalar s0 = btSin((btScalar(1.0) - t) * theta); btScalar s0 = btSin((btScalar(1.0) - t) * theta);
btScalar s1 = btSin(t * theta); btScalar s1 = btSin(t * theta);
return btQuaternion((m_floats[0] * s0 + q.x() * s1) if (dot(q) < 0) // Take care of long angle case see
* d, http://en.wikipedia.org/wiki/Slerp
(m_floats[1] * s0 + q.y() * s1) * d, return btQuaternion((m_floats[0] * s0 + -q.x() *
(m_floats[2] * s0 + q.z() * s1) * d, s1) * d,
(m_floats[3] * s0 + q.m_floats[3] * s1) * d) (m_floats[1] * s0 + -q.y() *
; s1) * d,
(m_floats[2] * s0 + -q.z() *
s1) * d,
(m_floats[3] * s0 + -q.m_floa
ts[3] * s1) * d);
else
return btQuaternion((m_floats[0] * s0 + q.x() * s
1) * d,
(m_floats[1] * s0 + q.y() * s
1) * d,
(m_floats[2] * s0 + q.z() * s
1) * d,
(m_floats[3] * s0 + q.m_float
s[3] * s1) * d);
} }
else else
{ {
return *this; return *this;
} }
} }
static const btQuaternion& getIdentity() static const btQuaternion& getIdentity()
{ {
static const btQuaternion identityQuat(btScalar(0.),btScalar (0.),btScalar(0.),btScalar(1.)); static const btQuaternion identityQuat(btScalar(0.),btScalar (0.),btScalar(0.),btScalar(1.));
 End of changes. 1 change blocks. 
6 lines changed or deleted 20 lines changed or added


 btQuickprof.h   btQuickprof.h 
skipping to change at line 21 skipping to change at line 21
// Ogre (www.ogre3d.org). // Ogre (www.ogre3d.org).
#ifndef QUICK_PROF_H #ifndef QUICK_PROF_H
#define QUICK_PROF_H #define QUICK_PROF_H
//To disable built-in profiling, please comment out next line //To disable built-in profiling, please comment out next line
//#define BT_NO_PROFILE 1 //#define BT_NO_PROFILE 1
#ifndef BT_NO_PROFILE #ifndef BT_NO_PROFILE
#include "btScalar.h" #include "btScalar.h"
#include "LinearMath/btAlignedAllocator.h" #include "btAlignedAllocator.h"
#include <new> #include <new>
//if you don't need btClock, you can comment next line //if you don't need btClock, you can comment next line
#define USE_BT_CLOCK 1 #define USE_BT_CLOCK 1
#ifdef USE_BT_CLOCK #ifdef USE_BT_CLOCK
#ifdef __CELLOS_LV2__ #ifdef __CELLOS_LV2__
#include <sys/sys_time.h> #include <sys/sys_time.h>
#include <sys/time_util.h> #include <sys/time_util.h>
#include <stdio.h> #include <stdio.h>
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 btRaycastVehicle.h   btRaycastVehicle.h 
skipping to change at line 33 skipping to change at line 33
///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 btActionInterface 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;
///backwards compatibility
int m_userConstraintType;
int m_userConstraintId;
public: public:
class btVehicleTuning class btVehicleTuning
{ {
public: public:
btVehicleTuning() btVehicleTuning()
:m_suspensionStiffness(btScalar(5.88)), :m_suspensionStiffness(btScalar(5.88)),
m_suspensionCompression(btScalar(0.83)), m_suspensionCompression(btScalar(0.83)),
m_suspensionDamping(btScalar(0.88)), m_suspensionDamping(btScalar(0.88)),
m_maxSuspensionTravelCm(btScalar(500.)), m_maxSuspensionTravelCm(btScalar(500.)),
m_frictionSlip(btScalar(10.5)) m_frictionSlip(btScalar(10.5)),
m_maxSuspensionForce(btScalar(6000.))
{ {
} }
btScalar m_suspensionStiffness; btScalar m_suspensionStiffness;
btScalar m_suspensionCompression; btScalar m_suspensionCompression;
btScalar m_suspensionDamping; btScalar m_suspensionDamping;
btScalar m_maxSuspensionTravelCm; btScalar m_maxSuspensionTravelCm;
btScalar m_frictionSlip; btScalar m_frictionSlip;
btScalar m_maxSuspensionForce;
}; };
private: private:
btScalar m_tau; btScalar m_tau;
btScalar m_damping; btScalar m_damping;
btVehicleRaycaster* m_vehicleRaycaster; btVehicleRaycaster* m_vehicleRaycaster;
btScalar m_pitchControl; btScalar m_pitchControl;
btScalar m_steeringValue; btScalar m_steeringValue;
btScalar m_currentVehicleSpeedKmHour; btScalar m_currentVehicleSpeedKmHour;
skipping to change at line 80 skipping to change at line 86
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 ///btActionInterface interface
virtual void updateAction( btCollisionWorld* collisionWorld, btScala r step) virtual void updateAction( btCollisionWorld* collisionWorld, btScala r step)
{ {
(void) collisionWorld;
updateVehicle(step); updateVehicle(step);
} }
///btActionInterface interface ///btActionInterface interface
void debugDraw(btIDebugDraw* debugDrawer); void debugDraw(btIDebugDraw* debugDrawer);
const btTransform& getChassisWorldTransform() const; const btTransform& getChassisWorldTransform() const;
btScalar rayCast(btWheelInfo& wheel); btScalar rayCast(btWheelInfo& wheel);
skipping to change at line 181 skipping to change at line 188
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;
} }
///backwards compatibility
int getUserConstraintType() const
{
return m_userConstraintType ;
}
void setUserConstraintType(int userConstraintType)
{
m_userConstraintType = userConstraintType;
};
void setUserConstraintId(int uid)
{
m_userConstraintId = uid;
}
int getUserConstraintId() const
{
return m_userConstraintId;
}
}; };
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. 5 change blocks. 
1 lines changed or deleted 29 lines changed or added


 btRigidBody.h   btRigidBody.h 
skipping to change at line 31 skipping to change at line 31
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h"
class btCollisionShape; class btCollisionShape;
class btMotionState; class btMotionState;
class btTypedConstraint; class btTypedConstraint;
extern btScalar gDeactivationTime; extern btScalar gDeactivationTime;
extern bool gDisableDeactivation; extern bool gDisableDeactivation;
#ifdef BT_USE_DOUBLE_PRECISION
#define btRigidBodyData btRigidBodyDoubleData
#define btRigidBodyDataName "btRigidBodyDoubleData"
#else
#define btRigidBodyData btRigidBodyFloatData
#define btRigidBodyDataName "btRigidBodyFloatData"
#endif //BT_USE_DOUBLE_PRECISION
enum btRigidBodyFlags
{
BT_DISABLE_WORLD_GRAVITY = 1
};
///The btRigidBody is the main class for rigid body objects. It is derived from btCollisionObject, so it keeps a pointer to a btCollisionShape. ///The btRigidBody is the main class for rigid body objects. It is derived from btCollisionObject, so it keeps a pointer to a btCollisionShape.
///It is recommended for performance and memory use to share btCollisionSha pe objects whenever possible. ///It is recommended for performance and memory use to share btCollisionSha pe objects whenever possible.
///There are 3 types of rigid bodies: ///There are 3 types of rigid bodies:
///- A) Dynamic rigid bodies, with positive mass. Motion is controlled by r igid body dynamics. ///- A) Dynamic rigid bodies, with positive mass. Motion is controlled by r igid body dynamics.
///- B) Fixed objects with zero mass. They are not moving (basically collis ion objects) ///- B) Fixed objects with zero mass. They are not moving (basically collis ion objects)
///- C) Kinematic objects, which are objects without mass, but the user can move them. There is on-way interaction, and Bullet calculates a velocity b ased on the timestep and previous and current world transform. ///- C) Kinematic objects, which are objects without mass, but the user can move them. There is on-way interaction, and Bullet calculates a velocity b ased on the timestep and previous and current world transform.
///Bullet automatically deactivates dynamic rigid bodies, when the velocity is below a threshold for a given time. ///Bullet automatically deactivates dynamic rigid bodies, when the velocity is below a threshold for a given time.
///Deactivated (sleeping) rigid bodies don't take any processing time, exce pt a minor broadphase collision detection impact (to allow active objects t o activate/wake up sleeping objects) ///Deactivated (sleeping) rigid bodies don't take any processing time, exce pt a minor broadphase collision detection impact (to allow active objects t o activate/wake up sleeping objects)
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;
btVector3 m_angularFactor;
btVector3 m_linearFactor; btVector3 m_linearFactor;
btVector3 m_gravity; btVector3 m_gravity;
btVector3 m_gravity_acceleration; 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;
skipping to change at line 73 skipping to change at line 85
btScalar m_linearSleepingThreshold; btScalar m_linearSleepingThreshold;
btScalar m_angularSleepingThreshold; btScalar m_angularSleepingThreshold;
//m_optionalMotionState allows to automatic synchronize the world tr ansform for active objects //m_optionalMotionState allows to automatic synchronize the world tr ansform for active objects
btMotionState* m_optionalMotionState; btMotionState* m_optionalMotionState;
//keep track of typed constraints referencing this rigid body //keep track of typed constraints referencing this rigid body
btAlignedObjectArray<btTypedConstraint*> m_constraintRefs; btAlignedObjectArray<btTypedConstraint*> m_constraintRefs;
int m_rigidbodyFlags;
int m_debugBodyId;
protected:
ATTRIBUTE_ALIGNED64(btVector3 m_deltaLinearVelocity);
btVector3 m_deltaAngularVelocity;
btVector3 m_angularFactor;
btVector3 m_invMass;
btVector3 m_pushVelocity;
btVector3 m_turnVelocity;
public: public:
///The btRigidBodyConstructionInfo structure provides information to create a rigid body. Setting mass to zero creates a fixed (non-dynamic) ri gid body. ///The btRigidBodyConstructionInfo structure provides information to create a rigid body. Setting mass to zero creates a fixed (non-dynamic) ri gid body.
///For dynamic objects, you can use the collision shape to approxima te the local inertia tensor, otherwise use the zero vector (default argumen t) ///For dynamic objects, you can use the collision shape to approxima te the local inertia tensor, otherwise use the zero vector (default argumen t)
///You can use the motion state to synchronize the world transform b etween physics and graphics objects. ///You can use the motion state to synchronize the world transform b etween physics and graphics objects.
///And if the motion state is provided, the rigid body will initiali ze its initial world transform from the motion state, ///And if the motion state is provided, the rigid body will initiali ze its initial world transform from the motion state,
///m_startWorldTransform is only used when you don't provide a motio n state. ///m_startWorldTransform is only used when you don't provide a motio n state.
struct btRigidBodyConstructionInfo struct btRigidBodyConstructionInfo
{ {
btScalar m_mass; btScalar m_mass;
skipping to change at line 224 skipping to change at line 249
void setMassProps(btScalar mass, const btVector3& inertia); void setMassProps(btScalar mass, const btVector3& inertia);
const btVector3& getLinearFactor() const const btVector3& getLinearFactor() const
{ {
return m_linearFactor; return m_linearFactor;
} }
void setLinearFactor(const btVector3& linearFactor) void setLinearFactor(const btVector3& linearFactor)
{ {
m_linearFactor = linearFactor; m_linearFactor = linearFactor;
m_invMass = m_linearFactor*m_inverseMass;
} }
btScalar getInvMass() const { return m_inverseMass; } btScalar getInvMass() const { return m_inverseMass; }
const btMatrix3x3& getInvInertiaTensorWorld() const { const btMatrix3x3& getInvInertiaTensorWorld() const {
return m_invInertiaTensorWorld; return m_invInertiaTensorWorld;
} }
void integrateVelocities(btScalar step); void integrateVelocities(btScalar step);
void setCenterOfMassTransform(const btTransform& xform); void setCenterOfMassTransform(const btTransform& xform);
skipping to change at line 298 skipping to change at line 324
if (m_inverseMass != btScalar(0.)) if (m_inverseMass != btScalar(0.))
{ {
applyCentralImpulse(impulse); applyCentralImpulse(impulse);
if (m_angularFactor) if (m_angularFactor)
{ {
applyTorqueImpulse(rel_pos.cross(impulse*m_l inearFactor)); applyTorqueImpulse(rel_pos.cross(impulse*m_l inearFactor));
} }
} }
} }
//Optimization for the iterative solver: avoid calculating constant
terms involving inertia, normal, relative position
SIMD_FORCE_INLINE void internalApplyImpulse(const btVector3& linearC
omponent, const btVector3& angularComponent,btScalar impulseMagnitude)
{
if (m_inverseMass != btScalar(0.))
{
m_linearVelocity += linearComponent*m_linearFactor*i
mpulseMagnitude;
if (m_angularFactor)
{
m_angularVelocity += angularComponent*m_angu
larFactor*impulseMagnitude;
}
}
}
void clearForces() void clearForces()
{ {
m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar (0.0)); m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar (0.0));
m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScala r(0.0)); m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScala r(0.0));
} }
void updateInertiaTensor(); void updateInertiaTensor();
const btVector3& getCenterOfMassPosition() const { const btVector3& getCenterOfMassPosition() const {
return m_worldTransform.getOrigin(); return m_worldTransform.getOrigin();
skipping to change at line 483 skipping to change at line 496
btTypedConstraint* getConstraintRef(int index) btTypedConstraint* getConstraintRef(int index)
{ {
return m_constraintRefs[index]; return m_constraintRefs[index];
} }
int getNumConstraintRefs() int getNumConstraintRefs()
{ {
return m_constraintRefs.size(); return m_constraintRefs.size();
} }
int m_debugBodyId; void setFlags(int flags)
{
m_rigidbodyFlags = flags;
}
int getFlags() const
{
return m_rigidbodyFlags;
}
////////////////////////////////////////////////
///some internal methods, don't use them
btVector3& internalGetDeltaLinearVelocity()
{
return m_deltaLinearVelocity;
}
btVector3& internalGetDeltaAngularVelocity()
{
return m_deltaAngularVelocity;
}
const btVector3& internalGetAngularFactor() const
{
return m_angularFactor;
}
const btVector3& internalGetInvMass() const
{
return m_invMass;
}
btVector3& internalGetPushVelocity()
{
return m_pushVelocity;
}
btVector3& internalGetTurnVelocity()
{
return m_turnVelocity;
}
SIMD_FORCE_INLINE void internalGetVelocityInLocalPointObsolete(cons
t btVector3& rel_pos, btVector3& velocity ) const
{
velocity = getLinearVelocity()+m_deltaLinearVelocity + (getA
ngularVelocity()+m_deltaAngularVelocity).cross(rel_pos);
}
SIMD_FORCE_INLINE void internalGetAngularVelocity(btVector3& angVel
) const
{
angVel = getAngularVelocity()+m_deltaAngularVelocity;
}
//Optimization for the iterative solver: avoid calculating constant
terms involving inertia, normal, relative position
SIMD_FORCE_INLINE void internalApplyImpulse(const btVector3& linearC
omponent, const btVector3& angularComponent,const btScalar impulseMagnitude
)
{
if (m_inverseMass)
{
m_deltaLinearVelocity += linearComponent*impulseMagn
itude;
m_deltaAngularVelocity += angularComponent*(impulseM
agnitude*m_angularFactor);
}
}
SIMD_FORCE_INLINE void internalApplyPushImpulse(const btVector3& lin
earComponent, const btVector3& angularComponent,btScalar impulseMagnitude)
{
if (m_inverseMass)
{
m_pushVelocity += linearComponent*impulseMagnitude;
m_turnVelocity += angularComponent*(impulseMagnitude
*m_angularFactor);
}
}
void internalWritebackVelocity()
{
if (m_inverseMass)
{
setLinearVelocity(getLinearVelocity()+ m_deltaLinear
Velocity);
setAngularVelocity(getAngularVelocity()+m_deltaAngul
arVelocity);
m_deltaLinearVelocity.setZero();
m_deltaAngularVelocity .setZero();
//m_originalBody->setCompanionId(-1);
}
}
void internalWritebackVelocity(btScalar timeStep);
///////////////////////////////////////////////
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, class btSeriali
zer* serializer) const;
virtual void serializeSingleObject(class btSerializer* serializer) c
onst;
};
//@todo add m_optionalMotionState and m_constraintRefs to btRigidBodyData
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btRigidBodyFloatData
{
btCollisionObjectFloatData m_collisionObjectData;
btMatrix3x3FloatData m_invInertiaTensorWorld;
btVector3FloatData m_linearVelocity;
btVector3FloatData m_angularVelocity;
btVector3FloatData m_angularFactor;
btVector3FloatData m_linearFactor;
btVector3FloatData m_gravity;
btVector3FloatData m_gravity_acceleration;
btVector3FloatData m_invInertiaLocal;
btVector3FloatData m_totalForce;
btVector3FloatData m_totalTorque;
float m_inverseMass;
float m_linearDamping;
float m_angularDamping;
float m_additionalDampingFactor;
float m_additionalLinearDampingThr
esholdSqr;
float m_additionalAngularDampingTh
resholdSqr;
float m_additionalAngularDampingFa
ctor;
float m_linearSleepingThreshold;
float m_angularSleepingThreshold;
int m_additionalDamping;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btRigidBodyDoubleData
{
btCollisionObjectDoubleData m_collisionObjectData;
btMatrix3x3DoubleData m_invInertiaTensorWorld;
btVector3DoubleData m_linearVelocity;
btVector3DoubleData m_angularVelocity;
btVector3DoubleData m_angularFactor;
btVector3DoubleData m_linearFactor;
btVector3DoubleData m_gravity;
btVector3DoubleData m_gravity_acceleration;
btVector3DoubleData m_invInertiaLocal;
btVector3DoubleData m_totalForce;
btVector3DoubleData m_totalTorque;
double m_inverseMass;
double m_linearDamping;
double m_angularDamping;
double m_additionalDampingFactor;
double m_additionalLinearDampingThr
esholdSqr;
double m_additionalAngularDampingTh
resholdSqr;
double m_additionalAngularDampingFa
ctor;
double m_linearSleepingThreshold;
double m_angularSleepingThreshold;
int m_additionalDamping;
char m_padding[4];
}; };
#endif #endif
 End of changes. 6 change blocks. 
19 lines changed or deleted 199 lines changed or added


 btScalar.h   btScalar.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___SCALAR_H #ifndef SIMD___SCALAR_H
#define SIMD___SCALAR_H #define SIMD___SCALAR_H
#ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code
#pragma unmanaged
#endif
#include <math.h> #include <math.h>
#include <stdlib.h>//size_t for MSVC 6.0 #include <stdlib.h>//size_t for MSVC 6.0
#include <cstdlib> #include <cstdlib>
#include <cfloat> #include <cfloat>
#include <float.h> #include <float.h>
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/ /* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
#define BT_BULLET_VERSION 275 #define BT_BULLET_VERSION 276
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_ALIGNED64(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_ALIGNED64(a) __declspec(align(64)) 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)) #if (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_U SE_DOUBLE_PRECISION))
#define BT_USE_SSE #define BT_USE_SSE
#include <emmintrin.h> #include <emmintrin.h>
#endif #endif
#endif//_XBOX #endif//_XBOX
#endif //__MINGW32__ #endif //__MINGW32__
#include <assert.h> #include <assert.h>
#ifdef BT_DEBUG #ifdef BT_DEBUG
skipping to change at line 87 skipping to change at line 94
#define btFullAssert(x) #define btFullAssert(x)
#define btLikely(_c) _c #define btLikely(_c) _c
#define btUnlikely(_c) _c #define btUnlikely(_c) _c
#else #else
#if defined (__CELLOS_LV2__) #if defined (__CELLOS_LV2__)
#define SIMD_FORCE_INLINE inline #define SIMD_FORCE_INLINE inline
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16 ))) #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16 )))
#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64 )))
#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (1 28))) #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (1 28)))
#ifndef assert #ifndef assert
#include <assert.h> #include <assert.h>
#endif #endif
#ifdef BT_DEBUG #ifdef BT_DEBUG
#define btAssert assert #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
skipping to change at line 108 skipping to change at line 116
#define btLikely(_c) _c #define btLikely(_c) _c
#define btUnlikely(_c) _c #define btUnlikely(_c) _c
#else #else
#ifdef USE_LIBSPE2 #ifdef USE_LIBSPE2
#define SIMD_FORCE_INLINE __inline #define SIMD_FORCE_INLINE __inline
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16 ))) #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16 )))
#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64 )))
#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (1 28))) #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (1 28)))
#ifndef assert #ifndef assert
#include <assert.h> #include <assert.h>
#endif #endif
#ifdef BT_DEBUG #ifdef BT_DEBUG
#define btAssert assert #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
skipping to change at line 133 skipping to change at line 142
#else #else
//non-windows systems //non-windows systems
#if (defined (__APPLE__) && defined (__i386__) && (!defined (BT_USE_DOUBLE_ PRECISION))) #if (defined (__APPLE__) && defined (__i386__) && (!defined (BT_USE_DOUBLE_ PRECISION)))
#define BT_USE_SSE #define BT_USE_SSE
#include <emmintrin.h> #include <emmintrin.h>
#define SIMD_FORCE_INLINE inline #define SIMD_FORCE_INLINE inline
///@todo: check out alignment methods for other platforms/compilers ///@todo: check out alignment methods for other platforms/compilers
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64)))
#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
#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)
#endif #endif
skipping to change at line 154 skipping to change at line 164
//btFullAssert is optional, slows down a lot //btFullAssert is optional, slows down a lot
#define btFullAssert(x) #define btFullAssert(x)
#define btLikely(_c) _c #define btLikely(_c) _c
#define btUnlikely(_c) _c #define btUnlikely(_c) _c
#else #else
#define SIMD_FORCE_INLINE inline #define SIMD_FORCE_INLINE inline
///@todo: check out alignment methods for other platforms/co mpilers ///@todo: check out alignment methods for other platforms/co mpilers
///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) ///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
///#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64)))
///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) ///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
#define ATTRIBUTE_ALIGNED16(a) a #define ATTRIBUTE_ALIGNED16(a) a
#define ATTRIBUTE_ALIGNED64(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)
#endif #endif
skipping to change at line 206 skipping to change at line 218
SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr ; } \ SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr ; } \
SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \ SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \
#if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS) #if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS)
SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrt(x); } SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrt(x); }
SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); } SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); }
SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); } SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); }
SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); } SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); }
SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); } SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); }
SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { return acos(x); } SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { if (x<btScalar(-1)) x=bt
SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { return asin(x); } Scalar(-1); if (x>btScalar(1)) x=btScalar(1); return acos(x); }
SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { if (x<btScalar(-1)) x=bt
Scalar(-1); if (x>btScalar(1)) x=btScalar(1); return asin(x); }
SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); } SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); }
SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x , y); } SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x , y); }
SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); } SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); }
SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); } SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); }
SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); } SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); }
SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmod(x,y) ; } SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmod(x,y) ; }
#else #else
SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
skipping to change at line 242 skipping to change at line 254
return x*y; return x*y;
#else #else
return sqrtf(y); return sqrtf(y);
#endif #endif
} }
SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); } SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); }
SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); }
SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); }
SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); }
SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { SIMD_FORCE_INLINE btScalar btAcos(btScalar x) {
btAssert(x <= btScalar(1.)); if (x<btScalar(-1))
x=btScalar(-1);
if (x>btScalar(1))
x=btScalar(1);
return acosf(x); return acosf(x);
} }
SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { return asinf(x); } SIMD_FORCE_INLINE btScalar btAsin(btScalar x) {
if (x<btScalar(-1))
x=btScalar(-1);
if (x>btScalar(1))
x=btScalar(1);
return asinf(x);
}
SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); }
SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f( x, y); } SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f( x, y); }
SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); } SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); }
SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); } SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); }
SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); } SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y ); } SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y ); }
#endif #endif
#define SIMD_2_PI btScalar(6.283185307179586232) #define SIMD_2_PI btScalar(6.283185307179586232)
 End of changes. 14 change blocks. 
7 lines changed or deleted 30 lines changed or added


 btSequentialImpulseConstraintSolver.h   btSequentialImpulseConstraintSolver.h 
skipping to change at line 32 skipping to change at line 32
#include "btSolverBody.h" #include "btSolverBody.h"
#include "btSolverConstraint.h" #include "btSolverConstraint.h"
#include "btTypedConstraint.h" #include "btTypedConstraint.h"
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h" #include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
///The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (iterative LCP) method. ///The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (iterative LCP) method.
class btSequentialImpulseConstraintSolver : public btConstraintSolver class btSequentialImpulseConstraintSolver : public btConstraintSolver
{ {
protected: protected:
btAlignedObjectArray<btSolverBody> m_tmpSolverBodyPool;
btConstraintArray m_tmpSolverContactConstraint Pool; btConstraintArray m_tmpSolverContactConstraint Pool;
btConstraintArray m_tmpSolverNonContactConstra intPool; btConstraintArray m_tmpSolverNonContactConstra intPool;
btConstraintArray m_tmpSolverContactFrictionCo nstraintPool; btConstraintArray m_tmpSolverContactFrictionCo nstraintPool;
btAlignedObjectArray<int> m_orderTmpConstraintPool; btAlignedObjectArray<int> m_orderTmpConstraintPool;
btAlignedObjectArray<int> m_orderFrictionConstraintPool; btAlignedObjectArray<int> m_orderFrictionConstraintPool;
btAlignedObjectArray<btTypedConstraint::btConstraintInfo1> m_tmpCons traintSizesPool; btAlignedObjectArray<btTypedConstraint::btConstraintInfo1> m_tmpCons traintSizesPool;
btSolverConstraint& addFrictionConstraint(const btVector3& norma void setupFrictionConstraint( btSolverConstraint& solverConstraint
lAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint , const btVector3& normalAxis,btRigidBody* solverBodyA,btRigidBody* solverB
& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* odyIdB,
colObj0,btCollisionObject* colObj1, btScalar relaxation); btMa
nifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,
btCo
llisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation,
btSc
alar desiredVelocity=0., btScalar cfmSlip=0.);
btSolverConstraint& addFrictionConstraint(const btVector3& norma
lAxis,btRigidBody* solverBodyA,btRigidBody* solverBodyB,int frictionIndex,b
tManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCo
llisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btS
calar desiredVelocity=0., btScalar cfmSlip=0.);
void setupContactConstraint(btSolverConstraint& solverConstraint, bt
CollisionObject* colObj0, btCollisionObject* colObj1, btManifoldPoint& cp,
const btCont
actSolverInfo& infoGlobal, btVector3& vel, btScalar& rel_vel, btScalar& rel
axation,
btVector3& r
el_pos1, btVector3& rel_pos2);
void setFrictionConstraintImpulse( btSolverConstraint& solverConstra
int, btRigidBody* rb0, btRigidBody* rb1,
btManifoldPoint& cp, const btContactSolverInfo& infoGlobal);
///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;
void initSolverBody(btSolverBody* solverBody, btCollisionObject* collisionObject); // void initSolverBody(btSolverBody* solverBody, btCollisionObject* collisionObject);
btScalar restitutionCurve(btScalar rel_vel, btScalar restitution); btScalar restitutionCurve(btScalar rel_vel, btScalar restitution);
void convertContact(btPersistentManifold* manifold,const btContac tSolverInfo& infoGlobal); void convertContact(btPersistentManifold* manifold,const btContac tSolverInfo& infoGlobal);
void resolveSplitPenetrationSIMD( void resolveSplitPenetrationSIMD(
btSolverBody& body1, btRigidBody& body1,
btSolverBody& body2, btRigidBody& body2,
const btSolverConstraint& contactConstraint); const btSolverConstraint& contactConstraint);
void resolveSplitPenetrationImpulseCacheFriendly( void resolveSplitPenetrationImpulseCacheFriendly(
btSolverBody& body1, btRigidBody& body1,
btSolverBody& body2, btRigidBody& body2,
const btSolverConstraint& contactConstraint); const btSolverConstraint& contactConstraint);
//internal method //internal method
int getOrInitSolverBody(btCollisionObject& body); int getOrInitSolverBody(btCollisionObject& body);
void resolveSingleConstraintRowGeneric(btSolverBody& body1,btSolv erBody& body2,const btSolverConstraint& contactConstraint); void resolveSingleConstraintRowGeneric(btRigidBody& body1,btRigid Body& body2,const btSolverConstraint& contactConstraint);
void resolveSingleConstraintRowGenericSIMD(btSolverBody& body1,bt SolverBody& body2,const btSolverConstraint& contactConstraint); void resolveSingleConstraintRowGenericSIMD(btRigidBody& body1,btR igidBody& body2,const btSolverConstraint& contactConstraint);
void resolveSingleConstraintRowLowerLimit(btSolverBody& body1,btS olverBody& body2,const btSolverConstraint& contactConstraint); void resolveSingleConstraintRowLowerLimit(btRigidBody& body1,btRi gidBody& body2,const btSolverConstraint& contactConstraint);
void resolveSingleConstraintRowLowerLimitSIMD(btSolverBody& body1 void resolveSingleConstraintRowLowerLimitSIMD(btRigidBody& body1,
,btSolverBody& body2,const btSolverConstraint& contactConstraint); btRigidBody& body2,const btSolverConstraint& contactConstraint);
protected:
static btRigidBody& getFixedBody()
{
static btRigidBody s_fixed(0, 0,0);
s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btS
calar(0.),btScalar(0.)));
return s_fixed;
}
virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisi
onObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int num
Manifolds,btTypedConstraint** constraints,int numConstraints,const btContac
tSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc)
;
virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** b
odies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,b
tTypedConstraint** constraints,int numConstraints,const btContactSolverInfo
& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
btScalar solveSingleIteration(int iteration, btCollisionObject** bod
ies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btT
ypedConstraint** constraints,int numConstraints,const btContactSolverInfo&
infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bo
dies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btT
ypedConstraint** constraints,int numConstraints,const btContactSolverInfo&
infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject
** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifold
s,btTypedConstraint** constraints,int numConstraints,const btContactSolverI
nfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
public: public:
btSequentialImpulseConstraintSolver(); 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);
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();
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;
 End of changes. 10 change blocks. 
24 lines changed or deleted 69 lines changed or added


 btShapeHull.h   btShapeHull.h 
skipping to change at line 29 skipping to change at line 29
#define _SHAPE_HULL_H #define _SHAPE_HULL_H
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h" #include "BulletCollision/CollisionShapes/btConvexShape.h"
///The btShapeHull class takes a btConvexShape, builds a simplified convex hull using btConvexHull and provides triangle indices and vertices. ///The btShapeHull class takes a btConvexShape, builds a simplified convex hull using btConvexHull and provides triangle indices and vertices.
///It can be useful for to simplify a complex convex object and for visuali zation of a non-polyhedral convex object. ///It can be useful for to simplify a complex convex object and for visuali zation of a non-polyhedral convex object.
///It approximates the convex hull using the supporting vertex of 42 direct ions. ///It approximates the convex hull using the supporting vertex of 42 direct ions.
class btShapeHull class btShapeHull
{ {
protected:
btAlignedObjectArray<btVector3> m_vertices;
btAlignedObjectArray<unsigned int> m_indices;
unsigned int m_numIndices;
const btConvexShape* m_shape;
static btVector3* getUnitSpherePoints();
public: public:
btShapeHull (const btConvexShape* shape); btShapeHull (const btConvexShape* shape);
~btShapeHull (); ~btShapeHull ();
bool buildHull (btScalar margin); bool buildHull (btScalar margin);
int numTriangles () const; int numTriangles () const;
int numVertices () const; int numVertices () const;
int numIndices () const; int numIndices () const;
const btVector3* getVertexPointer() const const btVector3* getVertexPointer() const
{ {
return &m_vertices[0]; return &m_vertices[0];
} }
const unsigned int* getIndexPointer() const const unsigned int* getIndexPointer() const
{ {
return &m_indices[0]; return &m_indices[0];
} }
protected:
btAlignedObjectArray<btVector3> m_vertices;
btAlignedObjectArray<unsigned int> m_indices;
unsigned int m_numIndices;
const btConvexShape* m_shape;
}; };
#endif //_SHAPE_HULL_H #endif //_SHAPE_HULL_H
 End of changes. 2 change blocks. 
6 lines changed or deleted 9 lines changed or added


 btSimpleBroadphase.h   btSimpleBroadphase.h 
skipping to change at line 124 skipping to change at line 124
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 calculateOverlappingPairs(btDispatcher* dispatcher); virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
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, btVector3& aabbMax ) const; virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& 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));
virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback);
btOverlappingPairCache* getOverlappingPairCache() btOverlappingPairCache* getOverlappingPairCache()
{ {
return m_pairCache; return m_pairCache;
} }
const btOverlappingPairCache* getOverlappingPairCache() const const btOverlappingPairCache* getOverlappingPairCache() const
{ {
return m_pairCache; return m_pairCache;
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 btSliderConstraint.h   btSliderConstraint.h 
skipping to change at line 37 skipping to change at line 37
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "btJacobianEntry.h" #include "btJacobianEntry.h"
#include "btTypedConstraint.h" #include "btTypedConstraint.h"
class btRigidBody; class btRigidBody;
#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))
#define SLIDER_CONSTRAINT_DEF_CFM (btScalar(0.f))
enum btSliderFlags
{
BT_SLIDER_FLAGS_CFM_DIRLIN = (1 << 0),
BT_SLIDER_FLAGS_ERP_DIRLIN = (1 << 1),
BT_SLIDER_FLAGS_CFM_DIRANG = (1 << 2),
BT_SLIDER_FLAGS_ERP_DIRANG = (1 << 3),
BT_SLIDER_FLAGS_CFM_ORTLIN = (1 << 4),
BT_SLIDER_FLAGS_ERP_ORTLIN = (1 << 5),
BT_SLIDER_FLAGS_CFM_ORTANG = (1 << 6),
BT_SLIDER_FLAGS_ERP_ORTANG = (1 << 7),
BT_SLIDER_FLAGS_CFM_LIMLIN = (1 << 8),
BT_SLIDER_FLAGS_ERP_LIMLIN = (1 << 9),
BT_SLIDER_FLAGS_CFM_LIMANG = (1 << 10),
BT_SLIDER_FLAGS_ERP_LIMANG = (1 << 11)
};
class btSliderConstraint : public btTypedConstraint class btSliderConstraint : public btTypedConstraint
{ {
protected: protected:
///for backwards compatibility during the transition to 'getInfo/get Info2' ///for backwards compatibility during the transition to 'getInfo/get Info2'
bool m_useSolveConstraintObsolete; bool m_useSolveConstraintObsolete;
bool m_useOffsetForConstraintFrame;
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;
// softness, restitution and damping for different cases // softness, restitution and damping for different cases
// DirLin - moving inside linear limits // DirLin - moving inside linear limits
// LimLin - hitting linear limit // LimLin - hitting linear limit
// DirAng - moving inside angular limits // DirAng - moving inside angular limits
// LimAng - hitting angular limit // LimAng - hitting angular limit
// OrthoLin, OrthoAng - against constraint axis // OrthoLin, OrthoAng - against constraint axis
btScalar m_softnessDirLin; btScalar m_softnessDirLin;
btScalar m_restitutionDirLin; btScalar m_restitutionDirLin;
btScalar m_dampingDirLin; btScalar m_dampingDirLin;
btScalar m_cfmDirLin;
btScalar m_softnessDirAng; btScalar m_softnessDirAng;
btScalar m_restitutionDirAng; btScalar m_restitutionDirAng;
btScalar m_dampingDirAng; btScalar m_dampingDirAng;
btScalar m_cfmDirAng;
btScalar m_softnessLimLin; btScalar m_softnessLimLin;
btScalar m_restitutionLimLin; btScalar m_restitutionLimLin;
btScalar m_dampingLimLin; btScalar m_dampingLimLin;
btScalar m_cfmLimLin;
btScalar m_softnessLimAng; btScalar m_softnessLimAng;
btScalar m_restitutionLimAng; btScalar m_restitutionLimAng;
btScalar m_dampingLimAng; btScalar m_dampingLimAng;
btScalar m_cfmLimAng;
btScalar m_softnessOrthoLin; btScalar m_softnessOrthoLin;
btScalar m_restitutionOrthoLin; btScalar m_restitutionOrthoLin;
btScalar m_dampingOrthoLin; btScalar m_dampingOrthoLin;
btScalar m_cfmOrthoLin;
btScalar m_softnessOrthoAng; btScalar m_softnessOrthoAng;
btScalar m_restitutionOrthoAng; btScalar m_restitutionOrthoAng;
btScalar m_dampingOrthoAng; btScalar m_dampingOrthoAng;
btScalar m_cfmOrthoAng;
// for interlal use // for interlal use
bool m_solveLinLim; bool m_solveLinLim;
bool m_solveAngLim; bool m_solveAngLim;
int m_flags;
btJacobianEntry m_jacLin[3]; btJacobianEntry m_jacLin[3];
btScalar m_jacLinDiagABInv[3]; btScalar m_jacLinDiagABInv[3];
btJacobianEntry m_jacAng[3]; btJacobianEntry m_jacAng[3];
btScalar m_timeStep; btScalar m_timeStep;
btTransform m_calculatedTransformA; btTransform m_calculatedTransformA;
btTransform m_calculatedTransformB; btTransform m_calculatedTransformB;
btVector3 m_sliderAxis; btVector3 m_sliderAxis;
skipping to change at line 121 skipping to change at line 152
bool m_poweredAngMotor; bool m_poweredAngMotor;
btScalar m_targetAngMotorVelocity; btScalar m_targetAngMotorVelocity;
btScalar m_maxAngMotorForce; btScalar m_maxAngMotorForce;
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(btRigidBody& rbB, const btTransform& frameInB, bool btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool
useLinearReferenceFrameB); useLinearReferenceFrameA);
btSliderConstraint();
// overrides // overrides
virtual void buildJacobian();
virtual void getInfo1 (btConstraintInfo1* info); virtual void getInfo1 (btConstraintInfo1* info);
void getInfo1NonVirtual(btConstraintInfo1* info); void getInfo1NonVirtual(btConstraintInfo1* info);
virtual void getInfo2 (btConstraintInfo2* info); virtual void getInfo2 (btConstraintInfo2* info);
void getInfo2NonVirtual(btConstraintInfo2* info, const btTransform& transA, const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB, btScalar rbAinvMass,btScalar rbBinvMass); void getInfo2NonVirtual(btConstraintInfo2* info, const btTransform& transA, const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB, btScalar rbAinvMass,btScalar rbBinvMass);
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 208 skipping to change at line 237
btScalar getTargetAngMotorVelocity() { return m_targetAngMotorVeloci ty; } btScalar getTargetAngMotorVelocity() { return m_targetAngMotorVeloci ty; }
void setMaxAngMotorForce(btScalar maxAngMotorForce) { m_maxAngMotorF orce = maxAngMotorForce; } void setMaxAngMotorForce(btScalar maxAngMotorForce) { m_maxAngMotorF orce = maxAngMotorForce; }
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
void buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const b
tTransform& frameInA, const btTransform& frameInB);
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(const btTransform& transA,const btTransf orm& transB); void calculateTransforms(const btTransform& transA,const btTransf orm& transB);
void testLinLimits(); void testLinLimits();
void testLinLimits2(btConstraintInfo2* info);
void testAngLimits(); void testAngLimits();
// access for PE Solver // access for PE Solver
btVector3 getAncorInA(); btVector3 getAncorInA();
btVector3 getAncorInB(); btVector3 getAncorInB();
// access for UseFrameOffset
bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; }
///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constra
int.
virtual void setParam(int num, btScalar value, int axis = -1);
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const;
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btSliderConstraintData
{
btTypedConstraintData m_typeConstraintData;
btTransformFloatData m_rbAFrame; // constraint axii. Assumes z is hi
nge axis.
btTransformFloatData m_rbBFrame;
float m_linearUpperLimit;
float m_linearLowerLimit;
float m_angularUpperLimit;
float m_angularLowerLimit;
int m_useLinearReferenceFrameA;
int m_useOffsetForConstraintFrame;
}; };
SIMD_FORCE_INLINE int btSliderConstraint::calculateSeriali
zeBufferSize() const
{
return sizeof(btSliderConstraintData);
}
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
SIMD_FORCE_INLINE const char* btSliderConstraint::serialize(void*
dataBuffer, btSerializer* serializer) const
{
btSliderConstraintData* sliderData = (btSliderConstraintData*) dataB
uffer;
btTypedConstraint::serialize(&sliderData->m_typeConstraintData,seria
lizer);
m_frameInA.serializeFloat(sliderData->m_rbAFrame);
m_frameInB.serializeFloat(sliderData->m_rbBFrame);
sliderData->m_linearUpperLimit = float(m_upperLinLimit);
sliderData->m_linearLowerLimit = float(m_lowerLinLimit);
sliderData->m_angularUpperLimit = float(m_upperAngLimit);
sliderData->m_angularLowerLimit = float(m_lowerAngLimit);
sliderData->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA;
sliderData->m_useOffsetForConstraintFrame = m_useOffsetForConstraint
Frame;
return "btSliderConstraintData";
}
#endif //SLIDER_CONSTRAINT_H #endif //SLIDER_CONSTRAINT_H
 End of changes. 16 change blocks. 
13 lines changed or deleted 108 lines changed or added


 btSoftBodyHelpers.h   btSoftBodyHelpers.h 
skipping to change at line 112 skipping to change at line 112
static float CalculateUV(int resx,int resy,int ix,int iy,int id); static float CalculateUV(int resx,int resy,int ix,int iy,int id);
/* Create an ellipsoid */ /* Create an ellipsoid */
static btSoftBody* CreateEllipsoid(btSoftBodyWorldInfo& worldInfo, static btSoftBody* CreateEllipsoid(btSoftBodyWorldInfo& worldInfo,
const btVector3& center, const btVector3& center,
const btVector3& radius, const btVector3& radius,
int res); int res);
/* Create from trimesh */ /* Create from trimesh */
static btSoftBody* CreateFromTriMesh( btSoftBodyWo rldInfo& worldInfo, static btSoftBody* CreateFromTriMesh( btSoftBodyWo rldInfo& worldInfo,
const btScalar* vertices, const btScalar* vertices,
const int* triangles, const int* triangles,
int ntriangles); int ntriangles,
bool randomizeConstraints = true);
/* Create from convex-hull */ /* Create from convex-hull */
static btSoftBody* CreateFromConvexHull( btSoftBodyWo rldInfo& worldInfo, static btSoftBody* CreateFromConvexHull( btSoftBodyWo rldInfo& worldInfo,
const btVector3* vertices, const btVector3* vertices,
int nvertices); int nvertices,
bool randomizeConstraints = true);
/* Export TetGen compatible .smesh file */ /* Export TetGen compatible .smesh file */
static void ExportAsSMeshFile( btSo ftBody* psb, static void ExportAsSMeshFile( btSo ftBody* psb,
const char* filename); const char* filename);
/* Create from TetGen .ele, .face, .node files */ /* Create from TetGen .ele, .face, .node files */
static btSoftBody* CreateFromTetGenFile( btSoftBodyWo rldInfo& worldInfo, static btSoftBody* CreateFromTetGenFile( btSoftBodyWo rldInfo& worldInfo,
const char* ele, const char* ele,
const char* face, const char* face,
const char* node, const char* node,
bool bfacelinks, bool bfacelinks,
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 btSoftRigidDynamicsWorld.h   btSoftRigidDynamicsWorld.h 
skipping to change at line 81 skipping to change at line 81
btSoftBodyArray& getSoftBodyArray() btSoftBodyArray& getSoftBodyArray()
{ {
return m_softBodies; return m_softBodies;
} }
const btSoftBodyArray& getSoftBodyArray() const const btSoftBodyArray& getSoftBodyArray() const
{ {
return m_softBodies; return m_softBodies;
} }
virtual void rayTest(const btVector3& rayFromWorld, const btVector3&
rayToWorld, RayResultCallback& resultCallback) const;
/// rayTestSingle performs a raycast call and calls the resultCallba
ck. It is used internally by rayTest.
/// In a future implementation, we consider moving the ray test as a
virtual method in btCollisionShape.
/// This allows more customization.
static void rayTestSingle(const btTransform& rayFromTrans,const
btTransform& rayToTrans,
btCollisionObject* collisionObject
,
const btCollisionShape* collisionS
hape,
const btTransform& colObjWorldTran
sform,
RayResultCallback& resultCallback)
;
}; };
#endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H #endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 btSolverBody.h   btSolverBody.h 
skipping to change at line 106 skipping to change at line 106
operator+(const btSimdScalar& v1, const btSimdScalar& v2) operator+(const btSimdScalar& v1, const btSimdScalar& v2)
{ {
return btSimdScalar(_mm_add_ps(v1.get128(),v2.get128())); return btSimdScalar(_mm_add_ps(v1.get128(),v2.get128()));
} }
#else #else
#define btSimdScalar btScalar #define btSimdScalar btScalar
#endif #endif
///The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packed to increase cache coherence/performance. ///The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packed to increase cache coherence/performance.
ATTRIBUTE_ALIGNED16 (struct) btSolverBody ATTRIBUTE_ALIGNED64 (struct) btSolverBodyObsolete
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
btVector3 m_deltaLinearVelocity; btVector3 m_deltaLinearVelocity;
btVector3 m_deltaAngularVelocity; btVector3 m_deltaAngularVelocity;
btVector3 m_angularFactor; btVector3 m_angularFactor;
btVector3 m_invMass; btVector3 m_invMass;
btScalar m_friction;
btRigidBody* m_originalBody; btRigidBody* m_originalBody;
btVector3 m_pushVelocity; btVector3 m_pushVelocity;
btVector3 m_turnVelocity; btVector3 m_turnVelocity;
SIMD_FORCE_INLINE void getVelocityInLocalPointObsolete(const btVect or3& rel_pos, btVector3& velocity ) const SIMD_FORCE_INLINE void getVelocityInLocalPointObsolete(const btVect or3& rel_pos, btVector3& velocity ) const
{ {
if (m_originalBody) if (m_originalBody)
velocity = m_originalBody->getLinearVelocity()+m_del taLinearVelocity + (m_originalBody->getAngularVelocity()+m_deltaAngularVelo city).cross(rel_pos); velocity = m_originalBody->getLinearVelocity()+m_del taLinearVelocity + (m_originalBody->getAngularVelocity()+m_deltaAngularVelo city).cross(rel_pos);
else else
velocity.setValue(0,0,0); velocity.setValue(0,0,0);
skipping to change at line 166 skipping to change at line 165
{ {
m_originalBody->setLinearVelocity(m_originalBody->ge tLinearVelocity()+ m_deltaLinearVelocity); m_originalBody->setLinearVelocity(m_originalBody->ge tLinearVelocity()+ m_deltaLinearVelocity);
m_originalBody->setAngularVelocity(m_originalBody->g etAngularVelocity()+m_deltaAngularVelocity); m_originalBody->setAngularVelocity(m_originalBody->g etAngularVelocity()+m_deltaAngularVelocity);
//m_originalBody->setCompanionId(-1); //m_originalBody->setCompanionId(-1);
} }
} }
void writebackVelocity(btScalar timeStep) void writebackVelocity(btScalar timeStep)
{ {
(void) timeStep;
if (m_originalBody) if (m_originalBody)
{ {
m_originalBody->setLinearVelocity(m_originalBody->ge tLinearVelocity()+ m_deltaLinearVelocity); m_originalBody->setLinearVelocity(m_originalBody->ge tLinearVelocity()+ m_deltaLinearVelocity);
m_originalBody->setAngularVelocity(m_originalBody->g etAngularVelocity()+m_deltaAngularVelocity); m_originalBody->setAngularVelocity(m_originalBody->g etAngularVelocity()+m_deltaAngularVelocity);
//correct the position/orientation based on push/tur n recovery //correct the position/orientation based on push/tur n recovery
btTransform newTransform; btTransform newTransform;
btTransformUtil::integrateTransform(m_originalBody-> getWorldTransform(),m_pushVelocity,m_turnVelocity,timeStep,newTransform); btTransformUtil::integrateTransform(m_originalBody-> getWorldTransform(),m_pushVelocity,m_turnVelocity,timeStep,newTransform);
m_originalBody->setWorldTransform(newTransform); m_originalBody->setWorldTransform(newTransform);
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added


 btSolverConstraint.h   btSolverConstraint.h 
skipping to change at line 28 skipping to change at line 28
class btRigidBody; class btRigidBody;
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h" #include "LinearMath/btMatrix3x3.h"
#include "btJacobianEntry.h" #include "btJacobianEntry.h"
//#define NO_FRICTION_TANGENTIALS 1 //#define NO_FRICTION_TANGENTIALS 1
#include "btSolverBody.h" #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_ALIGNED64 (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_relpos2CrossNormal;
//btVector3 m_contactNormal2;//usually m_contactNormal2 == -m_contactNormal //btVector3 m_contactNormal2;//usually m_contactNormal2 == -m_contactNormal
btVector3 m_angularComponentA; btVector3 m_angularComponentA;
skipping to change at line 59 skipping to change at line 59
btScalar m_unusedPadding0; btScalar m_unusedPadding0;
}; };
union union
{ {
int m_frictionIndex; int m_frictionIndex;
btScalar m_unusedPadding1; btScalar m_unusedPadding1;
}; };
union union
{ {
int m_solverBodyIdA; btRigidBody* m_solverBodyA;
btScalar m_unusedPadding2; btScalar m_unusedPadding2;
}; };
union union
{ {
int m_solverBodyIdB; btRigidBody* m_solverBodyB;
btScalar m_unusedPadding3; btScalar m_unusedPadding3;
}; };
union union
{ {
void* m_originalContactPoint; void* m_originalContactPoint;
btScalar m_unusedPadding4; btScalar m_unusedPadding4;
}; };
btScalar m_rhs; btScalar m_rhs;
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 btStaticPlaneShape.h   btStaticPlaneShape.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 STATIC_PLANE_SHAPE_H #ifndef STATIC_PLANE_SHAPE_H
#define STATIC_PLANE_SHAPE_H #define STATIC_PLANE_SHAPE_H
#include "btConcaveShape.h" #include "btConcaveShape.h"
///The btStaticPlaneShape simulates an infinite non-moving (static) collisi on plane. ///The btStaticPlaneShape simulates an infinite non-moving (static) collisi on plane.
class btStaticPlaneShape : public btConcaveShape ATTRIBUTE_ALIGNED16(class) btStaticPlaneShape : public btConcaveShape
{ {
protected: protected:
btVector3 m_localAabbMin; btVector3 m_localAabbMin;
btVector3 m_localAabbMax; btVector3 m_localAabbMax;
btVector3 m_planeNormal; btVector3 m_planeNormal;
btScalar m_planeConstant; btScalar m_planeConstant;
btVector3 m_localScaling; btVector3 m_localScaling;
public: public:
skipping to change at line 59 skipping to change at line 59
} }
const btScalar& getPlaneConstant() const const btScalar& getPlaneConstant() const
{ {
return m_planeConstant; return m_planeConstant;
} }
//debugging //debugging
virtual const char* getName()const {return "STATICPLANE";} virtual const char* getName()const {return "STATICPLANE";}
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btStaticPlaneShapeData
{
btCollisionShapeData m_collisionShapeData;
btVector3FloatData m_localScaling;
btVector3FloatData m_planeNormal;
float m_planeConstant;
char m_pad[4];
}; };
SIMD_FORCE_INLINE int btStaticPlaneShape::calculateSerializeBuffer
Size() const
{
return sizeof(btStaticPlaneShapeData);
}
///fills the dataBuffer and returns the struct name (and 0 on failure)
SIMD_FORCE_INLINE const char* btStaticPlaneShape::serialize(void*
dataBuffer, btSerializer* serializer) const
{
btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) dataBu
ffer;
btCollisionShape::serialize(&planeData->m_collisionShapeData,seriali
zer);
m_localScaling.serializeFloat(planeData->m_localScaling);
m_planeNormal.serializeFloat(planeData->m_planeNormal);
planeData->m_planeConstant = float(m_planeConstant);
return "btStaticPlaneShapeData";
}
#endif //STATIC_PLANE_SHAPE_H #endif //STATIC_PLANE_SHAPE_H
 End of changes. 3 change blocks. 
1 lines changed or deleted 42 lines changed or added


 btStridingMeshInterface.h   btStridingMeshInterface.h 
skipping to change at line 87 skipping to change at line 87
} }
const btVector3& getScaling() const { const btVector3& getScaling() const {
return m_scaling; return m_scaling;
} }
void setScaling(const btVector3& scaling) void setScaling(const btVector3& scaling)
{ {
m_scaling = scaling; m_scaling = scaling;
} }
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 o
n failure)
virtual const char* serialize(void* dataBuffer, btSerial
izer* serializer) const;
};
struct btIntIndexData
{
int m_value;
};
struct btShortIntIndexData
{
short m_value;
char m_pad[2];
}; };
struct btShortIntIndexTripletData
{
short m_values[3];
char m_pad[2];
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btMeshPartData
{
btVector3FloatData *m_vertices3f;
btVector3DoubleData *m_vertices3d;
btIntIndexData *m_indices32;
btShortIntIndexTripletData *m_3indices16;
btShortIntIndexData *m_indices16;//backwards com
patibility
int m_numTriangles;//length of m_indices = m_num
Triangles
int m_numVertices;
};
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btStridingMeshInterfaceData
{
btMeshPartData *m_meshPartsPtr;
btVector3FloatData m_scaling;
int m_numMeshParts;
char m_padding[4];
};
SIMD_FORCE_INLINE int btStridingMeshInterface::calculateSerializeB
ufferSize() const
{
return sizeof(btStridingMeshInterfaceData);
}
#endif //STRIDING_MESHINTERFACE_H #endif //STRIDING_MESHINTERFACE_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 58 lines changed or added


 btTransform.h   btTransform.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 btTransform_H #ifndef btTransform_H
#define btTransform_H #define btTransform_H
#include "btVector3.h"
#include "btMatrix3x3.h" #include "btMatrix3x3.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btTransformData btTransformDoubleData
#else
#define btTransformData btTransformFloatData
#endif
/**@brief The btTransform class supports rigid transforms with only transla tion and rotation and no scaling/shear. /**@brief The btTransform class supports rigid transforms with only transla tion and rotation and no scaling/shear.
*It can be used in combination with btVector3, btQuaternion and btMatrix3x 3 linear algebra classes. */ *It can be used in combination with btVector3, btQuaternion and btMatrix3x 3 linear algebra classes. */
class btTransform { class btTransform {
///Storage for the rotation
btMatrix3x3 m_basis;
///Storage for the translation
btVector3 m_origin;
public: public:
/**@brief No initialization constructor */ /**@brief No initialization constructor */
btTransform() {} btTransform() {}
/**@brief Constructor from btQuaternion (optional btVector3 ) /**@brief Constructor from btQuaternion (optional btVector3 )
* @param q Rotation from quaternion * @param q Rotation from quaternion
* @param c Translation from Vector (default 0,0,0) */ * @param c Translation from Vector (default 0,0,0) */
explicit SIMD_FORCE_INLINE btTransform(const btQuaternion& q, explicit SIMD_FORCE_INLINE btTransform(const btQuaternion& q,
const btVector3& c = btVector3(btScalar(0), btScalar(0), btS calar(0))) const btVector3& c = btVector3(btScalar(0), btScalar(0), btS calar(0)))
: m_basis(q), : m_basis(q),
skipping to change at line 191 skipping to change at line 201
/**@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 const btTransform& getIdentity() static const btTransform& getIdentity()
{ {
static const btTransform identityTransform(btMatrix3x3::getI dentity()); static const btTransform identityTransform(btMatrix3x3::getI dentity());
return identityTransform; return identityTransform;
} }
private: void serialize(struct btTransformData& dataOut) const;
///Storage for the rotation
btMatrix3x3 m_basis; void serializeFloat(struct btTransformFloatData& dataOut) const
///Storage for the translation ;
btVector3 m_origin;
void deSerialize(const struct btTransformData& dataIn);
void deSerializeDouble(const struct btTransformDoubleData& dataI
n);
void deSerializeFloat(const struct btTransformFloatData& dataIn
);
}; };
SIMD_FORCE_INLINE btVector3 SIMD_FORCE_INLINE btVector3
btTransform::invXform(const btVector3& inVec) const btTransform::invXform(const btVector3& inVec) const
{ {
btVector3 v = inVec - m_origin; btVector3 v = inVec - m_origin;
return (m_basis.transpose() * v); return (m_basis.transpose() * v);
} }
SIMD_FORCE_INLINE btTransform SIMD_FORCE_INLINE btTransform
skipping to change at line 227 skipping to change at line 242
(*this)(t.m_origin)); (*this)(t.m_origin));
} }
/**@brief Test if two transforms have all elements equal */ /**@brief Test if two transforms have all elements equal */
SIMD_FORCE_INLINE bool operator==(const btTransform& t1, const btTransform& t2) SIMD_FORCE_INLINE bool operator==(const btTransform& t1, const btTransform& t2)
{ {
return ( t1.getBasis() == t2.getBasis() && return ( t1.getBasis() == t2.getBasis() &&
t1.getOrigin() == t2.getOrigin() ); t1.getOrigin() == t2.getOrigin() );
} }
///for serialization
struct btTransformFloatData
{
btMatrix3x3FloatData m_basis;
btVector3FloatData m_origin;
};
struct btTransformDoubleData
{
btMatrix3x3DoubleData m_basis;
btVector3DoubleData m_origin;
};
SIMD_FORCE_INLINE void btTransform::serialize(btTransformData& data
Out) const
{
m_basis.serialize(dataOut.m_basis);
m_origin.serialize(dataOut.m_origin);
}
SIMD_FORCE_INLINE void btTransform::serializeFloat(btTransformFloat
Data& dataOut) const
{
m_basis.serializeFloat(dataOut.m_basis);
m_origin.serializeFloat(dataOut.m_origin);
}
SIMD_FORCE_INLINE void btTransform::deSerialize(const btTransformDa
ta& dataIn)
{
m_basis.deSerialize(dataIn.m_basis);
m_origin.deSerialize(dataIn.m_origin);
}
SIMD_FORCE_INLINE void btTransform::deSerializeFloat(const btTransf
ormFloatData& dataIn)
{
m_basis.deSerializeFloat(dataIn.m_basis);
m_origin.deSerializeFloat(dataIn.m_origin);
}
SIMD_FORCE_INLINE void btTransform::deSerializeDouble(const btTrans
formDoubleData& dataIn)
{
m_basis.deSerializeDouble(dataIn.m_basis);
m_origin.deSerializeDouble(dataIn.m_origin);
}
#endif #endif
 End of changes. 5 change blocks. 
6 lines changed or deleted 72 lines changed or added


 btTransformUtil.h   btTransformUtil.h 
skipping to change at line 92 skipping to change at line 92
} else } else
{ {
angVel.setValue(0,0,0); angVel.setValue(0,0,0);
} }
} }
static void calculateDiffAxisAngleQuaternion(const btQuaternion& orn 0,const btQuaternion& orn1a,btVector3& axis,btScalar& angle) static void calculateDiffAxisAngleQuaternion(const btQuaternion& orn 0,const btQuaternion& orn1a,btVector3& axis,btScalar& angle)
{ {
btQuaternion orn1 = orn0.nearest(orn1a); btQuaternion orn1 = orn0.nearest(orn1a);
btQuaternion dorn = orn1 * orn0.inverse(); btQuaternion dorn = orn1 * orn0.inverse();
///floating point inaccuracy can lead to w component > 1...,
which breaks
dorn.normalize();
angle = dorn.getAngle(); angle = dorn.getAngle();
axis = btVector3(dorn.x(),dorn.y(),dorn.z()); axis = btVector3(dorn.x(),dorn.y(),dorn.z());
axis[3] = btScalar(0.); axis[3] = btScalar(0.);
//check for axis length //check for axis length
btScalar len = axis.length2(); btScalar len = axis.length2();
if (len < SIMD_EPSILON*SIMD_EPSILON) if (len < SIMD_EPSILON*SIMD_EPSILON)
axis = btVector3(btScalar(1.),btScalar(0.),btScalar( 0.)); axis = btVector3(btScalar(1.),btScalar(0.),btScalar( 0.));
else else
axis /= btSqrt(len); axis /= btSqrt(len);
} }
 End of changes. 1 change blocks. 
3 lines changed or deleted 0 lines changed or added


 btTypedConstraint.h   btTypedConstraint.h 
/* /*
Bullet Continuous Collision Detection and Physics Library Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ Copyright (c) 2003-2010 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty. This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from th e use of this software. In no event will the authors be held liable for any damages arising from th e use of this software.
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it free ly, including commercial applications, and to alter it and redistribute it free ly,
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 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" #include "btSolverConstraint.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
struct btSolverBody;
class btSerializer;
enum btTypedConstraintType enum btTypedConstraintType
{ {
POINT2POINT_CONSTRAINT_TYPE=MAX_CONTACT_MANIFOLD_TYPE+1, POINT2POINT_CONSTRAINT_TYPE=MAX_CONTACT_MANIFOLD_TYPE+1,
HINGE_CONSTRAINT_TYPE, HINGE_CONSTRAINT_TYPE,
CONETWIST_CONSTRAINT_TYPE, CONETWIST_CONSTRAINT_TYPE,
D6_CONSTRAINT_TYPE, D6_CONSTRAINT_TYPE,
SLIDER_CONSTRAINT_TYPE, SLIDER_CONSTRAINT_TYPE,
CONTACT_CONSTRAINT_TYPE CONTACT_CONSTRAINT_TYPE
}; };
enum btConstraintParams
{
BT_CONSTRAINT_ERP=1,
BT_CONSTRAINT_STOP_ERP,
BT_CONSTRAINT_CFM,
BT_CONSTRAINT_STOP_CFM
};
#if 1
#define btAssertConstrParams(_par) btAssert(_par)
#else
#define btAssertConstrParams(_par)
#endif
///TypedConstraint is the baseclass for Bullet constraints and vehicles ///TypedConstraint is the baseclass for Bullet constraints and vehicles
class btTypedConstraint : public btTypedObject class btTypedConstraint : public btTypedObject
{ {
int m_userConstraintType; int m_userConstraintType;
int m_userConstraintId; int m_userConstraintId;
bool m_needsFeedback; bool m_needsFeedback;
btTypedConstraint& operator=(btTypedConstraint& other) btTypedConstraint& operator=(btTypedConstraint& other)
{ {
btAssert(0); btAssert(0);
(void) other; (void) other;
return *this; return *this;
} }
protected: protected:
btRigidBody& m_rbA; btRigidBody& m_rbA;
btRigidBody& m_rbB; btRigidBody& m_rbB;
btScalar m_appliedImpulse; btScalar m_appliedImpulse;
btScalar m_dbgDrawSize; btScalar m_dbgDrawSize;
btVector3 m_appliedLinearImpulse; ///internal method used by the constraint solver, don't use them dir
btVector3 m_appliedAngularImpulseA; ectly
btVector3 m_appliedAngularImpulseB; btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppL
im, btScalar vel, btScalar timeFact);
static btRigidBody& getFixedBody()
{
static btRigidBody s_fixed(0, 0,0);
s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btS
calar(0.),btScalar(0.)));
return s_fixed;
}
public: public:
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 { struct btConstraintInfo1 {
int m_numConstraintRows,nub; int m_numConstraintRows,nub;
}; };
struct btConstraintInfo2 { struct btConstraintInfo2 {
// integrator parameters: frames per second (1/stepsize), de fault error // integrator parameters: frames per second (1/stepsize), de fault error
skipping to change at line 102 skipping to change at line 122
// findex vector for variables. see the LCP solver interface for a // findex vector for variables. see the LCP solver interface for a
// description of what this does. this is set to -1 on entry . // description of what this does. this is set to -1 on entry .
// note that the returned indexes are relative to the first index of // note that the returned indexes are relative to the first index of
// the constraint. // the constraint.
int *findex; int *findex;
// number of solver iterations // number of solver iterations
int m_numIterations; int m_numIterations;
}; };
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
virtual void buildJacobian() = 0; virtual void buildJacobian() {};
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
virtual void setupSolverConstraint(btConstraintArray& ca, int sol verBodyA,int solverBodyB, btScalar timeStep) virtual void setupSolverConstraint(btConstraintArray& ca, int sol verBodyA,int solverBodyB, btScalar timeStep)
{ {
(void)ca;
(void)solverBodyA;
(void)solverBodyB;
(void)timeStep;
} }
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
virtual void getInfo1 (btConstraintInfo1* info)=0; virtual void getInfo1 (btConstraintInfo1* info)=0;
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
virtual void getInfo2 (btConstraintInfo2* info)=0; virtual void getInfo2 (btConstraintInfo2* info)=0;
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
void internalSetAppliedImpulse(btScalar appliedImpulse) void internalSetAppliedImpulse(btScalar appliedImpulse)
skipping to change at line 120 skipping to change at line 144
virtual void getInfo1 (btConstraintInfo1* info)=0; virtual void getInfo1 (btConstraintInfo1* info)=0;
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
virtual void getInfo2 (btConstraintInfo2* info)=0; virtual void getInfo2 (btConstraintInfo2* info)=0;
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
void internalSetAppliedImpulse(btScalar appliedImpulse) void internalSetAppliedImpulse(btScalar appliedImpulse)
{ {
m_appliedImpulse = appliedImpulse; m_appliedImpulse = appliedImpulse;
} }
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolver btScalar internalGetAppliedImpulse()
Body& bodyB,btScalar timeStep) = 0; {
return m_appliedImpulse;
}
///internal method used by the constraint solver, don't use them dir ectly ///internal method used by the constraint solver, don't use them dir ectly
btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppL im, btScalar vel, btScalar timeFact); virtual void solveConstraintObsolete(btRigidBody& bodyA,btRigidBo dy& bodyB,btScalar timeStep) {};
const btRigidBody& getRigidBodyA() const const btRigidBody& getRigidBodyA() const
{ {
return m_rbA; return m_rbA;
} }
const btRigidBody& getRigidBodyB() const const btRigidBody& getRigidBodyB() const
{ {
return m_rbB; return m_rbB;
} }
skipping to change at line 190 skipping to change at line 216
} }
///getAppliedImpulse is an estimated total applied impulse. ///getAppliedImpulse is an estimated total applied impulse.
///This feedback could be used to determine breaking constraints or playing sounds. ///This feedback could be used to determine breaking constraints or playing sounds.
btScalar getAppliedImpulse() const btScalar getAppliedImpulse() const
{ {
btAssert(m_needsFeedback); btAssert(m_needsFeedback);
return m_appliedImpulse; return m_appliedImpulse;
} }
const btVector3& getAppliedLinearImpulse() const
{
btAssert(m_needsFeedback);
return m_appliedLinearImpulse;
}
btVector3& getAppliedLinearImpulse()
{
btAssert(m_needsFeedback);
return m_appliedLinearImpulse;
}
const btVector3& getAppliedAngularImpulseA() const
{
btAssert(m_needsFeedback);
return m_appliedAngularImpulseA;
}
btVector3& getAppliedAngularImpulseA()
{
btAssert(m_needsFeedback);
return m_appliedAngularImpulseA;
}
const btVector3& getAppliedAngularImpulseB() const
{
btAssert(m_needsFeedback);
return m_appliedAngularImpulseB;
}
btVector3& getAppliedAngularImpulseB()
{
btAssert(m_needsFeedback);
return m_appliedAngularImpulseB;
}
btTypedConstraintType getConstraintType () const btTypedConstraintType getConstraintType () const
{ {
return btTypedConstraintType(m_objectType); return btTypedConstraintType(m_objectType);
} }
void setDbgDrawSize(btScalar dbgDrawSize) void setDbgDrawSize(btScalar dbgDrawSize)
{ {
m_dbgDrawSize = dbgDrawSize; m_dbgDrawSize = dbgDrawSize;
} }
btScalar getDbgDrawSize() btScalar getDbgDrawSize()
{ {
return m_dbgDrawSize; return m_dbgDrawSize;
} }
///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5).
///If no axis is provided, it uses the default axis for this constra
int.
virtual void setParam(int num, btScalar value, int axis = -1) = 0
;
///return the local value of parameter
virtual btScalar getParam(int num, int axis = -1) const = 0;
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failur
e)
virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const;
}; };
// returns angle in range [-SIMD_2_PI, SIMD_2_PI], closest to one of the li mits // returns angle in range [-SIMD_2_PI, SIMD_2_PI], closest to one of the li mits
// all arguments should be normalized angles (i.e. in range [-SIMD_PI, SIMD _PI]) // all arguments should be normalized angles (i.e. in range [-SIMD_PI, SIMD _PI])
SIMD_FORCE_INLINE btScalar btAdjustAngleToLimits(btScalar angleInRadians, b tScalar angleLowerLimitInRadians, btScalar angleUpperLimitInRadians) SIMD_FORCE_INLINE btScalar btAdjustAngleToLimits(btScalar angleInRadians, b tScalar angleLowerLimitInRadians, btScalar angleUpperLimitInRadians)
{ {
if(angleLowerLimitInRadians >= angleUpperLimitInRadians) if(angleLowerLimitInRadians >= angleUpperLimitInRadians)
{ {
return angleInRadians; return angleInRadians;
} }
skipping to change at line 268 skipping to change at line 270
btScalar diffHi = btNormalizeAngle(angleInRadians - angleUpp erLimitInRadians); // this is positive btScalar diffHi = btNormalizeAngle(angleInRadians - angleUpp erLimitInRadians); // this is positive
btScalar diffLo = btFabs(btNormalizeAngle(angleInRadians - a ngleLowerLimitInRadians)); btScalar diffLo = btFabs(btNormalizeAngle(angleInRadians - a ngleLowerLimitInRadians));
return (diffLo < diffHi) ? (angleInRadians - SIMD_2_PI) : an gleInRadians; return (diffLo < diffHi) ? (angleInRadians - SIMD_2_PI) : an gleInRadians;
} }
else else
{ {
return angleInRadians; return angleInRadians;
} }
} }
///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64
struct btTypedConstraintData
{
btRigidBodyData *m_rbA;
btRigidBodyData *m_rbB;
char *m_name;
int m_objectType;
int m_userConstraintType;
int m_userConstraintId;
int m_needsFeedback;
float m_appliedImpulse;
float m_dbgDrawSize;
int m_disableCollisionsBetweenLinkedBodies;
char m_pad4[4];
};
SIMD_FORCE_INLINE int btTypedConstraint::calculateSerializeBufferS
ize() const
{
return sizeof(btTypedConstraintData);
}
#endif //TYPED_CONSTRAINT_H #endif //TYPED_CONSTRAINT_H
 End of changes. 13 change blocks. 
47 lines changed or deleted 83 lines changed or added


 btUnionFind.h   btUnionFind.h 
skipping to change at line 105 skipping to change at line 105
int find(int x) int find(int x)
{ {
//btAssert(x < m_N); //btAssert(x < m_N);
//btAssert(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
// const btElement* elementPtr = &m_elements[m_
m_elements[x].m_id = m_elements[m_elements[x elements[x].m_id];
].m_id].m_id; m_elements[x].m_id = elementPtr->m_id;
#endif // x = elementPtr->m_id;
#else//
x = m_elements[x].m_id; x = m_elements[x].m_id;
#endif
//btAssert(x < m_N); //btAssert(x < m_N);
//btAssert(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 6 lines changed or added


 btVector3.h   btVector3.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__VECTOR3_H #ifndef SIMD__VECTOR3_H
#define SIMD__VECTOR3_H #define SIMD__VECTOR3_H
#include "btScalar.h" #include "btScalar.h"
#include "btScalar.h"
#include "btMinMax.h" #include "btMinMax.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btVector3Data btVector3DoubleData
#define btVector3DataName "btVector3DoubleData"
#else
#define btVector3Data btVector3FloatData
#define btVector3DataName "btVector3FloatData"
#endif //BT_USE_DOUBLE_PRECISION
/**@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
*/ */
ATTRIBUTE_ALIGNED16(class) btVector3 ATTRIBUTE_ALIGNED16(class) btVector3
{ {
public: public:
#if defined (__SPU__) && defined (__CELLOS_LV2__) #if defined (__SPU__) && defined (__CELLOS_LV2__)
btScalar m_floats[4]; btScalar m_floats[4];
public: public:
SIMD_FORCE_INLINE const vec_float4& get128() const SIMD_FORCE_INLINE const vec_float4& get128() const
{ {
return *((const vec_float4*)&m_floats[0]); return *((const vec_float4*)&m_floats[0]);
skipping to change at line 39 skipping to change at line 46
#if defined (__SPU__) && defined (__CELLOS_LV2__) #if defined (__SPU__) && defined (__CELLOS_LV2__)
btScalar m_floats[4]; btScalar m_floats[4];
public: public:
SIMD_FORCE_INLINE const vec_float4& get128() const SIMD_FORCE_INLINE const vec_float4& get128() const
{ {
return *((const vec_float4*)&m_floats[0]); return *((const vec_float4*)&m_floats[0]);
} }
public: public:
#else //__CELLOS_LV2__ __SPU__ #else //__CELLOS_LV2__ __SPU__
#ifdef BT_USE_SSE // WIN32 #ifdef BT_USE_SSE // _WIN32
union { union {
__m128 mVec128; __m128 mVec128;
btScalar m_floats[4]; btScalar m_floats[4];
}; };
SIMD_FORCE_INLINE __m128 get128() const SIMD_FORCE_INLINE __m128 get128() const
{ {
return mVec128; return mVec128;
} }
SIMD_FORCE_INLINE void set128(__m128 v128) SIMD_FORCE_INLINE void set128(__m128 v128)
{ {
skipping to change at line 314 skipping to change at line 321
v0->setValue(0. ,-z() ,y()); v0->setValue(0. ,-z() ,y());
v1->setValue(z() ,0. ,-x( )); v1->setValue(z() ,0. ,-x( ));
v2->setValue(-y() ,x() ,0.); v2->setValue(-y() ,x() ,0.);
} }
void setZero() void setZero()
{ {
setValue(btScalar(0.),btScalar(0.),btScalar(0.)); setValue(btScalar(0.),btScalar(0.),btScalar(0.));
} }
SIMD_FORCE_INLINE bool isZero() const
{
return m_floats[0] == btScalar(0) && m_floats[1] ==
btScalar(0) && m_floats[2] == btScalar(0);
}
SIMD_FORCE_INLINE bool fuzzyZero() const
{
return length2() < SIMD_EPSILON;
}
SIMD_FORCE_INLINE void serialize(struct btVe
ctor3Data& dataOut) const;
SIMD_FORCE_INLINE void deSerialize(const struct
btVector3Data& dataIn);
SIMD_FORCE_INLINE void serializeFloat(struct btVe
ctor3FloatData& dataOut) const;
SIMD_FORCE_INLINE void deSerializeFloat(const struc
t btVector3FloatData& dataIn);
SIMD_FORCE_INLINE void serializeDouble(struct btVe
ctor3DoubleData& dataOut) const;
SIMD_FORCE_INLINE void deSerializeDouble(const stru
ct btVector3DoubleData& dataIn);
}; };
/**@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.m_floats[0] + v2.m_floats[0], v1.m_floats[1] + v 2.m_floats[1], v1.m_floats[2] + v2.m_floats[2]); 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 */
skipping to change at line 631 skipping to change at line 660
else { else {
// choose p in x-y plane // choose p in x-y plane
btScalar a = n.x()*n.x() + n.y()*n.y(); btScalar a = n.x()*n.x() + n.y()*n.y();
btScalar k = btRecipSqrt (a); btScalar k = btRecipSqrt (a);
p.setValue(-n.y()*k,n.x()*k,0); p.setValue(-n.y()*k,n.x()*k,0);
// set q = n x p // set q = n x p
q.setValue(-n.z()*p.y(),n.z()*p.x(),a*k); q.setValue(-n.z()*p.y(),n.z()*p.x(),a*k);
} }
} }
struct btVector3FloatData
{
float m_floats[4];
};
struct btVector3DoubleData
{
double m_floats[4];
};
SIMD_FORCE_INLINE void btVector3::serializeFloat(struct btVe
ctor3FloatData& dataOut) const
{
///could also do a memcpy, check if it is worth it
for (int i=0;i<4;i++)
dataOut.m_floats[i] = float(m_floats[i]);
}
SIMD_FORCE_INLINE void btVector3::deSerializeFloat(const struct btVe
ctor3FloatData& dataIn)
{
for (int i=0;i<4;i++)
m_floats[i] = btScalar(dataIn.m_floats[i]);
}
SIMD_FORCE_INLINE void btVector3::serializeDouble(struct btVe
ctor3DoubleData& dataOut) const
{
///could also do a memcpy, check if it is worth it
for (int i=0;i<4;i++)
dataOut.m_floats[i] = double(m_floats[i]);
}
SIMD_FORCE_INLINE void btVector3::deSerializeDouble(const struct btVe
ctor3DoubleData& dataIn)
{
for (int i=0;i<4;i++)
m_floats[i] = btScalar(dataIn.m_floats[i]);
}
SIMD_FORCE_INLINE void btVector3::serialize(struct btVector3Dat
a& dataOut) const
{
///could also do a memcpy, check if it is worth it
for (int i=0;i<4;i++)
dataOut.m_floats[i] = m_floats[i];
}
SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3Dat
a& dataIn)
{
for (int i=0;i<4;i++)
m_floats[i] = dataIn.m_floats[i];
}
#endif //SIMD__VECTOR3_H #endif //SIMD__VECTOR3_H
 End of changes. 6 change blocks. 
3 lines changed or deleted 95 lines changed or added


 btVoronoiSimplexSolver.h   btVoronoiSimplexSolver.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 btVoronoiSimplexSolver_H #ifndef btVoronoiSimplexSolver_H
#define btVoronoiSimplexSolver_H #define btVoronoiSimplexSolver_H
#include "btSimplexSolverInterface.h" #include "btSimplexSolverInterface.h"
#define VORONOI_SIMPLEX_MAX_VERTS 5 #define VORONOI_SIMPLEX_MAX_VERTS 5
///disable next define, or use defaultCollisionConfiguration->getSimplexSol
ver()->setEqualVertexThreshold(0.f) to disable/configure
#define BT_USE_EQUAL_VERTEX_THRESHOLD
#define VORONOI_DEFAULT_EQUAL_VERTEX_THRESHOLD 0.0001f
struct btUsageBitfield{ struct btUsageBitfield{
btUsageBitfield() btUsageBitfield()
{ {
reset(); reset();
} }
void reset() void reset()
{ {
usedVertexA = false; usedVertexA = false;
usedVertexB = false; usedVertexB = false;
skipping to change at line 101 skipping to change at line 105
int m_numVertices; int m_numVertices;
btVector3 m_simplexVectorW[VORONOI_SIMPLEX_MAX_VERTS]; btVector3 m_simplexVectorW[VORONOI_SIMPLEX_MAX_VERTS];
btVector3 m_simplexPointsP[VORONOI_SIMPLEX_MAX_VERTS]; btVector3 m_simplexPointsP[VORONOI_SIMPLEX_MAX_VERTS];
btVector3 m_simplexPointsQ[VORONOI_SIMPLEX_MAX_VERTS]; btVector3 m_simplexPointsQ[VORONOI_SIMPLEX_MAX_VERTS];
btVector3 m_cachedP1; btVector3 m_cachedP1;
btVector3 m_cachedP2; btVector3 m_cachedP2;
btVector3 m_cachedV; btVector3 m_cachedV;
btVector3 m_lastW; btVector3 m_lastW;
btScalar m_equalVertexThreshold;
bool m_cachedValidClosest; bool m_cachedValidClosest;
btSubSimplexClosestResult m_cachedBC; btSubSimplexClosestResult m_cachedBC;
bool m_needsUpdate; bool m_needsUpdate;
void removeVertex(int index); void removeVertex(int index);
void reduceVertices (const btUsageBitfield& usedVerts); void reduceVertices (const btUsageBitfield& usedVerts);
bool updateClosestVectorAndPoints(); bool updateClosestVectorAndPoints();
bool closestPtPointTetrahedron(const btVector3& p, const btVector 3& a, const btVector3& b, const btVector3& c, const btVector3& d, btSubSimp lexClosestResult& finalResult); bool closestPtPointTetrahedron(const btVector3& p, const btVector 3& a, const btVector3& b, const btVector3& c, const btVector3& d, btSubSimp lexClosestResult& finalResult);
int pointOutsideOfPlane(const btVector3& p, const btVect or3& a, const btVector3& b, const btVector3& c, const btVector3& d); int pointOutsideOfPlane(const btVector3& p, const btVect or3& a, const btVector3& b, const btVector3& c, const btVector3& d);
bool closestPtPointTriangle(const btVector3& p, const btVector3& a, const btVector3& b, const btVector3& c,btSubSimplexClosestResult& result ); bool closestPtPointTriangle(const btVector3& p, const btVector3& a, const btVector3& b, const btVector3& c,btSubSimplexClosestResult& result );
public: public:
btVoronoiSimplexSolver()
: m_equalVertexThreshold(VORONOI_DEFAULT_EQUAL_VERTEX_THRES
HOLD)
{
}
void reset(); void reset();
void addVertex(const btVector3& w, const btVector3& p, const btVect or3& q); void addVertex(const btVector3& w, const btVector3& p, const btVect or3& q);
void setEqualVertexThreshold(btScalar threshold)
{
m_equalVertexThreshold = threshold;
}
btScalar getEqualVertexThreshold() const
{
return m_equalVertexThreshold;
}
bool closest(btVector3& v); bool closest(btVector3& v);
btScalar maxVertex(); btScalar maxVertex();
bool fullSimplex() const bool fullSimplex() const
{ {
return (m_numVertices == 4); return (m_numVertices == 4);
} }
int getSimplex(btVector3 *pBuf, btVector3 *qBuf, btVector3 *yBuf) c onst; int getSimplex(btVector3 *pBuf, btVector3 *qBuf, btVector3 *yBuf) c onst;
 End of changes. 4 change blocks. 
0 lines changed or deleted 22 lines changed or added


 btWheelInfo.h   btWheelInfo.h 
skipping to change at line 32 skipping to change at line 32
btVector3 m_wheelDirectionCS; btVector3 m_wheelDirectionCS;
btVector3 m_wheelAxleCS; btVector3 m_wheelAxleCS;
btScalar m_suspensionRestLength; btScalar m_suspensionRestLength;
btScalar m_maxSuspensionTravelCm; btScalar m_maxSuspensionTravelCm;
btScalar m_wheelRadius; btScalar m_wheelRadius;
btScalar m_suspensionStiffness; btScalar m_suspensionStiffness;
btScalar m_wheelsDampingCompression; btScalar m_wheelsDampingCompression;
btScalar m_wheelsDampingRelaxation; btScalar m_wheelsDampingRelaxation;
btScalar m_frictionSlip; btScalar m_frictionSlip;
btScalar m_maxSuspensionForce;
bool m_bIsFrontWheel; bool m_bIsFrontWheel;
}; };
/// btWheelInfo contains information per wheel about friction and suspensio n. /// btWheelInfo contains information per wheel about friction and suspensio n.
struct btWheelInfo struct btWheelInfo
{ {
struct RaycastInfo struct RaycastInfo
{ {
//set by raycaster //set by raycaster
skipping to change at line 71 skipping to change at line 72
btScalar getSuspensionRestLength() const; btScalar getSuspensionRestLength() const;
btScalar m_wheelsRadius;//const btScalar m_wheelsRadius;//const
btScalar m_suspensionStiffness;//const btScalar m_suspensionStiffness;//const
btScalar m_wheelsDampingCompression;//const btScalar m_wheelsDampingCompression;//const
btScalar m_wheelsDampingRelaxation;//const btScalar m_wheelsDampingRelaxation;//const
btScalar m_frictionSlip; btScalar m_frictionSlip;
btScalar m_steering; btScalar m_steering;
btScalar m_rotation; btScalar m_rotation;
btScalar m_deltaRotation; btScalar m_deltaRotation;
btScalar m_rollInfluence; btScalar m_rollInfluence;
btScalar m_maxSuspensionForce;
btScalar m_engineForce; btScalar m_engineForce;
btScalar m_brake; btScalar m_brake;
bool m_bIsFrontWheel; bool m_bIsFrontWheel;
void* m_clientInfo;//can be used to store pointer to sync transforms... void* m_clientInfo;//can be used to store pointer to sync transforms...
btWheelInfo(btWheelInfoConstructionInfo& ci) btWheelInfo(btWheelInfoConstructionInfo& ci)
skipping to change at line 102 skipping to change at line 104
m_wheelDirectionCS = ci.m_wheelDirectionCS; m_wheelDirectionCS = ci.m_wheelDirectionCS;
m_wheelAxleCS = ci.m_wheelAxleCS; m_wheelAxleCS = ci.m_wheelAxleCS;
m_frictionSlip = ci.m_frictionSlip; m_frictionSlip = ci.m_frictionSlip;
m_steering = btScalar(0.); m_steering = btScalar(0.);
m_engineForce = btScalar(0.); m_engineForce = btScalar(0.);
m_rotation = btScalar(0.); m_rotation = btScalar(0.);
m_deltaRotation = btScalar(0.); m_deltaRotation = btScalar(0.);
m_brake = btScalar(0.); m_brake = btScalar(0.);
m_rollInfluence = btScalar(0.1); m_rollInfluence = btScalar(0.1);
m_bIsFrontWheel = ci.m_bIsFrontWheel; m_bIsFrontWheel = ci.m_bIsFrontWheel;
m_maxSuspensionForce = ci.m_maxSuspensionForce;
} }
void updateWheel(const btRigidBody& chassis,RaycastInfo& raycastI nfo); void updateWheel(const btRigidBody& chassis,RaycastInfo& raycastI nfo);
btScalar m_clippedInvContactDotSuspension; btScalar m_clippedInvContactDotSuspension;
btScalar m_suspensionRelativeVelocity; btScalar m_suspensionRelativeVelocity;
//calculated by suspension //calculated by suspension
btScalar m_wheelsSuspensionForce; btScalar m_wheelsSuspensionForce;
btScalar m_skidInfo; btScalar m_skidInfo;
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added


 bt_constraint.h   bt_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//bt_constraint.h //bt_constraint.h
#ifndef DYN_BT_CONSTRAINT_H #ifndef DYN_BT_CONSTRAINT_H
#define DYN_BT_CONSTRAINT_H #define DYN_BT_CONSTRAINT_H
#include "btBulletCollisionCommon.h" #include "btBulletCollisionCommon.h"
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include "shared_ptr.h" #include "shared_ptr.h"
class rigid_body_impl_t;
class bt_constraint_t class bt_constraint_t
{ {
public: public:
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
bt_constraint_t() { } bt_constraint_t() { }
btTypedConstraint* constraint() { return m_constrai nt.get(); } btTypedConstraint* constraint() { return m_constrai nt.get(); }
void set_constraint(btTypedConstraint *constraint) { return m_constrai nt.reset(constraint); } void set_constraint(btTypedConstraint *constraint) { return m_constrai nt.reset(constraint); }
virtual void update_constraint() = 0; virtual void update_constraint(rigid_body_impl_t* rb) = 0;
public: public:
friend class bt_rigid_body_t; friend class bt_rigid_body_t;
virtual ~bt_constraint_t() { } virtual ~bt_constraint_t() { }
protected: protected:
shared_ptr<btTypedConstraint> m_constraint; shared_ptr<btTypedConstraint> m_constraint;
}; };
 End of changes. 3 change blocks. 
1 lines changed or deleted 6 lines changed or added


 bt_convex_hull_shape.h   bt_convex_hull_shape.h 
skipping to change at line 62 skipping to change at line 62
} }
glVertexPointer(3, GL_FLOAT, 0, &(m_vertices[0])); glVertexPointer(3, GL_FLOAT, 0, &(m_vertices[0]));
glNormalPointer(GL_FLOAT, 0, &(m_normals[0])); glNormalPointer(GL_FLOAT, 0, &(m_normals[0]));
glDrawElements(GL_TRIANGLES, m_indices.size(), GL_UNSIGNED_INT, &(m _indices[0])); glDrawElements(GL_TRIANGLES, m_indices.size(), GL_UNSIGNED_INT, &(m _indices[0]));
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glPopMatrix(); glPopMatrix();
} }
virtual void set_scale(vec3f const& s) { virtual void set_scale(vec3f const& s1) {
shape()->setLocalScaling(btVector3(s[0], s[1], s[2])); // shape()->setLocalScaling(btVector3(s[0], s[1], s[2]));
btVector3 s(s1[0],s1[1],s1[2]);
float delSq = 0.f;
for(int i = 0; i < 3; i++)
{
float del = s[i] - m_cachedScaling[i];
delSq += del * del;
}
if (delSq > FLT_EPSILON)
{
// btAssert(shape()->getType()==
btCompoundShape* compound =(btCompoundShape*)shape()
;
btConvexHullShape* child = (btConvexHullShape*)compo
und->getChildShape(0);
/*
btTransform scaleTransf;
scaleTransf.setIdentity();
scaleTransf.getBasis()[0][0] = (s/m_cachedScaling)[0
];
scaleTransf.getBasis()[1][1] = (s/m_cachedScaling)[1
];
scaleTransf.getBasis()[2][2] = (s/m_cachedScaling)[2
];
btTransform combinedTr = tr.inverse() * (scaleTransf
* (tr * vtx));
*/
const btTransform& tr = compound->getChildTransform(
0);
for (int i=0;i<child->getNumPoints();i++)
{
btVector3 oldPoint = child->getUnscaledPoint
s()[i];
btVector3 parentPoint = tr*oldPoint;
btVector3 parentPointScaled = parentPoint*(s
/m_cachedScaling);
btVector3 childPoint = tr.inverse()*parentPo
intScaled;
child->getUnscaledPoints()[i]=childPoint;
}
m_cachedScaling = s;
}
update(); update();
} }
virtual void get_scale(vec3f& s) { virtual void get_scale(vec3f& s) {
const btVector3& scale = shape()->getLocalScaling(); // const btVector3& scale = shape()->getLocalScaling();
s = vec3f(scale.x(), scale.y(), scale.z()); // s = vec3f(scale.x(), scale.y(), scale.z());
s = vec3f(m_cachedScaling.x(), m_cachedScaling.y(), m_cachedScaling
.z());
} }
virtual float volume() { return m_volume; } virtual float volume() { return m_volume; }
virtual vec3f const& local_inertia() { return m_local_inertia; } virtual vec3f const& local_inertia() { return m_local_inertia; }
virtual vec3f const& center() { return m_center; } virtual vec3f const& center() { return m_center; }
virtual quatf const& rotation() { return m_rotation; } virtual quatf const& rotation() { return m_rotation; }
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
skipping to change at line 106 skipping to change at line 140
//D = trans(Q) * I * Q; //D = trans(Q) * I * Q;
m_local_inertia = diag(prod(trans(Q), mat3x3f(prod(I, Q)))); m_local_inertia = diag(prod(trans(Q), mat3x3f(prod(I, Q))));
m_vertices.resize(num_vertices); m_vertices.resize(num_vertices);
for(size_t i = 0; i < m_vertices.size(); ++i) { for(size_t i = 0; i < m_vertices.size(); ++i) {
m_vertices[i] = prod(Qinv, vertices[i] - m_center); m_vertices[i] = prod(Qinv, vertices[i] - m_center);
} }
m_ch_shape.reset(new btConvexHullShape((float const*)&(m_vertices[0 ]), num_vertices, sizeof(vec3f))); m_ch_shape.reset(new btConvexHullShape((float const*)&(m_vertices[0 ]), num_vertices, sizeof(vec3f)));
btCompoundShape *compound_shape = new btCompoundShape; btCompoundShape *compound_shape = new btCompoundShape;
// btTransform childTransf;
// childTransf.setIdentity();
// childTransf.setOrigin(btVector3(m_center[0], m_center[1], m_
center[2]));
// compound_shape->addChildShape(childTransf, m_ch_shape.get());
///*
compound_shape->addChildShape(btTransform(btQuaternion(m_rotation[1 ], compound_shape->addChildShape(btTransform(btQuaternion(m_rotation[1 ],
m_rotation[2 ], m_rotation[2 ],
m_rotation[3 ], m_rotation[3 ],
m_rotation[0 ]), m_rotation[0 ]),
btVector3(m_center[0], btVector3(m_center[0],
m_center[1], m_center[1],
m_center[2])), m_center[2])),
m_ch_shape.get()); m_ch_shape.get());
//*/
set_shape(compound_shape); set_shape(compound_shape);
m_cachedScaling[0] = m_cachedScaling[1] = m_cachedScaling[2] = 1.f;
} }
void update() void update()
{ {
//apply the scaling //apply the scaling
btVector3 const& scale = m_ch_shape->getLocalScaling(); btVector3 const& scale = m_ch_shape->getLocalScaling();
btVector3 const* points = m_ch_shape->getUnscaledPoints(); btVector3 const* points = m_ch_shape->getUnscaledPoints();
for(int i = 0; i < m_ch_shape->getNumPoints(); ++i) { for(int i = 0; i < m_ch_shape->getNumPoints(); ++i) {
m_vertices[i] = vec3f(scale.x() * points[i].x(), scale.y() * po ints[i].y(), scale.z() * points[i].z()); m_vertices[i] = vec3f(scale.x() * points[i].x(), scale.y() * po ints[i].y(), scale.z() * points[i].z());
} }
skipping to change at line 150 skipping to change at line 192
private: private:
shared_ptr<btConvexHullShape> m_ch_shape; shared_ptr<btConvexHullShape> m_ch_shape;
std::vector<vec3f> m_vertices; std::vector<vec3f> m_vertices;
std::vector<vec3f> m_normals; std::vector<vec3f> m_normals;
std::vector<unsigned int> m_indices; std::vector<unsigned int> m_indices;
float m_volume; float m_volume;
vec3f m_center; vec3f m_center;
quatf m_rotation; quatf m_rotation;
vec3f m_local_inertia; vec3f m_local_inertia;
btVector3 m_cachedScal ing;
}; };
#endif #endif
 End of changes. 6 change blocks. 
4 lines changed or deleted 59 lines changed or added


 bt_hinge_constraint.h   bt_hinge_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//bt_hinge_constraint.h //bt_hinge_constraint.h
#ifndef DYN_BT_HINGE_CONSTRAINT_H #ifndef DYN_BT_HINGE_CONSTRAINT_H
#define DYN_BT_HINGE_CONSTRAINT_H #define DYN_BT_HINGE_CONSTRAINT_H
#include "bt_rigid_body.h"
#include "bt_constraint.h" #include "bt_constraint.h"
#include "hinge_constraint_impl.h" #include "hinge_constraint_impl.h"
class bt_hinge_constraint_t: public bt_constraint_t, public hinge_constrain t_impl_t { class bt_hinge_constraint_t: public bt_constraint_t, public hinge_constrain t_impl_t {
public: public:
virtual void set_damping(float d) { virtual void set_damping(float d) {
// btHingeConstraint* p2pc = static_cast<btHingeConstraint*>(m_const raint.get()); // btHingeConstraint* p2pc = static_cast<btHingeConstraint*>(m_const raint.get());
// p2pc->m_setting.m_damping = d; // p2pc->m_setting.m_damping = d;
} }
skipping to change at line 57 skipping to change at line 61
hinge->setAxis(axis); hinge->setAxis(axis);
} }
virtual float damping() const { virtual float damping() const {
// btHingeConstraint const* hc = static_cast<btHingeConstraint const *>(m_constraint.get()); // btHingeConstraint const* hc = static_cast<btHingeConstraint const *>(m_constraint.get());
// return hc->m_setting.m_damping; // return hc->m_setting.m_damping;
return 0; return 0;
} }
// //
virtual void set_pivot(vec3f const &p) { virtual void get_frameA(vec3f& p, quatf& r) const
/* btHingeConstraint* p2pc = static_cast<btHingeConstraint*>(m_const {
raint.get()); btHingeConstraint const* hc = static_cast<btHingeConstraint
btVector3 bt_pivot(p[0], p[1], p[2]); const*>(m_constraint.get());
p2pc->setPivotA(bt_pivot); const btTransform& btxform = hc->getAFrame();
p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransf btQuaternion bq = btxform.getRotation();
orm()(bt_pivot)); btVector3 bp = btxform.getOrigin();
// p2pc->buildJacobian(); p = vec3f(bp.x(), bp.y(), bp.z());
*/ } r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void get_pivot(vec3f &p) const { virtual void get_frameB(vec3f& p, quatf& r) const
/* btHingeConstraint const* hc = static_cast<btHingeConstraint const {
*>(m_constraint.get()); btHingeConstraint const* hc = static_cast<btHingeConstraint
p[0] = hc->getPivotInA().x(); const*>(m_constraint.get());
p[1] = hc->getPivotInA().y(); const btTransform& btxform = hc->getBFrame();
p[2] = hc->getPivotInA().z(); btQuaternion bq = btxform.getRotation();
*/ } btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
virtual void get_world_pivot(vec3f &p) const { r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
/* btHingeConstraint const* hc = static_cast<btHingeConstraint const }
*>(m_constraint.get()); virtual void get_invFrameA(vec3f& p, quatf& r) const
p[0] = hc->getPivotInB().x(); {
p[1] = hc->getPivotInB().y(); btHingeConstraint const* hc = static_cast<btHingeConstraint
p[2] = hc->getPivotInB().z(); const*>(m_constraint.get());
*/ } const btTransform btxform = hc->getAFrame().inverse();
btQuaternion bq = btxform.getRotation();
btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void get_invFrameB(vec3f& p, quatf& r) const
{
btHingeConstraint const* hc = static_cast<btHingeConstraint
const*>(m_constraint.get());
const btTransform btxform = hc->getBFrame().inverse();
btQuaternion bq = btxform.getRotation();
btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void worldToA(vec3f& w, vec3f& p) const
{
btHingeConstraint const* hc = static_cast<btHingeConstraint
const*>(m_constraint.get());
const btTransform w2a = (hc->getRigidBodyA().getWorldTransfo
rm() * hc->getAFrame()).inverse();
btVector3 bw(w[0], w[1], w[2]);
btVector3 bp = w2a * bw;
p = vec3f(bp[0], bp[1], bp[2]);
}
virtual void worldFromB(vec3f& p, vec3f& w) const
{
btHingeConstraint const* hc = static_cast<btHingeConstraint
const*>(m_constraint.get());
const btTransform b2w = hc->getRigidBodyB().getWorldTransfor
m() * hc->getBFrame();
btVector3 bp(p[0], p[1], p[2]);
btVector3 bw = b2w * bp;
w = vec3f(bw[0], bw[1], bw[2]);
}
virtual void set_world(vec3f const &p) { virtual void set_world(vec3f const &p, quatf const& r) {
btHingeConstraint* hc = static_cast<btHingeConstraint*>(m_constrain t.get()); btHingeConstraint* hc = static_cast<btHingeConstraint*>(m_constrain t.get());
btVector3 world(p[0], p[1], p[2]); btVector3 worldP(p[0], p[1], p[2]);
btVector3 pivotA = hc->getRigidBodyA().getWorldTransform().i btQuaternion worldR(r[1], r[2], r[3], r[0]);
nverse() (world); btTransform frameAinW(worldR, worldP);
hc->getAFrame().getOrigin() = pivotA; btTransform frameA = hc->getRigidBodyA().getWorldTransform()
hc->getBFrame().getOrigin() = world; .inverse() * frameAinW;
// p2pc->buildJacobian(); btTransform frameB = hc->getRigidBodyB().getWorldTransform()
.inverse() * frameAinW;
hc->getAFrame() = frameA;
hc->getBFrame() = frameB;
} }
virtual void get_world(vec3f &p) const { virtual void get_world(vec3f &p, quatf& r) const {
btHingeConstraint const* hc = static_cast<btHingeConstraint const*> (m_constraint.get()); btHingeConstraint const* hc = static_cast<btHingeConstraint const*> (m_constraint.get());
p[0] = hc->getBFrame().getOrigin().x(); btTransform frameAinW = hc->getRigidBodyA().getWorldTransfor
p[1] = hc->getBFrame().getOrigin().y(); m() * hc->getAFrame();
p[2] = hc->getBFrame().getOrigin().z(); btQuaternion bq = frameAinW.getRotation();
btVector3 bp = frameAinW.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
} }
virtual void enable_motor(bool enable, float velocity, float impulse ) { virtual void enable_motor(bool enable, float velocity, float impulse ) {
btHingeConstraint* hinge = static_cast<btHingeConstraint*>(m_constr aint.get()); btHingeConstraint* hinge = static_cast<btHingeConstraint*>(m_constr aint.get());
hinge->enableAngularMotor(enable, velocity, impulse); hinge->enableAngularMotor(enable, velocity, impulse);
} }
virtual void update_constraint() virtual void update_constraint(rigid_body_impl_t* rb)
{ {
btHingeConstraint* hc = static_cast<btHingeConstraint*>(m_constrain btHingeConstraint* hc = static_cast<btHingeConstraint*>(m_co
t.get()); nstraint.get());
btVector3 world = hc->getBFrame().getOrigin(); btRigidBody* bt_body = static_cast<bt_rigid_body_t*>(rb)->body();
btVector3 pivotA = hc->getRigidBodyA().getWorldTransform().i btTransform frameW, frameL;
nverse() (world); if(bt_body == &hc->getRigidBodyA())
hc->getAFrame().getOrigin() = pivotA; {
frameW = hc->getRigidBodyB().getWorldTransform() * h
c->getBFrame();
frameL = hc->getRigidBodyA().getWorldTransform().inv
erse() * frameW;
hc->getAFrame() = frameL;
}
else if(bt_body == &hc->getRigidBodyB())
{
frameW = hc->getRigidBodyA().getWorldTransform() * h
c->getAFrame();
frameL = hc->getRigidBodyB().getWorldTransform().inv
erse() * frameW;
hc->getBFrame() = frameL;
}
setPivotChanged(true);
} }
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
bt_hinge_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot): bt_hinge_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot, quatf const& rot):
hinge_constraint_impl_t() hinge_constraint_impl_t()
{ {
btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body(); btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body();
btVector3 pivotA = bt_body.getCenterOfMassPosition(); btVector3 p(pivot[0], pivot[1], pivot[2]);
btVector3 btAxisA( 0.0f, 1.0f, 0.0f ); // pointing upwards, btQuaternion q(rot[1], rot[2], rot[3], rot[0]);
aka Y-axis btTransform frameInA(q, p);
btHingeConstraint * hinge = new btHingeConstraint(bt_body, - btHingeConstraint* hinge = new btHingeConstraint(bt_body, fr
pivotA, btAxisA); ameInA, false);
m_constraint.reset(hinge); m_constraint.reset(hinge);
rb->add_constraint(this); rb->add_constraint(this);
} }
bt_hinge_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, quat
f const& rotA, rigid_body_impl_t* rbB, vec3f const& pivotB, quatf const& ro
tB):
hinge_constraint_impl_t()
{
btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body()
;
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body()
;
btVector3 pA(pivotA[0], pivotA[1], pivotA[2]);
btQuaternion qA(rotA[1], rotA[2], rotA[3], rotA[0]);
btTransform frameInA(qA, pA);
btVector3 pB(pivotB[0], pivotB[1], pivotB[2]);
btQuaternion qB(rotB[1], rotB[2], rotB[3], rotB[0]);
btTransform frameInB(qB, pB);
btHingeConstraint* hinge = new btHingeConstraint(bt_bodyA, b
t_bodyB, frameInA, frameInB, false);
m_constraint.reset(hinge);
rbA->add_constraint(this);
rbB->add_constraint(this);
}
private: private:
}; };
#endif //DYN_BT_HINGE_CONSTRAINT_H #endif //DYN_BT_HINGE_CONSTRAINT_H
 End of changes. 12 change blocks. 
49 lines changed or deleted 130 lines changed or added


 bt_mesh_shape.h   bt_mesh_shape.h 
skipping to change at line 137 skipping to change at line 137
// gimpactShape->setMargin(0.05); // gimpactShape->setMargin(0.05);
} }
void update() void update()
{ {
//apply the scaling //apply the scaling
btVector3 const& scale = m_gi_shape->getLocalScaling(); btVector3 const& scale = m_gi_shape->getLocalScaling();
std::vector<vec3f> vertices(m_vertices.size()); std::vector<vec3f> vertices(m_vertices.size());
for(int i = 0; i < vertices.size(); ++i) { for(unsigned int i = 0; i < vertices.size(); ++i) {
vertices[i] = vec3f(scale.x() * m_vertices[i][0], scale.y() * m _vertices[i][1], scale.z() * m_vertices[i][2]); vertices[i] = vec3f(scale.x() * m_vertices[i][0], scale.y() * m _vertices[i][1], scale.z() * m_vertices[i][2]);
} }
m_volume = ::volume(&(vertices[0]), (int*)&(m_indices[0]), (int)m_i ndices.size()); m_volume = ::volume(&(vertices[0]), (int*)&(m_indices[0]), (int)m_i ndices.size());
mat3x3f I = inertia(&(vertices[0]), (int*)&(m_indices[0]), (int)m_i ndices.size(), vec3f(0, 0, 0)); mat3x3f I = inertia(&(vertices[0]), (int*)&(m_indices[0]), (int)m_i ndices.size(), vec3f(0, 0, 0));
// std::cout << I << std::endl; // std::cout << I << std::endl;
//m_rotation = diagonalizer(I); //m_rotation = diagonalizer(I);
//std::cout << rotation << std::endl; //std::cout << rotation << std::endl;
//the rotation shouldn't change from scaling //the rotation shouldn't change from scaling
mat3x3f Q, Qinv; mat3x3f Q, Qinv;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 bt_nail_constraint.h   bt_nail_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//bt_nail_constraint.h //bt_nail_constraint.h
#ifndef DYN_BT_NAIL_CONSTRAINT_H #ifndef DYN_BT_NAIL_CONSTRAINT_H
#define DYN_BT_NAIL_CONSTRAINT_H #define DYN_BT_NAIL_CONSTRAINT_H
#include "bt_rigid_body.h"
#include "bt_constraint.h" #include "bt_constraint.h"
#include "nail_constraint_impl.h" #include "nail_constraint_impl.h"
class bt_nail_constraint_t: public bt_constraint_t, public nail_constraint_ impl_t { class bt_nail_constraint_t: public bt_constraint_t, public nail_constraint_ impl_t {
public: public:
virtual void set_damping(float d) { virtual void set_damping(float d) {
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get()); btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get());
p2pc->m_setting.m_damping = d; p2pc->m_setting.m_damping = d;
} }
skipping to change at line 49 skipping to change at line 53
virtual float damping() const { virtual float damping() const {
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get()); btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get());
return p2pc->m_setting.m_damping; return p2pc->m_setting.m_damping;
} }
// //
virtual void set_pivotA(vec3f const &p) { virtual void set_pivotA(vec3f const &p) {
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get()); btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get());
btVector3 bt_pivot(p[0], p[1], p[2]); btVector3 bt_pivot(p[0], p[1], p[2]);
p2pc->setPivotA(bt_pivot); p2pc->setPivotA(bt_pivot);
p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransf setPivotChanged(true);
orm()(bt_pivot));
// p2pc->buildJacobian();
} }
virtual void get_pivotA(vec3f &p) const { virtual void get_pivotA(vec3f &p) const {
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get()); btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get());
p[0] = p2pc->getPivotInA().x(); p[0] = p2pc->getPivotInA().x();
p[1] = p2pc->getPivotInA().y(); p[1] = p2pc->getPivotInA().y();
p[2] = p2pc->getPivotInA().z(); p[2] = p2pc->getPivotInA().z();
} }
virtual void get_world_pivot(vec3f &p) const { virtual void set_pivotB(vec3f const &p) {
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint
*>(m_constraint.get());
btVector3 bt_pivot(p[0], p[1], p[2]);
p2pc->setPivotB(bt_pivot);
setPivotChanged(true);
}
virtual void get_pivotB(vec3f &p) const {
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get()); btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get());
p[0] = p2pc->getPivotInB().x(); p[0] = p2pc->getPivotInB().x();
p[1] = p2pc->getPivotInB().y(); p[1] = p2pc->getPivotInB().y();
p[2] = p2pc->getPivotInB().z(); p[2] = p2pc->getPivotInB().z();
} }
virtual void get_world_pivotA(vec3f &p) const {
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons
traint const*>(m_constraint.get());
btVector3 pivotAinW = p2pc->getRigidBodyA().getCenterOfMassT
ransform()* p2pc->getPivotInA();
p[0] = pivotAinW.x();
p[1] = pivotAinW.y();
p[2] = pivotAinW.z();
}
virtual void get_world_pivotB(vec3f &p) const {
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons
traint const*>(m_constraint.get());
btVector3 pivotBinW = p2pc->getRigidBodyB().getCenterOfMassT
ransform()* p2pc->getPivotInB();
p[0] = pivotBinW.x();
p[1] = pivotBinW.y();
p[2] = pivotBinW.z();
}
virtual void set_world(vec3f const &p) { virtual void set_world(vec3f const &p) {
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get()); btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get());
btVector3 world(p[0], p[1], p[2]); btVector3 world(p[0], p[1], p[2]);
btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform() .inverse() (world); btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform() .inverse() (world);
p2pc->setPivotA(pivotA); p2pc->setPivotA(pivotA);
p2pc->setPivotB(world); btVector3 pivotB = p2pc->getRigidBodyB().getWorldTransform()
p2pc->buildJacobian(); .inverse() (world);
p2pc->setPivotB(pivotB);
setPivotChanged(true);
} }
virtual void get_world(vec3f &p) const { virtual void get_world(vec3f &p) const {
btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get()); btPoint2PointConstraint const* p2pc = static_cast<btPoint2PointCons traint const*>(m_constraint.get());
p[0] = p2pc->getPivotInB().x(); btVector3 pivotAinW = p2pc->getRigidBodyA().getCenterOfMassT
p[1] = p2pc->getPivotInB().y(); ransform()* p2pc->getPivotInA();
p[2] = p2pc->getPivotInB().z(); p[0] = pivotAinW.x();
p[1] = pivotAinW.y();
p[2] = pivotAinW.z();
} }
virtual void update_constraint() virtual void update_constraint(rigid_body_impl_t* rb)
{ {
btRigidBody* bt_body = static_cast<bt_rigid_body_t*>(rb)->body();
btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get()); btPoint2PointConstraint* p2pc = static_cast<btPoint2PointConstraint *>(m_constraint.get());
btVector3 world = p2pc->getPivotInB(); btVector3 world, pivot;
btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform() if(bt_body == &p2pc->getRigidBodyA())
.inverse() (world); {
p2pc->setPivotA(pivotA); world = p2pc->getRigidBodyB().getWorldTransform() *
p2pc->getPivotInB();
pivot = p2pc->getRigidBodyA().getWorldTransform().in
verse() * world;
p2pc->setPivotA(pivot);
}
else if(bt_body == &p2pc->getRigidBodyB())
{
world = p2pc->getRigidBodyA().getWorldTransform() *
p2pc->getPivotInA();
pivot = p2pc->getRigidBodyB().getWorldTransform().in
verse() * world;
p2pc->setPivotB(pivot);
}
else
{
world.setValue(0.f, 0.f, 0.f);
}
setPivotChanged(true);
} }
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
bt_nail_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot): bt_nail_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot):
nail_constraint_impl_t() nail_constraint_impl_t()
{ {
btVector3 bulPivot(pivot[0], pivot[1], pivot[2]);
btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body(); btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body();
btVector3 pivotA = bt_body.getCenterOfMassPosition(); m_constraint.reset(new btPoint2PointConstraint(bt_body, bulPivot));
m_constraint.reset(new btPoint2PointConstraint(bt_body, -pivotA));
rb->add_constraint(this); rb->add_constraint(this);
} }
bt_nail_constraint_t(rigid_body_impl_t* rbA, rigid_body_impl_t* rbB,
vec3f const& pivotInA, vec3f const& pivotInB):
nail_constraint_impl_t()
{
btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body()
;
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body()
;
btVector3 bulPivotInA(pivotInA[0], pivotInA[1], pivotInA[2])
;
btVector3 bulPivotInB(pivotInB[0], pivotInB[1], pivotInB[2])
;
m_constraint.reset(new btPoint2PointConstraint(bt_bodyA, bt_bodyB,
bulPivotInA, bulPivotInB));
rbA->add_constraint(this);
rbB->add_constraint(this);
}
private: private:
}; };
#endif #endif
 End of changes. 13 change blocks. 
16 lines changed or deleted 85 lines changed or added


 bt_plane_shape.h   bt_plane_shape.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
12/24/2009 : Nail constraint improvements
*/ */
//bt_plane_shape.h //bt_plane_shape.h
#ifndef DYN_BT_PLANE_SHAPE_H #ifndef DYN_BT_PLANE_SHAPE_H
#define DYN_BT_PLANE_SHAPE_H #define DYN_BT_PLANE_SHAPE_H
#include "plane_shape_impl.h" #include "plane_shape_impl.h"
#include "drawUtils.h" #include "drawUtils.h"
class bt_plane_shape_t: public bt_collision_shape_t, public plane_shape_imp l_t class bt_plane_shape_t: public bt_collision_shape_t, public plane_shape_imp l_t
{ {
public: public:
virtual void gl_draw(size_t draw_style) virtual void gl_draw(size_t draw_style)
{ {
// std::cout << "bt_plane_shape_t::draw" << std::endl; // std::cout << "bt_plane_shape_t::draw" << std::endl;
// btStaticPlaneShape *plane_shape = static_cast<btStaticPlaneShape* >(shape()); // btStaticPlaneShape *plane_shape = static_cast<btStaticPlaneShape* >(shape());
glPushMatrix(); glPushMatrix();
glScalef(100.0, 0.001, 100.0); glScalef(100.0f, 0.001f, 100.0f);
if(draw_style & collision_shape_t::kDSSolid) { if(draw_style & collision_shape_t::kDSSolid) {
solid_cube(); solid_cube();
} else { } else {
wire_cube(); wire_cube();
} }
glPopMatrix(); glPopMatrix();
} }
virtual void set_scale(vec3f const& s) { virtual void set_scale(vec3f const& s) {
shape()->setLocalScaling(btVector3(s[0], s[1], s[2])); shape()->setLocalScaling(btVector3(s[0], s[1], s[2]));
 End of changes. 2 change blocks. 
1 lines changed or deleted 5 lines changed or added


 bt_rigid_body.h   bt_rigid_body.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//bt_rigid_body.h //bt_rigid_body.h
#ifndef DYN_BT_RIGID_BODY_H #ifndef DYN_BT_RIGID_BODY_H
#define DYN_BT_RIGID_BODY_H #define DYN_BT_RIGID_BODY_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "rigid_body_impl.h" #include "rigid_body_impl.h"
#include "bt_collision_shape.h" #include "bt_collision_shape.h"
skipping to change at line 59 skipping to change at line 62
rotation = quatf(q.w(), q.x(), q.y(), q.z()); rotation = quatf(q.w(), q.x(), q.y(), q.z());
} }
virtual void set_transform(vec3f const &position, quatf const &rotation ) virtual void set_transform(vec3f const &position, quatf const &rotation )
{ {
vec3f tp = position; vec3f tp = position;
quatf tr = rotation; quatf tr = rotation;
btTransform xform(btQuaternion(tr[1], tr[2], tr[3], tr[0]), btTransform xform(btQuaternion(tr[1], tr[2], tr[3], tr[0]),
btVector3(tp[0], tp[1], tp[2])); btVector3(tp[0], tp[1], tp[2]));
m_body->setWorldTransform(xform); m_body->setWorldTransform(xform);
// static bodies may got false "impulse" when editing in May
a, so...
m_body->setInterpolationWorldTransform(xform);
}
virtual void set_interpolation_transform(vec3f const &position, quat
f const &rotation)
{
vec3f tp = position;
quatf tr = rotation;
btTransform xform(btQuaternion(tr[1], tr[2], tr[3], tr[0]),
btVector3(tp[0], tp[1], tp[2]));
m_body->setInterpolationWorldTransform(xform);
} }
virtual void set_kinematic(bool kinematic) virtual void set_kinematic(bool kinematic)
{ {
if(kinematic) { if(kinematic) {
m_body->setCollisionFlags(m_body->getCollisionFlags() | btColli sionObject::CF_KINEMATIC_OBJECT); m_body->setCollisionFlags(m_body->getCollisionFlags() | btColli sionObject::CF_KINEMATIC_OBJECT);
m_body->setActivationState(DISABLE_DEACTIVATION); m_body->setActivationState(DISABLE_DEACTIVATION);
m_body->setMassProps(0, btVector3(0.0,0.0,0.0)); m_body->setMassProps(0, btVector3(0.0,0.0,0.0));
m_body->updateInertiaTensor(); m_body->updateInertiaTensor();
} else { } else {
skipping to change at line 163 skipping to change at line 177
virtual void apply_torque(vec3f const& t) virtual void apply_torque(vec3f const& t)
{ {
m_body->applyTorque(btVector3(t[0], t[1], t[2])); m_body->applyTorque(btVector3(t[0], t[1], t[2]));
} }
virtual void update_constraint() virtual void update_constraint()
{ {
int count = m_constraintRef.size(); int count = m_constraintRef.size();
for(int i=0; i<count; i++) for(int i=0; i<count; i++)
{ {
m_constraintRef[i]->update_constraint(); m_constraintRef[i]->update_constraint(this);
} }
} }
btRigidBody* body() { return m_body.get(); } btRigidBody* body() { return m_body.get(); }
virtual void add_constraint(bt_constraint_t* constraint) virtual void add_constraint(bt_constraint_t* constraint)
{ {
m_constraintRef.push_back(constraint); m_constraintRef.push_back(constraint);
} }
virtual void remove_constraint(bt_constraint_t* constraint) virtual void remove_constraint(bt_constraint_t* constraint)
{ {
m_constraintRef.remove(constraint); m_constraintRef.remove(constraint);
} }
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
btAlignedObjectArray<bt_constraint_t*> m_constraintRef; btAlignedObjectArray<bt_constraint_t*> m_constraintRef;
bt_rigid_body_t(collision_shape_impl_t* cs): bt_rigid_body_t(collision_shape_impl_t* cs):
m_collision_shape(cs), m_collision_shape(cs),
m_mass(1), m_mass(1),
m_inertia(2.0/5.0, 2.0/5.0, 2.0/5.0), m_inertia(2.0f/5.0f, 2.0f/5.0f, 2.0f/5.0f),
m_linear_damping(0), m_linear_damping(0),
m_angular_damping(0) m_angular_damping(0)
{ {
bt_collision_shape_t* bt_shape = dynamic_cast<bt_collision_shape_t* >(cs); bt_collision_shape_t* bt_shape = dynamic_cast<bt_collision_shape_t* >(cs);
btRigidBody::btRigidBodyConstructionInfo rbInfo(m_mass, NULL, bt_sh ape->shape(), m_inertia); btRigidBody::btRigidBodyConstructionInfo rbInfo(m_mass, NULL, bt_sh ape->shape(), m_inertia);
rbInfo.m_restitution = 0; rbInfo.m_restitution = 0;
rbInfo.m_friction = 0.1; rbInfo.m_friction = 0.1f;
rbInfo.m_linearDamping = m_linear_damping; rbInfo.m_linearDamping = m_linear_damping;
rbInfo.m_angularDamping = m_angular_damping; rbInfo.m_angularDamping = m_angular_damping;
m_body.reset(new btRigidBody(rbInfo)); m_body.reset(new btRigidBody(rbInfo));
} }
private: private:
shared_ptr<btRigidBody> m_body; shared_ptr<btRigidBody> m_body;
collision_shape_impl_t* m_collision_shape; collision_shape_impl_t* m_collision_shape;
float m_mass; float m_mass;
btVector3 m_inertia; btVector3 m_inertia;
 End of changes. 5 change blocks. 
3 lines changed or deleted 19 lines changed or added


 bt_sixdof_constraint.h   bt_sixdof_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//bt_sixdof_constraint.h //bt_sixdof_constraint.h
#ifndef DYN_BT_SIXDOF_CONSTRAINT_H #ifndef DYN_BT_SIXDOF_CONSTRAINT_H
#define DYN_BT_SIXDOF_CONSTRAINT_H #define DYN_BT_SIXDOF_CONSTRAINT_H
#include "bt_rigid_body.h"
#include "bt_constraint.h" #include "bt_constraint.h"
#include "sixdof_constraint_impl.h" #include "sixdof_constraint_impl.h"
class bt_sixdof_constraint_t: public bt_constraint_t, public sixdof_constra int_impl_t { class bt_sixdof_constraint_t: public bt_constraint_t, public sixdof_constra int_impl_t {
public: public:
virtual void set_damping(float d) { virtual void set_damping(float d) {
// btGeneric6DofConstraint* p2pc = static_cast<btGeneric6DofConstrai nt*>(m_constraint.get()); // btGeneric6DofConstraint* p2pc = static_cast<btGeneric6DofConstrai nt*>(m_constraint.get());
// p2pc->m_setting.m_damping = d; // p2pc->m_setting.m_damping = d;
} }
virtual void set_LinLimit(float lower, float upper) { virtual void set_LinLimit(vec3f& lower, vec3f& upper) {
btGeneric6DofConstraint* sixdof = static_cast<btGeneric6DofC onstraint*>(m_constraint.get()); btGeneric6DofConstraint* sixdof = static_cast<btGeneric6DofC onstraint*>(m_constraint.get());
// sixdof->setLowerLinLimit(lower); btVector3 btlow(lower[0], lower[1], lower[2]);
// sixdof->setUpperLinLimit(upper); btVector3 btupp(upper[0], upper[1], upper[2]);
sixdof->setLinearLowerLimit(btlow);
sixdof->setLinearUpperLimit(btupp);
} }
virtual void set_AngLimit(float lower, float upper) { virtual void set_AngLimit(vec3f& lower, vec3f& upper) {
btGeneric6DofConstraint* sixdof = static_cast<btGeneric6DofC onstraint*>(m_constraint.get()); btGeneric6DofConstraint* sixdof = static_cast<btGeneric6DofC onstraint*>(m_constraint.get());
// sixdof->setLowerAngLimit(lower); btVector3 btlow(lower[0], lower[1], lower[2]);
// sixdof->setUpperAngLimit(upper); btVector3 btupp(upper[0], upper[1], upper[2]);
sixdof->setAngularLowerLimit(btlow);
sixdof->setAngularUpperLimit(btupp);
} }
virtual float damping() const { virtual float damping() const {
// btGeneric6DofConstraint const* hc = static_cast<btGeneric6DofCons traint const*>(m_constraint.get()); // btGeneric6DofConstraint const* hc = static_cast<btGeneric6DofCons traint const*>(m_constraint.get());
// return hc->m_setting.m_damping; // return hc->m_setting.m_damping;
return 0; return 0;
} }
// virtual void get_frameA(vec3f& p, quatf& r) const
virtual void set_pivot(vec3f const &p) { {
/* btGeneric6DofConstraint* p2pc = static_cast<btGeneric6DofConstrai btGeneric6DofConstraint const* sc = static_cast<btGeneric6Do
nt*>(m_constraint.get()); fConstraint const*>(m_constraint.get());
btVector3 bt_pivot(p[0], p[1], p[2]); const btTransform& btxform = sc->getFrameOffsetA();
p2pc->setPivotA(bt_pivot); btQuaternion bq = btxform.getRotation();
p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransf btVector3 bp = btxform.getOrigin();
orm()(bt_pivot)); p = vec3f(bp.x(), bp.y(), bp.z());
// p2pc->buildJacobian(); r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
*/ } }
virtual void get_frameB(vec3f& p, quatf& r) const
virtual void get_pivot(vec3f &p) const { {
/* btGeneric6DofConstraint const* hc = static_cast<btGeneric6DofCons btGeneric6DofConstraint const* sc = static_cast<btGeneric6Do
traint const*>(m_constraint.get()); fConstraint const*>(m_constraint.get());
p[0] = hc->getPivotInA().x(); const btTransform& btxform = sc->getFrameOffsetB();
p[1] = hc->getPivotInA().y(); btQuaternion bq = btxform.getRotation();
p[2] = hc->getPivotInA().z(); btVector3 bp = btxform.getOrigin();
*/ } p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
virtual void get_world_pivot(vec3f &p) const { }
/* btGeneric6DofConstraint const* hc = static_cast<btGeneric6DofCons virtual void get_invFrameA(vec3f& p, quatf& r) const
traint const*>(m_constraint.get()); {
p[0] = hc->getPivotInB().x(); btGeneric6DofConstraint const* sc = static_cast<btGeneric6Do
p[1] = hc->getPivotInB().y(); fConstraint const*>(m_constraint.get());
p[2] = hc->getPivotInB().z(); const btTransform btxform = sc->getFrameOffsetA().inverse();
*/ } btQuaternion bq = btxform.getRotation();
btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void get_invFrameB(vec3f& p, quatf& r) const
{
btGeneric6DofConstraint const* sc = static_cast<btGeneric6Do
fConstraint const*>(m_constraint.get());
const btTransform btxform = sc->getFrameOffsetB().inverse();
btQuaternion bq = btxform.getRotation();
btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void worldToA(vec3f& w, vec3f& p) const
{
btGeneric6DofConstraint const* sc = static_cast<btGeneric6Do
fConstraint const*>(m_constraint.get());
const btTransform w2a = (sc->getRigidBodyA().getWorldTransfo
rm() * sc->getFrameOffsetA()).inverse();
btVector3 bw(w[0], w[1], w[2]);
btVector3 bp = w2a * bw;
p = vec3f(bp[0], bp[1], bp[2]);
}
virtual void worldFromB(vec3f& p, vec3f& w) const
{
btGeneric6DofConstraint const* sc = static_cast<btGeneric6Do
fConstraint const*>(m_constraint.get());
const btTransform b2w = sc->getRigidBodyB().getWorldTransfor
m() * sc->getFrameOffsetB();
btVector3 bp(p[0], p[1], p[2]);
btVector3 bw = b2w * bp;
w = vec3f(bw[0], bw[1], bw[2]);
}
virtual void set_world(vec3f const &p) { virtual void set_world(vec3f const &p, quatf const& r) {
btGeneric6DofConstraint* constraint = static_cast<btGeneric6DofCons btGeneric6DofConstraint* sc = static_cast<btGeneric6DofConstraint*>
traint*>(m_constraint.get()); (m_constraint.get());
btTransform framInA = constraint->getRigidBodyA().getCenterO btVector3 worldP(p[0], p[1], p[2]);
fMassTransform().inverse(); btQuaternion worldR(r[1], r[2], r[3], r[0]);
btTransform framInB = constraint->getRigidBodyB().getCenterO btTransform frameAinW(worldR, worldP);
fMassTransform().inverse(); btTransform frameA = sc->getRigidBodyA().getWorldTransform()
constraint->getFrameOffsetA() = framInA; .inverse() * frameAinW;
constraint->getFrameOffsetB() = framInB; btTransform frameB = sc->getRigidBodyB().getWorldTransform()
world = p; .inverse() * frameAinW;
sc->getFrameOffsetA() = frameA;
sc->getFrameOffsetB() = frameB;
} }
virtual void get_world(vec3f &p) const { virtual void get_world(vec3f &p, quatf& r) const {
/* btGeneric6DofConstraint const* hc = static_cast<btGeneric6DofCons btGeneric6DofConstraint const* sc = static_cast<btGeneric6DofConstr
traint const*>(m_constraint.get()); aint const*>(m_constraint.get());
p[0] = hc->getFrameOffsetB().getOrigin().x(); btTransform frameAinW = sc->getRigidBodyA().getWorldTransfor
p[1] = hc->getFrameOffsetB().getOrigin().y(); m() * sc->getFrameOffsetA();
p[2] = hc->getFrameOffsetB().getOrigin().z(); btQuaternion bq = frameAinW.getRotation();
*/ p = world; btVector3 bp = frameAinW.getOrigin();
} p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void update_constraint() virtual void update_constraint(rigid_body_impl_t* rb)
{ {
btGeneric6DofConstraint* constraint = static_cast<btGeneric6DofCons btGeneric6DofConstraint* sc = static_cast<btGeneric6DofConst
traint*>(m_constraint.get()); raint*>(m_constraint.get());
constraint->getFrameOffsetA() = constraint->getRigidBodyA(). btRigidBody* bt_body = static_cast<bt_rigid_body_t*>(rb)->body();
getCenterOfMassTransform().inverse(); btTransform frameW, frameL;
constraint->getFrameOffsetB() = constraint->getRigidBodyB(). if(bt_body == &sc->getRigidBodyA())
getCenterOfMassTransform().inverse(); {
frameW = sc->getRigidBodyB().getWorldTransform() * s
c->getFrameOffsetB();
frameL = sc->getRigidBodyA().getWorldTransform().inv
erse() * frameW;
sc->getFrameOffsetA() = frameL;
}
else if(bt_body == &sc->getRigidBodyB())
{
frameW = sc->getRigidBodyA().getWorldTransform() * s
c->getFrameOffsetA();
frameL = sc->getRigidBodyB().getWorldTransform().inv
erse() * frameW;
sc->getFrameOffsetB() = frameL;
}
setPivotChanged(true);
} }
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
vec3f world;
bt_sixdof_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, rig bt_sixdof_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot, quatf
id_body_impl_t* rbB, vec3f const& pivotB): const& rot):
sixdof_constraint_impl_t()
{
btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body();
btVector3 p(pivot[0], pivot[1], pivot[2]);
btQuaternion q(rot[1], rot[2], rot[3], rot[0]);
btTransform frameInA(q, p);
btGeneric6DofConstraint* sixdof = new btGeneric6DofConstrain
t(bt_body, frameInA, false);
m_constraint.reset(sixdof);
rb->add_constraint(this);
}
bt_sixdof_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, qua
tf const& rotA, rigid_body_impl_t* rbB, vec3f const& pivotB, quatf const& r
otB):
sixdof_constraint_impl_t() sixdof_constraint_impl_t()
{ {
btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body() ; btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body() ;
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body() ; btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body() ;
btTransform framInA = bt_bodyA.getCenterOfMassTransform().in btVector3 pA(pivotA[0], pivotA[1], pivotA[2]);
verse(); btQuaternion qA(rotA[1], rotA[2], rotA[3], rotA[0]);
btTransform framInB = bt_bodyB.getCenterOfMassTransform().in btTransform frameInA(qA, pA);
verse(); btVector3 pB(pivotB[0], pivotB[1], pivotB[2]);
btGeneric6DofConstraint * sixdof = new btGeneric6DofConstrai btQuaternion qB(rotB[1], rotB[2], rotB[3], rotB[0]);
nt(bt_bodyA, bt_bodyB, framInA, framInB, true); btTransform frameInB(qB, pB);
m_constraint.reset(sixdof); btGeneric6DofConstraint* sixdof = new btGeneric6DofConstrain
t(bt_bodyA, bt_bodyB, frameInA, frameInB, false);
m_constraint.reset(sixdof);
rbA->add_constraint(this); rbA->add_constraint(this);
rbB->add_constraint(this);
} }
private: private:
}; };
#endif //DYN_BT_SIXDOF_CONSTRAINT_H #endif //DYN_BT_SIXDOF_CONSTRAINT_H
 End of changes. 16 change blocks. 
67 lines changed or deleted 145 lines changed or added


 bt_slider_constraint.h   bt_slider_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//bt_slider_constraint.h //bt_slider_constraint.h
#ifndef DYN_BT_SLIDER_CONSTRAINT_H #ifndef DYN_BT_SLIDER_CONSTRAINT_H
#define DYN_BT_SLIDER_CONSTRAINT_H #define DYN_BT_SLIDER_CONSTRAINT_H
#include "bt_rigid_body.h"
#include "bt_constraint.h" #include "bt_constraint.h"
#include "slider_constraint_impl.h" #include "slider_constraint_impl.h"
class bt_slider_constraint_t: public bt_constraint_t, public slider_constra int_impl_t { class bt_slider_constraint_t: public bt_constraint_t, public slider_constra int_impl_t {
public: public:
virtual void set_damping(float d) { virtual void set_damping(float d) {
// btSliderConstraint* p2pc = static_cast<btSliderConstraint*>(m_con straint.get()); // btSliderConstraint* p2pc = static_cast<btSliderConstraint*>(m_con straint.get());
// p2pc->m_setting.m_damping = d; // p2pc->m_setting.m_damping = d;
} }
skipping to change at line 57 skipping to change at line 61
slider->setLowerAngLimit(lower); slider->setLowerAngLimit(lower);
slider->setUpperAngLimit(upper); slider->setUpperAngLimit(upper);
} }
virtual float damping() const { virtual float damping() const {
// btSliderConstraint const* hc = static_cast<btSliderConstraint con st*>(m_constraint.get()); // btSliderConstraint const* hc = static_cast<btSliderConstraint con st*>(m_constraint.get());
// return hc->m_setting.m_damping; // return hc->m_setting.m_damping;
return 0; return 0;
} }
// virtual void get_frameA(vec3f& p, quatf& r) const
virtual void set_pivot(vec3f const &p) { {
/* btSliderConstraint* p2pc = static_cast<btSliderConstraint*>(m_con btSliderConstraint const* sc = static_cast<btSliderConstrain
straint.get()); t const*>(m_constraint.get());
btVector3 bt_pivot(p[0], p[1], p[2]); const btTransform& btxform = sc->getFrameOffsetA();
p2pc->setPivotA(bt_pivot); btQuaternion bq = btxform.getRotation();
p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransf btVector3 bp = btxform.getOrigin();
orm()(bt_pivot)); p = vec3f(bp.x(), bp.y(), bp.z());
// p2pc->buildJacobian(); r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
*/ } }
virtual void get_frameB(vec3f& p, quatf& r) const
virtual void get_pivot(vec3f &p) const { {
/* btSliderConstraint const* hc = static_cast<btSliderConstraint con btSliderConstraint const* sc = static_cast<btSliderConstrain
st*>(m_constraint.get()); t const*>(m_constraint.get());
p[0] = hc->getPivotInA().x(); const btTransform& btxform = sc->getFrameOffsetB();
p[1] = hc->getPivotInA().y(); btQuaternion bq = btxform.getRotation();
p[2] = hc->getPivotInA().z(); btVector3 bp = btxform.getOrigin();
*/ } p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
virtual void get_world_pivot(vec3f &p) const { }
/* btSliderConstraint const* hc = static_cast<btSliderConstraint con virtual void get_invFrameA(vec3f& p, quatf& r) const
st*>(m_constraint.get()); {
p[0] = hc->getPivotInB().x(); btSliderConstraint const* sc = static_cast<btSliderConstrain
p[1] = hc->getPivotInB().y(); t const*>(m_constraint.get());
p[2] = hc->getPivotInB().z(); const btTransform btxform = sc->getFrameOffsetA().inverse();
*/ } btQuaternion bq = btxform.getRotation();
btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void get_invFrameB(vec3f& p, quatf& r) const
{
btSliderConstraint const* sc = static_cast<btSliderConstrain
t const*>(m_constraint.get());
const btTransform btxform = sc->getFrameOffsetB().inverse();
btQuaternion bq = btxform.getRotation();
btVector3 bp = btxform.getOrigin();
p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void worldToA(vec3f& w, vec3f& p) const
{
btSliderConstraint const* sc = static_cast<btSliderConstrain
t const*>(m_constraint.get());
const btTransform w2a = (sc->getRigidBodyA().getWorldTransfo
rm() * sc->getFrameOffsetA()).inverse();
btVector3 bw(w[0], w[1], w[2]);
btVector3 bp = w2a * bw;
p = vec3f(bp[0], bp[1], bp[2]);
}
virtual void worldFromB(vec3f& p, vec3f& w) const
{
btSliderConstraint const* sc = static_cast<btSliderConstrain
t const*>(m_constraint.get());
const btTransform b2w = sc->getRigidBodyB().getWorldTransfor
m() * sc->getFrameOffsetB();
btVector3 bp(p[0], p[1], p[2]);
btVector3 bw = b2w * bp;
w = vec3f(bw[0], bw[1], bw[2]);
}
virtual void set_world(vec3f const &p) { virtual void set_world(vec3f const &p, quatf const& r) {
/* btSliderConstraint* hc = static_cast<btSliderConstraint*>(m_const btSliderConstraint* sc = static_cast<btSliderConstraint*>(m_constra
raint.get()); int.get());
btVector3 world(p[0], p[1], p[2]); btVector3 worldP(p[0], p[1], p[2]);
btVector3 pivotA = hc->getRigidBodyA().getWorldTransform().i btQuaternion worldR(r[1], r[2], r[3], r[0]);
nverse() (world); btTransform frameAinW(worldR, worldP);
hc->getFrameOffsetA().getOrigin() = pivotA; btTransform frameA = sc->getRigidBodyA().getWorldTransform()
hc->getFrameOffsetB().getOrigin() = world; .inverse() * frameAinW;
*/ // p2pc->buildJacobian(); btTransform frameB = sc->getRigidBodyB().getWorldTransform()
world = p; .inverse() * frameAinW;
sc->getFrameOffsetA() = frameA;
sc->getFrameOffsetB() = frameB;
} }
virtual void get_world(vec3f &p) const { virtual void get_world(vec3f &p, quatf& r) const {
/* btSliderConstraint const* hc = static_cast<btSliderConstraint con btSliderConstraint const* sc = static_cast<btSliderConstraint const
st*>(m_constraint.get()); *>(m_constraint.get());
p[0] = hc->getFrameOffsetB().getOrigin().x(); btTransform frameAinW = sc->getRigidBodyA().getWorldTransfor
p[1] = hc->getFrameOffsetB().getOrigin().y(); m() * sc->getFrameOffsetA();
p[2] = hc->getFrameOffsetB().getOrigin().z(); btQuaternion bq = frameAinW.getRotation();
*/ p = world; btVector3 bp = frameAinW.getOrigin();
} p = vec3f(bp.x(), bp.y(), bp.z());
r = quatf(bq.w(), bq.x(), bq.y(), bq.z());
}
virtual void update_constraint() virtual void update_constraint(rigid_body_impl_t* rb)
{ {
/* btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body btSliderConstraint* sc = static_cast<btSliderConstraint*>(m_
(); constraint.get());
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body() btRigidBody* bt_body = static_cast<bt_rigid_body_t*>(rb)->body();
; btTransform frameW, frameL;
btTransform framInA = btTransform::getIdentity(); if(bt_body == &sc->getRigidBodyA())
btTransform framInB = btTransform::getIdentity(); {
btSliderConstraint* slider = static_cast<btSliderConstraint* frameW = sc->getRigidBodyB().getWorldTransform() * s
>(m_constraint.get()); c->getFrameOffsetB();
slider->getFrameOffsetA(); frameL = sc->getRigidBodyA().getWorldTransform().inv
*/ } erse() * frameW;
sc->getFrameOffsetA() = frameL;
}
else if(bt_body == &sc->getRigidBodyB())
{
frameW = sc->getRigidBodyA().getWorldTransform() * s
c->getFrameOffsetA();
frameL = sc->getRigidBodyB().getWorldTransform().inv
erse() * frameW;
sc->getFrameOffsetB() = frameL;
}
setPivotChanged(true);
}
protected: protected:
friend class bt_solver_t; friend class bt_solver_t;
vec3f world;
bt_slider_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, rig bt_slider_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot, quatf
id_body_impl_t* rbB, vec3f const& pivotB): const& rot):
slider_constraint_impl_t()
{
btRigidBody& bt_body = *static_cast<bt_rigid_body_t*>(rb)->body();
btVector3 p(pivot[0], pivot[1], pivot[2]);
btQuaternion q(rot[1], rot[2], rot[3], rot[0]);
btTransform frameInA(q, p);
btSliderConstraint* slider = new btSliderConstraint(bt_body,
frameInA, false);
m_constraint.reset(slider);
rb->add_constraint(this);
}
bt_slider_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, qua
tf const& rotA, rigid_body_impl_t* rbB, vec3f const& pivotB, quatf const& r
otB):
slider_constraint_impl_t() slider_constraint_impl_t()
{ {
btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body() ; btRigidBody& bt_bodyA = *static_cast<bt_rigid_body_t*>(rbA)->body() ;
btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body() ; btRigidBody& bt_bodyB = *static_cast<bt_rigid_body_t*>(rbB)->body() ;
btTransform framInA = btTransform::getIdentity(); btVector3 pA(pivotA[0], pivotA[1], pivotA[2]);
btTransform framInB = btTransform::getIdentity(); btQuaternion qA(rotA[1], rotA[2], rotA[3], rotA[0]);
btSliderConstraint * slider = new btSliderConstraint(bt_body btTransform frameInA(qA, pA);
A, bt_bodyB, framInA, framInB, true); btVector3 pB(pivotB[0], pivotB[1], pivotB[2]);
m_constraint.reset(slider); btQuaternion qB(rotB[1], rotB[2], rotB[3], rotB[0]);
btTransform frameInB(qB, pB);
btSliderConstraint* slider = new btSliderConstraint(bt_bodyA
, bt_bodyB, frameInA, frameInB, false);
m_constraint.reset(slider);
rbA->add_constraint(this); rbA->add_constraint(this);
rbB->add_constraint(this);
} }
private: private:
}; };
#endif //DYN_BT_SLIDER_CONSTRAINT_H #endif //DYN_BT_SLIDER_CONSTRAINT_H
 End of changes. 11 change blocks. 
63 lines changed or deleted 135 lines changed or added


 bt_solver.h   bt_solver.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
01/27/2010 : Replaced COLLADA export with Bullet binary export
*/ */
//bt_solver.h //bt_solver.h
#ifndef DYN_BT_SOLVER_H #ifndef DYN_BT_SOLVER_H
#define DYN_BT_SOLVER_H #define DYN_BT_SOLVER_H
#include "btBulletCollisionCommon.h" #include "btBulletCollisionCommon.h"
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include "BulletCollision/Gimpact/btGImpactShape.h" #include "BulletCollision/Gimpact/btGImpactShape.h"
skipping to change at line 82 skipping to change at line 86
vec3f const* normals, vec3f const* normals,
unsigned int const *i ndices, size_t num_indices) unsigned int const *i ndices, size_t num_indices)
{ {
return new bt_mesh_shape_t(vertices, num_vertices, normals, indices , num_indices); return new bt_mesh_shape_t(vertices, num_vertices, normals, indices , num_indices);
} }
virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_ t* rb, vec3f const& pivot) virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_ t* rb, vec3f const& pivot)
{ {
return new bt_nail_constraint_t(rb, pivot); return new bt_nail_constraint_t(rb, pivot);
} }
virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_imp l_t* rb, vec3f const& pivot) virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_ t* rbA, rigid_body_impl_t* rbB, vec3f const& pivotInA, vec3f const& pivotIn B)
{ {
return new bt_hinge_constraint_t(rb, pivot); return new bt_nail_constraint_t(rbA, rbB, pivotInA, pivotInB);
} }
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_i mpl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivot B) virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_imp l_t* rb, vec3f const& pivot, quatf const& rot)
{ {
return new bt_slider_constraint_t(rbA, pivotA, rbB, pivotB); return new bt_hinge_constraint_t(rb, pivot, rot);
} }
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_i mpl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivot B) virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_imp l_t* rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_impl_t* rbB, v ec3f const& pivotB, quatf const& rotB)
{ {
return new bt_sixdof_constraint_t(rbA, pivotA, rbB, pivotB); return new bt_hinge_constraint_t(rbA, pivotA, rotA, rbB, pivotB, ro
tB);
}
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_i
mpl_t* rb, vec3f const& pivot, quatf const& rot)
{
return new bt_slider_constraint_t(rb, pivot, rot);
}
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_i
mpl_t* rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_impl_t* rbB,
vec3f const& pivotB, quatf const& rotB)
{
return new bt_slider_constraint_t(rbA, pivotA, rotA, rbB, pivotB, r
otB);
}
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_i
mpl_t* rb, vec3f const& pivot, quatf const& rot)
{
return new bt_sixdof_constraint_t(rb, pivot, rot);
}
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_i
mpl_t* rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_impl_t* rbB,
vec3f const& pivotB, quatf const& rotB)
{
return new bt_sixdof_constraint_t(rbA, pivotA, rotA, rbB, pivotB, r
otB);
} }
virtual void add_rigid_body(rigid_body_impl_t* rb) virtual void add_rigid_body(rigid_body_impl_t* rb)
{ {
bt_rigid_body_t* bt_body = static_cast<bt_rigid_body_t*>(rb); bt_rigid_body_t* bt_body = static_cast<bt_rigid_body_t*>(rb);
bt_body->body()->setActivationState(DISABLE_DEACTIVATION);
m_dynamicsWorld->addRigidBody(bt_body->body()); m_dynamicsWorld->addRigidBody(bt_body->body());
} }
virtual void remove_rigid_body(rigid_body_impl_t* rb) virtual void remove_rigid_body(rigid_body_impl_t* rb)
{ {
bt_rigid_body_t* bt_body = static_cast<bt_rigid_body_t*>(rb); bt_rigid_body_t* bt_body = static_cast<bt_rigid_body_t*>(rb);
m_dynamicsWorld->removeRigidBody(bt_body->body()); m_dynamicsWorld->removeRigidBody(bt_body->body());
} }
virtual void add_constraint(constraint_impl_t* c) virtual void add_constraint(constraint_impl_t* c)
{ {
bt_constraint_t* btc = dynamic_cast<bt_constraint_t*>(c); bt_constraint_t* btc = dynamic_cast<bt_constraint_t*>(c);
m_dynamicsWorld->addConstraint(btc->constraint()); m_dynamicsWorld->addConstraint(btc->constraint(), true);
} }
virtual void remove_constraint(constraint_impl_t* c) virtual void remove_constraint(constraint_impl_t* c)
{ {
bt_constraint_t* btc = dynamic_cast<bt_constraint_t*>(c); bt_constraint_t* btc = dynamic_cast<bt_constraint_t*>(c);
m_dynamicsWorld->removeConstraint(btc->constraint()); m_dynamicsWorld->removeConstraint(btc->constraint());
} }
virtual void set_gravity(vec3f const& g) virtual void set_gravity(vec3f const& g)
{ {
m_dynamicsWorld->setGravity(btVector3(g[0], g[1], g[2])); m_dynamicsWorld->setGravity(btVector3(g[0], g[1], g[2]));
} }
virtual void set_split_impulse(bool enabled) virtual void set_split_impulse(bool enabled)
{ {
m_dynamicsWorld->getSolverInfo().m_splitImpulse = enabled; m_dynamicsWorld->getSolverInfo().m_splitImpulse = enabled;
} }
virtual void step_simulation(float dt) virtual void step_simulation(float dt)
{ {
m_dynamicsWorld->stepSimulation(dt, 1000, 1.0 / 120.0); m_dynamicsWorld->stepSimulation(dt, 1000, 1.0f / 120.0f);
} }
virtual void export_collada_file(const char* fileName); virtual void debug_draw(int dbgMode);
virtual void import_collada_file(const char* filename); virtual void export_bullet_file(const char* fileName);
virtual void import_bullet_file(const char* filename);
protected: protected:
friend class solver_t; friend class solver_t;
bt_solver_t(); bt_solver_t();
private: private:
shared_ptr<btBroadphaseInterface> m_broadphase; shared_ptr<btBroadphaseInterface> m_broadphase;
shared_ptr<btConstraintSolver> m_solver; shared_ptr<btConstraintSolver> m_solver;
shared_ptr<btDefaultCollisionConfiguration> m_collisionConfiguration; shared_ptr<btDefaultCollisionConfiguration> m_collisionConfiguration;
 End of changes. 12 change blocks. 
10 lines changed or deleted 42 lines changed or added


 bt_sphere_shape.h   bt_sphere_shape.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
12/24/2009 : Nail constraint improvements
*/ */
//bt_sphere_shape.h //bt_sphere_shape.h
#ifndef DYN_BT_SPHERE_SHAPE_H #ifndef DYN_BT_SPHERE_SHAPE_H
#define DYN_BT_SPHERE_SHAPE_H #define DYN_BT_SPHERE_SHAPE_H
#ifdef WIN32//for glut.h #ifdef WIN32//for glut.h
#include <windows.h> #include <windows.h>
#endif #endif
skipping to change at line 90 skipping to change at line 94
{ {
set_shape(new btSphereShape(radius)); set_shape(new btSphereShape(radius));
// shape()->setMargin(0.1); // shape()->setMargin(0.1);
update(); update();
} }
void update() void update()
{ {
btSphereShape *sphere_shape = static_cast<btSphereShape*>(shape()); btSphereShape *sphere_shape = static_cast<btSphereShape*>(shape());
float radius = sphere_shape->getRadius(); float radius = sphere_shape->getRadius();
m_volume = (4.0 * 3.1415926 * radius * radius * radius) / 3.0; m_volume = (4.0f * 3.1415926f * radius * radius * radius) / 3.0f;
m_center = vec3f(0, 0, 0); m_center = vec3f(0, 0, 0);
m_rotation = qidentity<float>(); m_rotation = qidentity<float>();
m_local_inertia = vec3f(2.0 / 5.0 * radius * radius, m_local_inertia = vec3f(2.0f / 5.0f * radius * radius,
2.0 / 5.0 * radius * radius, 2.0f / 5.0f * radius * radius,
2.0 / 5.0 * radius * radius); 2.0f / 5.0f * radius * radius);
} }
private: private:
float m_volume; float m_volume;
vec3f m_center; vec3f m_center;
quatf m_rotation; quatf m_rotation;
vec3f m_local_inertia; vec3f m_local_inertia;
}; };
 End of changes. 3 change blocks. 
4 lines changed or deleted 8 lines changed or added


 cl_platform.h   cl_platform.h 
skipping to change at line 27 skipping to change at line 27
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
************************************************************************** ********/ ************************************************************************** ********/
#ifndef __CL_PLATFORM_H #ifndef __CL_PLATFORM_H
#define __CL_PLATFORM_H #define __CL_PLATFORM_H
#define CL_PLATFORM_MINI_CL 0x12345
struct MiniCLKernelDesc
{
MiniCLKernelDesc(void* pCode, char* pName);
};
#define MINICL_REGISTER(__kernel_func) static MiniCLKernelDesc __kernel_fun
c##Desc((void*)__kernel_func, #__kernel_func);
#ifdef __APPLE__ #ifdef __APPLE__
/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER belo w */ /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER belo w */
#include <AvailabilityMacros.h> #include <AvailabilityMacros.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define CL_API_ENTRY #define CL_API_ENTRY
#define CL_API_CALL #define CL_API_CALL
#ifdef __APPLE__ #ifdef __APPLE__
#define CL_API_SUFFIX__VERSION_1_0 // AVAILABLE_MAC_OS_X_VERSION_10_6_AND_ LATER #define CL_API_SUFFIX__VERSION_1_0 // AVAILABLE_MAC_OS_X_VERSION_10_6_AND_ LATER
#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
#else #else
#define CL_API_SUFFIX__VERSION_1_0 #define CL_API_SUFFIX__VERSION_1_0
#define CL_EXTENSION_WEAK_LINK #define CL_EXTENSION_WEAK_LINK
#endif #endif
#ifdef WIN32 #if defined (_WIN32) && ! defined (__MINGW32__)
typedef signed __int8 int8_t; typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t; typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t; typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t; typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t; typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t; typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
typedef int8_t cl_char; typedef int8_t cl_char;
 End of changes. 2 change blocks. 
1 lines changed or deleted 11 lines changed or added


 constraint.h   constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//constraint.h //constraint.h
#ifndef DYN_CONSTRAINT_H #ifndef DYN_CONSTRAINT_H
#define DYN_CONSTRAINT_H #define DYN_CONSTRAINT_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "constraint_impl.h" #include "constraint_impl.h"
class constraint_t class constraint_t
{ {
public: public:
//typedefs //typedefs
typedef shared_ptr<constraint_t> pointer; typedef shared_ptr<constraint_t> pointer;
public: public:
virtual ~constraint_t() {} virtual ~constraint_t() {}
bool getPivotChanged()
{
constraint_impl_t* constr_impl = dynamic_cast<constraint_impl_t*>(i
mpl());
return constr_impl->getPivotChanged();
}
void setPivotChanged(bool isChanged)
{
constraint_impl_t* constr_impl = dynamic_cast<constraint_impl_t*>(i
mpl());
return constr_impl->setPivotChanged(isChanged);
}
constraint_impl_t* pubImpl() { return m_impl.get(); }
protected: protected:
friend class solver_t; friend class solver_t;
constraint_t(constraint_impl_t* impl): m_impl(impl) { } constraint_t(constraint_impl_t* impl): m_impl(impl) { }
constraint_impl_t* impl() { return m_impl.get(); } constraint_impl_t* impl() { return m_impl.get(); }
constraint_impl_t const* impl() const { return m_impl.get(); } constraint_impl_t const* impl() const { return m_impl.get(); }
protected: protected:
shared_ptr<constraint_impl_t> m_impl; shared_ptr<constraint_impl_t> m_impl;
 End of changes. 2 change blocks. 
0 lines changed or deleted 17 lines changed or added


 constraint_impl.h   constraint_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//constraint_impl.h //constraint_impl.h
#ifndef DYN_CONSTRAINT_IMPL_H #ifndef DYN_CONSTRAINT_IMPL_H
#define DYN_CONSTRAINT_IMPL_H #define DYN_CONSTRAINT_IMPL_H
class constraint_impl_t class constraint_impl_t
{ {
public: public:
// //
public: public:
virtual ~constraint_impl_t() {}; virtual ~constraint_impl_t() {};
bool getPivotChanged() { return m_pivotChanged; }
void setPivotChanged(bool isChanged) { m_pivotChanged = isChanged; }
protected:
bool m_pivotChanged;
}; };
#endif #endif
 End of changes. 2 change blocks. 
0 lines changed or deleted 7 lines changed or added


 dSolverCmd.h   dSolverCmd.h 
skipping to change at line 52 skipping to change at line 52
MStatus doIt(const MArgList &i_mArgList); MStatus doIt(const MArgList &i_mArgList);
MStatus redoIt(); MStatus redoIt();
MStatus undoIt(); MStatus undoIt();
bool isUndoable() const { return true; } bool isUndoable() const { return true; }
bool hasSyntax() const { return true; } bool hasSyntax() const { return true; }
static MString typeName; static MString typeName;
protected: protected:
MArgDatabase *m_argDatabase; MArgDatabase *m_argDatabase;
MDGModifier *m_dgModifier; MDagModifier *m_dgModifier;
// MDGModifier *m_dgModifier;
}; };
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 2 lines changed or added


 dSolverNode.h   dSolverNode.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//dSolverNode.h //dSolverNode.h
#ifndef DYN_DSOLVERNODE_H #ifndef DYN_DSOLVERNODE_H
#define DYN_DSOLVERNODE_H #define DYN_DSOLVERNODE_H
#include <maya/MString.h> #include <maya/MString.h>
#include <maya/MTypeId.h> #include <maya/MTypeId.h>
#include <maya/MPxNode.h> #include <maya/MPxNode.h>
#include <maya/MPxLocatorNode.h>
#include <maya/MTime.h> #include <maya/MTime.h>
#include <vector> #include <vector>
#include "mathUtils.h" #include "mathUtils.h"
class dSolverNode : public MPxNode //class dSolverNode : public MPxNode
class dSolverNode : public MPxLocatorNode
{ {
public: public:
dSolverNode(); dSolverNode();
virtual ~dSolverNode(); virtual ~dSolverNode();
virtual void postConstructor(); virtual void postConstructor();
virtual void draw( M3dView & view, const MDagPath & path,
M3dView::DisplayStyl
e style,
M3dView::DisplayStat
us status );
virtual bool isBounded() const {
return false;
}
virtual MBoundingBox boundingBox() const
{
MObject node = thisMObject();
MPoint corner1(-1, -1, -1);
MPoint corner2(1, 1, 1);
return MBoundingBox(corner1, corner2);
}
virtual bool excludeAsLocator() const {
return false;
}
virtual bool isTransparent() const {
return false;
}
static void * creator(); static void * creator();
static MStatus initialize(); static MStatus initialize();
virtual bool setInternalValueInContext ( const MPlug & plug, const MD ataHandle & dataHandle, MDGContext & ctx ); virtual bool setInternalValueInContext ( const MPlug & plug, const MD ataHandle & dataHandle, MDGContext & ctx );
virtual MStatus compute( const MPlug& plug, MDataBlock& data ); virtual MStatus compute( const MPlug& plug, MDataBlock& data );
static MObject ia_time; static MObject ia_time;
static MObject ia_startTime; static MObject ia_startTime;
static MObject ia_gravity; static MObject ia_gravity;
static MObject ia_enabled; static MObject ia_enabled;
static MObject ia_splitImpulse; static MObject ia_splitImpulse;
static MObject ia_substeps; static MObject ia_substeps;
static MObject oa_rigidBodies; static MObject oa_rigidBodies;
//Solver Settings //Solver Settings
static MObject ssSolverType; static MObject ssSolverType;
//
static MObject ia_DBG_DrawWireframe;
static MObject ia_DBG_DrawAabb;
static MObject ia_DBG_DrawFeaturesText;
static MObject ia_DBG_DrawContactPoints;
static MObject ia_DBG_NoDeactivation;
static MObject ia_DBG_NoHelpText;
static MObject ia_DBG_DrawText;
static MObject ia_DBG_ProfileTimings;
static MObject ia_DBG_EnableSatComparison;
static MObject ia_DBG_DisableBulletLCP;
static MObject ia_DBG_EnableCCD;
static MObject ia_DBG_DrawConstraints;
static MObject ia_DBG_DrawConstraintLimits;
static MObject ia_DBG_FastWireframe;
// //
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
static bool isStartTime;
static void updateAllRigidBodies();
protected: protected:
struct xforms_t { struct xforms_t {
vec3f m_x0; vec3f m_x0;
vec3f m_x1; vec3f m_x1;
quatf m_q0; quatf m_q0;
quatf m_q1; quatf m_q1;
}; };
void computeRigidBodies(const MPlug& plug, MDataBlock& data); void computeRigidBodies(const MPlug& plug, MDataBlock& data);
void dumpRigidBodyArray(MObject &node); void dumpRigidBodyArray(MObject &node);
bool expandFileExpression(std::string const& expr, std::string &base_na me, std::string &extension); bool expandFileExpression(std::string const& expr, std::string &base_na me, std::string &extension);
void initRigidBodies(MPlugArray &rbConnections); void initRigidBodies(MPlugArray &rbConnections);
void gatherPassiveTransforms(MPlugArray &rbConnections, std::vector<xfo rms_t> &xforms); void gatherPassiveTransforms(MPlugArray &rbConnections, std::vector<xfo rms_t> &xforms);
void updatePassiveRigidBodies(MPlugArray &rbConnections, std::vector<xf orms_t> &xforms, float t); void updatePassiveRigidBodies(MPlugArray &rbConnections, std::vector<xf orms_t> &xforms, float t);
void updateActiveRigidBodies(MPlugArray &rbConnections); void updateActiveRigidBodies(MPlugArray &rbConnections);
void applyFields(MPlugArray &rbConnections, float dt); void applyFields(MPlugArray &rbConnections, float dt);
void updateConstraint(MObject& bodyNode);
protected: protected:
MTime m_prevTime; MTime m_prevTime;
}; };
#endif #endif
 End of changes. 7 change blocks. 
2 lines changed or deleted 49 lines changed or added


 float_math.h   float_math.h 
#ifndef FLOAT_MATH_H #ifndef FLOAT_MATH_H
#define FLOAT_MATH_H #define FLOAT_MATH_H
#ifdef WIN32 #ifdef _WIN32
#pragma warning(disable : 4324) // disable padding warning #pragma warning(disable : 4324) // disable padding warning
#pragma warning(disable : 4244) // disable padding warning #pragma warning(disable : 4244) // disable padding warning
#pragma warning(disable : 4267) // possible loss of data #pragma warning(disable : 4267) // possible loss of data
#pragma warning(disable:4530) // Disable the exception disable but u sed in MSCV Stl warning. #pragma warning(disable:4530) // Disable the exception disable but u sed in MSCV Stl warning.
#pragma warning(disable:4996) //Turn off warnings about deprecated C routines #pragma warning(disable:4996) //Turn off warnings about deprecated C routines
#pragma warning(disable:4786) // Disable the "debug name too long" w arning #pragma warning(disable:4786) // Disable the "debug name too long" w arning
#endif #endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Copyright (c) 2004 Open Dynamics Framework Group Copyright (c) 2004 Open Dynamics Framework Group
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 gim_box_set.h   gim_box_set.h 
skipping to change at line 90 skipping to change at line 90
//! Prototype Base class for primitive classification //! Prototype Base class for primitive classification
/*! /*!
This class is a wrapper for primitive collections. This class is a wrapper for primitive collections.
This tells relevant info for the Bounding Box set classes, which take care of space classification. This tells relevant info for the Bounding Box set classes, which take care of space classification.
This class can manage Compound shapes and trimeshes, and if it is managing trimesh then the Hierarchy Bounding Box classes will take advantage of pri mitive Vs Box overlapping tests for getting optimal results and less Per Bo x compairisons. This class can manage Compound shapes and trimeshes, and if it is managing trimesh then the Hierarchy Bounding Box classes will take advantage of pri mitive Vs Box overlapping tests for getting optimal results and less Per Bo x compairisons.
*/ */
class GIM_PRIMITIVE_MANAGER_PROTOTYPE class GIM_PRIMITIVE_MANAGER_PROTOTYPE
{ {
public: public:
virtual ~GIM_PRIMITIVE_MANAGER_PROTOTYPE() {}
//! determines if this manager consist on only triangles, which spec ial case will be optimized //! determines if this manager consist on only triangles, which spec ial case will be optimized
virtual bool is_trimesh() = 0; virtual bool is_trimesh() = 0;
virtual GUINT get_primitive_count() = 0; virtual GUINT get_primitive_count() = 0;
virtual void get_primitive_box(GUINT prim_index ,GIM_AABB & primbox) = 0; virtual void get_primitive_box(GUINT prim_index ,GIM_AABB & primbox) = 0;
virtual void get_primitive_triangle(GUINT prim_index,GIM_TRIANGLE & triangle) = 0; virtual void get_primitive_triangle(GUINT prim_index,GIM_TRIANGLE & triangle) = 0;
}; };
struct GIM_AABB_DATA struct GIM_AABB_DATA
{ {
GIM_AABB m_bound; GIM_AABB m_bound;
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 gim_memory.h   gim_memory.h 
skipping to change at line 111 skipping to change at line 111
gim_alloca_function *gim_get_alloca_handler(void); gim_alloca_function *gim_get_alloca_handler(void);
gim_realloc_function *gim_get_realloc_handler (void); gim_realloc_function *gim_get_realloc_handler (void);
gim_free_function *gim_get_free_handler (void); gim_free_function *gim_get_free_handler (void);
///Standar Memory functions ///Standar Memory functions
void * gim_alloc(size_t size); void * gim_alloc(size_t size);
void * gim_alloca(size_t size); void * gim_alloca(size_t size);
void * gim_realloc(void *ptr, size_t oldsize, size_t newsize); void * gim_realloc(void *ptr, size_t oldsize, size_t newsize);
void gim_free(void *ptr); void gim_free(void *ptr);
#if defined (WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) #if defined (_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
#define GIM_SIMD_MEMORY 1 #define GIM_SIMD_MEMORY 1
#endif #endif
//! SIMD POINTER INTEGER //! SIMD POINTER INTEGER
#define SIMD_T GUINT64 #define SIMD_T GUINT64
//! SIMD INTEGER SIZE //! SIMD INTEGER SIZE
#define SIMD_T_SIZE sizeof(SIMD_T) #define SIMD_T_SIZE sizeof(SIMD_T)
inline void gim_simd_memcpy(void * dst, const void * src, size_t copysize) inline void gim_simd_memcpy(void * dst, const void * src, size_t copysize)
{ {
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 glut.h   glut.h 
#ifndef __GLUT_H__ #ifndef __glut_h__
#define __GLUT_H__ #define __glut_h__
/* /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998, 2000, 2006. */
* glut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI
TY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHE
THER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR
E.
*/
#include "freeglut_std.h" /* This program is freely distributable without licensing fees and is
provided without guarantee or warrantee expressed or implied. This
program is -not- in the public domain. */
/*** END OF FILE ***/ #if defined(_WIN32) || defined(__CYGWIN__)
#endif /* __GLUT_H__ */ /* GLUT 3.7 now tries to avoid including <windows.h>
to avoid name space pollution, but Win32's <GL/gl.h>
needs APIENTRY and WINGDIAPI defined properly. */
# if 0
/* This would put tons of macros and crap in our clean name space. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# else
/* XXX This is from Win32's <windef.h> */
# ifndef APIENTRY
# define GLUT_APIENTRY_DEFINED
/* Cygwin and MingW32 are two free GNU-based Open Source compilation
environments for Win32. Note that __CYGWIN32__ is deprecated
in favor of simply __CYGWIN__. */
# if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
# if defined(__CYGWIN__)
# define APIENTRY __stdcall
# else
# ifdef i386
# define APIENTRY __attribute__((stdcall))
# else
# define APIENTRY
# endif
# endif
# else
# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
# define APIENTRY __stdcall
# else
# define APIENTRY
# endif
# endif
# endif
/* XXX This is from Win32's <winnt.h> */
# ifndef CALLBACK
# if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
# ifndef __stdcall
# define __stdcall __attribute__((stdcall))
# endif
# define CALLBACK __stdcall
# else
# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
# define CALLBACK __stdcall
# else
# define CALLBACK
# endif
# endif
# endif
/* XXX This is from Win32's <wingdi.h> and <winnt.h> */
# ifndef WINGDIAPI
# define GLUT_WINGDIAPI_DEFINED
# if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
# define WINGDIAPI
# else
# define WINGDIAPI __declspec(dllimport)
# endif
# endif
# if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
/* Rely on Cygwin32/MingW32 <stddef.h> to set wchar_t. */
/* XXX Warning. The Cygwin32/MingW32 definition for wchar_t
is an "int" instead of the "short" used by Windows. */
# include <stddef.h>
# else
/* XXX This is from Win32's <ctype.h> */
# ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
# define _WCHAR_T_DEFINED
# endif
# endif
# endif
/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
in your compile preprocessor options (Microsoft Visual C only). */
# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) && defined
(_MSC_VER)
# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia l
ib */
# pragma comment (lib, "user32.lib") /* link with Windows User lib */
# pragma comment (lib, "gdi32.lib") /* link with Windows GDI lib */
/* To enable automatic SGI OpenGL for Windows library usage for GLUT,
define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
# ifdef GLUT_USE_SGI_OPENGL
# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows
lib */
# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib
*/
# if defined(GLUT_STATIC_LIB)
# pragma comment (lib, "glutstatic.lib") /* link with static Win32 GLU
T lib */
# else
# pragma comment (lib, "glut.lib") /* link with Win32 GLUT lib */
# endif
# else
# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib
*/
# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Util
ity lib */
# if defined(GLUT_STATIC_LIB)
# pragma comment (lib, "glutstatic.lib") /* link with static Win32 GLU
T lib */
# else
# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
# endif
# endif
# endif
/* To disable supression of annoying warnings about floats being promoted
to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
options. */
# if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warn
ings. */
# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
# endif
/* Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* XXX This is from Win32's <process.h> */
# if !defined(_MSC_VER) && !defined(__cdecl)
/* Define __cdecl for non-Microsoft compilers. */
# define __cdecl
# define GLUT_DEFINED___CDECL
# endif
# ifndef _CRTIMP
# ifdef _NTSDK
/* Definition compatible with NT SDK */
# define _CRTIMP
# else
/* Current definition */
# ifdef _DLL
# define _CRTIMP __declspec(dllimport)
# else
# define _CRTIMP
# endif
# endif
# define GLUT_DEFINED__CRTIMP
# endif
/* GLUT API entry point declarations for Win32. */
# ifdef GLUT_BUILDING_LIB
/* MSDN article 835326 says "When you build a DLL by using the 64-bit
version of the Microsoft Visual C++ Compiler and Linker, you may
receive Linker error number LNK4197 if a function has been declared
for export more than one time." GLUT builds with glut.def that
declares GLUT's EXPORTS list so do not use __declspec(dllexport)
to keep 64-bit compiler happy. */
# define GLUTAPI /*__declspec(dllexport)*/
# else
# ifdef _DLL
# define GLUTAPI __declspec(dllimport)
# else
# define GLUTAPI extern
# endif
# endif
/* GLUT callback calling convention for Win32. */
# define GLUTCALLBACK __cdecl
# if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTE
D) || defined(__CYGWIN32__)
# define GLUTAPIENTRY __stdcall
# else
# define GLUTAPIENTRY
# endif
#endif /* _WIN32 */
#include <GL/gl.h>
#include <GL/glu.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32) || defined(__CYGWIN__)
# ifndef GLUT_BUILDING_LIB
# if __BORLANDC__
# if defined(_BUILDRTLDLL)
void __cdecl __export exit(int __status);
# else
void __cdecl exit(int __status);
# endif
# else
# if _MSC_VER >= 1200
extern _CRTIMP __declspec(noreturn) void __cdecl exit(int);
# else
extern _CRTIMP void __cdecl exit(int);
# endif
# endif
# endif
#else
/* non-Win32 case. */
/* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */
# define APIENTRY
# define GLUT_APIENTRY_DEFINED
# define CALLBACK
/* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */
# define GLUTAPI extern
# define GLUTAPIENTRY
# define GLUTCALLBACK
/* Prototype exit for the non-Win32 case (see above). */
# ifdef __GNUC__
extern void exit(int __status) __attribute__((__noreturn__));
# else
extern void exit(int);
# endif
#endif
/**
GLUT API revision history:
GLUT_API_VERSION is updated to reflect incompatible GLUT
API changes (interface changes, semantic changes, deletions,
or additions).
GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
extension. Supports new input devices like tablet, dial and button
box, and Spaceball. Easy to query OpenGL extensions.
GLUT_API_VERSION=3 glutMenuStatus added.
GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
glutJoystickFunc, glutForceJoystickFunc, glutStrokeWidthf,
glutStrokeLengthf (NOT FINALIZED!).
**/
#ifndef GLUT_API_VERSION /* allow this to be overriden */
#define GLUT_API_VERSION 3
#endif
/**
GLUT implementation revision history:
GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
API revisions and implementation revisions (ie, bug fixes).
GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
GLUT Xlib-based implementation. 11/29/94
GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
GLUT Xlib-based implementation providing GLUT version 2
interfaces.
GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
and video resize. 1/3/97
GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routin
es.
GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routi
nes + signal handling.
GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interfac
e.
GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut
.h>
GLUT_XLIB_IMPLEMENTATION=16 mjk's early GLUT 3.8
GLUT_XLIB_IMPLEMENTATION=17 mjk's GLUT 3.8 with glutStrokeWidthf and glutS
trokeLengthf
**/
#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
#define GLUT_XLIB_IMPLEMENTATION 17
#endif
/* Display mode bit masks. */
#define GLUT_RGB 0
#define GLUT_RGBA GLUT_RGB
#define GLUT_INDEX 1
#define GLUT_SINGLE 0
#define GLUT_DOUBLE 2
#define GLUT_ACCUM 4
#define GLUT_ALPHA 8
#define GLUT_DEPTH 16
#define GLUT_STENCIL 32
#if (GLUT_API_VERSION >= 2)
#define GLUT_MULTISAMPLE 128
#define GLUT_STEREO 256
#endif
#if (GLUT_API_VERSION >= 3)
#define GLUT_LUMINANCE 512
#endif
/* Mouse buttons. */
#define GLUT_LEFT_BUTTON 0
#define GLUT_MIDDLE_BUTTON 1
#define GLUT_RIGHT_BUTTON 2
/* Mouse button state. */
#define GLUT_DOWN 0
#define GLUT_UP 1
#if (GLUT_API_VERSION >= 2)
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
#define GLUT_KEY_F3 3
#define GLUT_KEY_F4 4
#define GLUT_KEY_F5 5
#define GLUT_KEY_F6 6
#define GLUT_KEY_F7 7
#define GLUT_KEY_F8 8
#define GLUT_KEY_F9 9
#define GLUT_KEY_F10 10
#define GLUT_KEY_F11 11
#define GLUT_KEY_F12 12
/* directional keys */
#define GLUT_KEY_LEFT 100
#define GLUT_KEY_UP 101
#define GLUT_KEY_RIGHT 102
#define GLUT_KEY_DOWN 103
#define GLUT_KEY_PAGE_UP 104
#define GLUT_KEY_PAGE_DOWN 105
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
#endif
/* Entry/exit state. */
#define GLUT_LEFT 0
#define GLUT_ENTERED 1
/* Menu usage state. */
#define GLUT_MENU_NOT_IN_USE 0
#define GLUT_MENU_IN_USE 1
/* Visibility state. */
#define GLUT_NOT_VISIBLE 0
#define GLUT_VISIBLE 1
/* Window status state. */
#define GLUT_HIDDEN 0
#define GLUT_FULLY_RETAINED 1
#define GLUT_PARTIALLY_RETAINED 2
#define GLUT_FULLY_COVERED 3
/* Color index component selection values. */
#define GLUT_RED 0
#define GLUT_GREEN 1
#define GLUT_BLUE 2
#ifdef _WIN32
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN ((void*)0)
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 ((void*)2)
#define GLUT_BITMAP_8_BY_13 ((void*)3)
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
#endif
#else
/* Stroke font opaque addresses (use constants instead in source code). */
GLUTAPI void *glutStrokeRoman;
GLUTAPI void *glutStrokeMonoRoman;
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
/* Bitmap font opaque addresses (use constants instead in source code). */
GLUTAPI void *glutBitmap9By15;
GLUTAPI void *glutBitmap8By13;
GLUTAPI void *glutBitmapTimesRoman10;
GLUTAPI void *glutBitmapTimesRoman24;
GLUTAPI void *glutBitmapHelvetica10;
GLUTAPI void *glutBitmapHelvetica12;
GLUTAPI void *glutBitmapHelvetica18;
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
#endif
#endif
/* glutGet parameters. */
#define GLUT_WINDOW_X ((GLenum) 100)
#define GLUT_WINDOW_Y ((GLenum) 101)
#define GLUT_WINDOW_WIDTH ((GLenum) 102)
#define GLUT_WINDOW_HEIGHT ((GLenum) 103)
#define GLUT_WINDOW_BUFFER_SIZE ((GLenum) 104)
#define GLUT_WINDOW_STENCIL_SIZE ((GLenum) 105)
#define GLUT_WINDOW_DEPTH_SIZE ((GLenum) 106)
#define GLUT_WINDOW_RED_SIZE ((GLenum) 107)
#define GLUT_WINDOW_GREEN_SIZE ((GLenum) 108)
#define GLUT_WINDOW_BLUE_SIZE ((GLenum) 109)
#define GLUT_WINDOW_ALPHA_SIZE ((GLenum) 110)
#define GLUT_WINDOW_ACCUM_RED_SIZE ((GLenum) 111)
#define GLUT_WINDOW_ACCUM_GREEN_SIZE ((GLenum) 112)
#define GLUT_WINDOW_ACCUM_BLUE_SIZE ((GLenum) 113)
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE ((GLenum) 114)
#define GLUT_WINDOW_DOUBLEBUFFER ((GLenum) 115)
#define GLUT_WINDOW_RGBA ((GLenum) 116)
#define GLUT_WINDOW_PARENT ((GLenum) 117)
#define GLUT_WINDOW_NUM_CHILDREN ((GLenum) 118)
#define GLUT_WINDOW_COLORMAP_SIZE ((GLenum) 119)
#if (GLUT_API_VERSION >= 2)
#define GLUT_WINDOW_NUM_SAMPLES ((GLenum) 120)
#define GLUT_WINDOW_STEREO ((GLenum) 121)
#endif
#if (GLUT_API_VERSION >= 3)
#define GLUT_WINDOW_CURSOR ((GLenum) 122)
#endif
#define GLUT_SCREEN_WIDTH ((GLenum) 200)
#define GLUT_SCREEN_HEIGHT ((GLenum) 201)
#define GLUT_SCREEN_WIDTH_MM ((GLenum) 202)
#define GLUT_SCREEN_HEIGHT_MM ((GLenum) 203)
#define GLUT_MENU_NUM_ITEMS ((GLenum) 300)
#define GLUT_DISPLAY_MODE_POSSIBLE ((GLenum) 400)
#define GLUT_INIT_WINDOW_X ((GLenum) 500)
#define GLUT_INIT_WINDOW_Y ((GLenum) 501)
#define GLUT_INIT_WINDOW_WIDTH ((GLenum) 502)
#define GLUT_INIT_WINDOW_HEIGHT ((GLenum) 503)
#define GLUT_INIT_DISPLAY_MODE ((GLenum) 504)
#if (GLUT_API_VERSION >= 2)
#define GLUT_ELAPSED_TIME ((GLenum) 700)
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
#define GLUT_WINDOW_FORMAT_ID ((GLenum) 123)
#endif
#if (GLUT_API_VERSION >= 2)
/* glutDeviceGet parameters. */
#define GLUT_HAS_KEYBOARD ((GLenum) 600)
#define GLUT_HAS_MOUSE ((GLenum) 601)
#define GLUT_HAS_SPACEBALL ((GLenum) 602)
#define GLUT_HAS_DIAL_AND_BUTTON_BOX ((GLenum) 603)
#define GLUT_HAS_TABLET ((GLenum) 604)
#define GLUT_NUM_MOUSE_BUTTONS ((GLenum) 605)
#define GLUT_NUM_SPACEBALL_BUTTONS ((GLenum) 606)
#define GLUT_NUM_BUTTON_BOX_BUTTONS ((GLenum) 607)
#define GLUT_NUM_DIALS ((GLenum) 608)
#define GLUT_NUM_TABLET_BUTTONS ((GLenum) 609)
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
#define GLUT_DEVICE_IGNORE_KEY_REPEAT ((GLenum) 610)
#define GLUT_DEVICE_KEY_REPEAT ((GLenum) 611)
#define GLUT_HAS_JOYSTICK ((GLenum) 612)
#define GLUT_OWNS_JOYSTICK ((GLenum) 613)
#define GLUT_JOYSTICK_BUTTONS ((GLenum) 614)
#define GLUT_JOYSTICK_AXES ((GLenum) 615)
#define GLUT_JOYSTICK_POLL_RATE ((GLenum) 616)
#endif
#if (GLUT_API_VERSION >= 3)
/* glutLayerGet parameters. */
#define GLUT_OVERLAY_POSSIBLE ((GLenum) 800)
#define GLUT_LAYER_IN_USE ((GLenum) 801)
#define GLUT_HAS_OVERLAY ((GLenum) 802)
#define GLUT_TRANSPARENT_INDEX ((GLenum) 803)
#define GLUT_NORMAL_DAMAGED ((GLenum) 804)
#define GLUT_OVERLAY_DAMAGED ((GLenum) 805)
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
/* glutVideoResizeGet parameters. */
#define GLUT_VIDEO_RESIZE_POSSIBLE ((GLenum) 900)
#define GLUT_VIDEO_RESIZE_IN_USE ((GLenum) 901)
#define GLUT_VIDEO_RESIZE_X_DELTA ((GLenum) 902)
#define GLUT_VIDEO_RESIZE_Y_DELTA ((GLenum) 903)
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA ((GLenum) 904)
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA ((GLenum) 905)
#define GLUT_VIDEO_RESIZE_X ((GLenum) 906)
#define GLUT_VIDEO_RESIZE_Y ((GLenum) 907)
#define GLUT_VIDEO_RESIZE_WIDTH ((GLenum) 908)
#define GLUT_VIDEO_RESIZE_HEIGHT ((GLenum) 909)
#endif
/* glutUseLayer parameters. */
#define GLUT_NORMAL ((GLenum) 0)
#define GLUT_OVERLAY ((GLenum) 1)
/* glutGetModifiers return mask. */
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 2
#define GLUT_ACTIVE_ALT 4
/* glutSetCursor parameters. */
/* Basic arrows. */
#define GLUT_CURSOR_RIGHT_ARROW 0
#define GLUT_CURSOR_LEFT_ARROW 1
/* Symbolic cursor shapes. */
#define GLUT_CURSOR_INFO 2
#define GLUT_CURSOR_DESTROY 3
#define GLUT_CURSOR_HELP 4
#define GLUT_CURSOR_CYCLE 5
#define GLUT_CURSOR_SPRAY 6
#define GLUT_CURSOR_WAIT 7
#define GLUT_CURSOR_TEXT 8
#define GLUT_CURSOR_CROSSHAIR 9
/* Directional cursors. */
#define GLUT_CURSOR_UP_DOWN 10
#define GLUT_CURSOR_LEFT_RIGHT 11
/* Sizing cursors. */
#define GLUT_CURSOR_TOP_SIDE 12
#define GLUT_CURSOR_BOTTOM_SIDE 13
#define GLUT_CURSOR_LEFT_SIDE 14
#define GLUT_CURSOR_RIGHT_SIDE 15
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
/* Inherit from parent window. */
#define GLUT_CURSOR_INHERIT 100
/* Blank cursor. */
#define GLUT_CURSOR_NONE 101
/* Fullscreen crosshair (if available). */
#define GLUT_CURSOR_FULL_CROSSHAIR 102
#endif
/* GLUT initialization sub-API. */
GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void
(__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __
glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
#endif
#endif
GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
#endif
GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
/* GLUT window sub-API. */
GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void
(__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { r
eturn __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
#endif
#endif
GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int wid
th, int height);
GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
#endif
GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
#if (GLUT_API_VERSION >= 3)
GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
#endif
/* GLUT overlay sub-API. */
GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
#endif
GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
#endif
/* GLUT menu sub-API. */
GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)
(int), void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func
)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label
, int value);
GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label,
int submenu);
GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
/* GLUT window callback sub-API. */
GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int wid
th, int height));
GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsign
ed char key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int butto
n, int state, int x, int y));
GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, i
nt y));
GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(i
nt x, int y));
GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state
));
GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int
state));
GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALL
BACK *func)(int value), int value);
GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int s
tate));
#if (GLUT_API_VERSION >= 2)
GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key
, int x, int y));
GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)
(int x, int y, int z));
GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)
(int x, int y, int z));
GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)
(int button, int state));
GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int b
utton, int state));
GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial,
int value));
GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(in
t x, int y));
GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(in
t button, int state, int x, int y));
#if (GLUT_API_VERSION >= 3)
GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int
status, int x, int y));
GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(
void));
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(in
t state));
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsi
gned char key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int k
ey, int x, int y));
GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsign
ed int buttonMask, int x, int y, int z), int pollInterval);
#endif
#endif
#endif
/* GLUT color index sub-API. */
GLUTAPI void GLUTAPIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLf
loat blue);
GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
/* GLUT state retrieval sub-API. */
GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
#if (GLUT_API_VERSION >= 2)
/* GLUT extension support sub-API */
GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
#endif
#if (GLUT_API_VERSION >= 3)
GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
#endif
/* GLUT font sub-API */
GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *
string);
GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *
string);
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 17)
GLUTAPI float GLUTAPIENTRY glutStrokeWidthf(void *font, int character);
GLUTAPI float GLUTAPIENTRY glutStrokeLengthf(void *font, const unsigned cha
r *string);
#endif
/* GLUT pre-built models sub-API */
GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLi
nt stacks);
GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GL
int stacks);
GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLin
t slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLi
nt slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble oute
rRadius, GLint sides, GLint rings);
GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble out
erRadius, GLint sides, GLint rings);
GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
/* GLUT video resize sub-API. */
GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int heig
ht);
GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height)
;
/* GLUT debugging sub-API. */
GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
/* GLUT device control sub-API. */
/* glutSetKeyRepeat modes. */
#define GLUT_KEY_REPEAT_OFF 0
#define GLUT_KEY_REPEAT_ON 1
#define GLUT_KEY_REPEAT_DEFAULT 2
/* Joystick button masks. */
#define GLUT_JOYSTICK_BUTTON_A 1
#define GLUT_JOYSTICK_BUTTON_B 2
#define GLUT_JOYSTICK_BUTTON_C 4
#define GLUT_JOYSTICK_BUTTON_D 8
GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
/* GLUT game mode sub-API. */
/* glutGameModeGet. */
#define GLUT_GAME_MODE_ACTIVE ((GLenum) 0)
#define GLUT_GAME_MODE_POSSIBLE ((GLenum) 1)
#define GLUT_GAME_MODE_WIDTH ((GLenum) 2)
#define GLUT_GAME_MODE_HEIGHT ((GLenum) 3)
#define GLUT_GAME_MODE_PIXEL_DEPTH ((GLenum) 4)
#define GLUT_GAME_MODE_REFRESH_RATE ((GLenum) 5)
#define GLUT_GAME_MODE_DISPLAY_CHANGED ((GLenum) 6)
GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
#endif
#ifdef __cplusplus
}
#endif
#ifdef GLUT_APIENTRY_DEFINED
# undef GLUT_APIENTRY_DEFINED
# undef APIENTRY
#endif
#ifdef GLUT_WINGDIAPI_DEFINED
# undef GLUT_WINGDIAPI_DEFINED
# undef WINGDIAPI
#endif
#ifdef GLUT_DEFINED___CDECL
# undef GLUT_DEFINED___CDECL
# undef __cdecl
#endif
#ifdef GLUT_DEFINED__CRTIMP
# undef GLUT_DEFINED__CRTIMP
# undef _CRTIMP
#endif
#endif /* __glut_h__ */
 End of changes. 5 change blocks. 
19 lines changed or deleted 7 lines changed or added


 hingeConstraintNode.h   hingeConstraintNode.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//hingeConstraintNode.h //hingeConstraintNode.h
#ifndef DYN_HINGE_CONSTRAINT_NODE_H #ifndef DYN_HINGE_CONSTRAINT_NODE_H
#define DYN_HINGE_CONSTRAINT_NODE_H #define DYN_HINGE_CONSTRAINT_NODE_H
#include <maya/MString.h> #include <maya/MString.h>
#include <maya/MTypeId.h> #include <maya/MTypeId.h>
#include <maya/MPxLocatorNode.h> #include <maya/MPxLocatorNode.h>
skipping to change at line 64 skipping to change at line 67
virtual bool excludeAsLocator() const { return false; } virtual bool excludeAsLocator() const { return false; }
virtual bool isTransparent() const { return false; } virtual bool isTransparent() const { return false; }
static void * creator(); static void * creator();
static MStatus initialize(); static MStatus initialize();
public: public:
hinge_constraint_t::pointer constraint(); hinge_constraint_t::pointer constraint();
void update();
public: public:
//Attributes //Attributes
static MObject ia_rigidBody; static MObject ia_rigidBodyA;
static MObject ia_rigidBodyB;
static MObject ia_damping; static MObject ia_damping;
static MObject ia_lowerLimit; static MObject ia_lowerLimit;
static MObject ia_upperLimit; static MObject ia_upperLimit;
static MObject ia_limitSoftness; static MObject ia_limitSoftness;
static MObject ia_biasFactor; static MObject ia_biasFactor;
static MObject ia_relaxationFactor; static MObject ia_relaxationFactor;
static MObject ia_hingeAxis; static MObject ia_rotationInA;
static MObject ia_rotationInB;
static MObject ia_pivotInA;
static MObject ia_pivotInB;
static MObject ca_constraint; static MObject ca_constraint;
static MObject ca_constraintParam; static MObject ca_constraintParam;
static MObject ia_enableAngularMotor; static MObject ia_enableAngularMotor;
static MObject ia_motorTargetVelocity; static MObject ia_motorTargetVelocity;
static MObject ia_maxMotorImpulse; static MObject ia_maxMotorImpulse;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
void update();
void computeConstraint(const MPlug& plug, MDataBlock& data); void computeConstraint(const MPlug& plug, MDataBlock& data);
void computeConstraintParam(const MPlug& plug, MDataBlock& data); void computeConstraintParam(const MPlug& plug, MDataBlock& data);
void computeWorldMatrix(const MPlug& plug, MDataBlock& data); void computeWorldMatrix(const MPlug& plug, MDataBlock& data);
public: public:
static void nodeRemoved(MObject& node, void *clientData); static void nodeRemoved(MObject& node, void *clientData);
private: private:
hinge_constraint_t::pointer m_constraint; hinge_constraint_t::pointer m_constraint;
}; };
 End of changes. 5 change blocks. 
3 lines changed or deleted 11 lines changed or added


 hinge_constraint.h   hinge_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//hinge_constraint.h //hinge_constraint.h
#ifndef DYN_HINGE_CONSTRAINT_H #ifndef DYN_HINGE_CONSTRAINT_H
#define DYN_HINGE_CONSTRAINT_H #define DYN_HINGE_CONSTRAINT_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "rigid_body.h" #include "rigid_body.h"
#include "mathUtils.h" #include "mathUtils.h"
skipping to change at line 42 skipping to change at line 45
#include "constraint.h" #include "constraint.h"
#include "hinge_constraint_impl.h" #include "hinge_constraint_impl.h"
class hinge_constraint_t: public constraint_t class hinge_constraint_t: public constraint_t
{ {
public: public:
//typedefs //typedefs
typedef shared_ptr<hinge_constraint_t> pointer; typedef shared_ptr<hinge_constraint_t> pointer;
// //
rigid_body_t::pointer rigid_body() { return m_rigid_body; } rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; }
rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; }
// //
void set_pivot(vec3f const& p) void get_frameA(vec3f& p, quatf& r) const {
{
hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint
_impl_t*>(impl());
hinge_impl->set_pivot(p);
}
//local space pivot
void get_pivot(vec3f& p) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl()); hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl());
hinge_impl->get_pivot(p); hinge_impl->get_frameA(p, r);
} }
void get_frameB(vec3f& p, quatf& r) const {
//
void get_world_pivot(vec3f& p) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl()); hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl());
hinge_impl->get_world_pivot(p); hinge_impl->get_frameB(p, r);
} }
void get_invFrameA(vec3f& p, quatf& r) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons
traint_impl_t const*>(impl());
hinge_impl->get_invFrameA(p, r);
}
void get_invFrameB(vec3f& p, quatf& r) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons
traint_impl_t const*>(impl());
hinge_impl->get_invFrameB(p, r);
}
void worldToA(vec3f& w, vec3f& p) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons
traint_impl_t const*>(impl());
hinge_impl->worldToA(w, p);
}
void worldFromB(vec3f& p, vec3f& w) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons
traint_impl_t const*>(impl());
hinge_impl->worldFromB(p, w);
}
// //
void set_damping(float d) { void set_damping(float d) {
hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl()); hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl());
hinge_impl->set_damping(d); hinge_impl->set_damping(d);
} }
void set_limit(float lower, float upper, float softness, float bias_ factor, float relaxation_factor) { void set_limit(float lower, float upper, float softness, float bias_ factor, float relaxation_factor) {
hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl()); hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl());
hinge_impl->set_limit(lower, upper, softness, bias_factor, relaxati on_factor); hinge_impl->set_limit(lower, upper, softness, bias_factor, relaxati on_factor);
skipping to change at line 84 skipping to change at line 95
void set_axis(vec3f const& p) { void set_axis(vec3f const& p) {
hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl()); hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl());
hinge_impl->set_axis(p); hinge_impl->set_axis(p);
} }
float damping() const { float damping() const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl()); hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl());
return hinge_impl->damping(); return hinge_impl->damping();
} }
void set_world(vec3f const& p) void set_world(vec3f const& p, quatf const& r)
{ {
hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl()); hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl());
hinge_impl->set_world(p); hinge_impl->set_world(p, r);
} }
//local space pivot //local space pivot
void get_world(vec3f& p) const { void get_world(vec3f& p, quatf& r) const {
hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl()); hinge_constraint_impl_t const* hinge_impl = dynamic_cast<hinge_cons traint_impl_t const*>(impl());
hinge_impl->get_world(p); hinge_impl->get_world(p, r);
} }
void enable_motor(bool enable, float velocity, float impulse) { void enable_motor(bool enable, float velocity, float impulse) {
hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl()); hinge_constraint_impl_t* hinge_impl = dynamic_cast<hinge_constraint _impl_t*>(impl());
hinge_impl->enable_motor(enable, velocity, impulse); hinge_impl->enable_motor(enable, velocity, impulse);
} }
public: public:
virtual ~hinge_constraint_t() {}; virtual ~hinge_constraint_t() {};
protected: protected:
friend class solver_t; friend class solver_t;
hinge_constraint_t(hinge_constraint_impl_t* impl, rigid_body_t::pointer & rigid_body): hinge_constraint_t(hinge_constraint_impl_t* impl, rigid_body_t::pointer & rigid_body):
constraint_t(impl), constraint_t(impl),
m_rigid_body(rigid_body) m_rigid_bodyA(rigid_body)
{
}
hinge_constraint_t(hinge_constraint_impl_t* impl, rigid_body_t::pointer
& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB):
constraint_t(impl),
m_rigid_bodyA(rigid_bodyA),
m_rigid_bodyB(rigid_bodyB)
{ {
} }
private: private:
rigid_body_t::pointer m_rigid_body; rigid_body_t::pointer m_rigid_bodyA;
rigid_body_t::pointer m_rigid_bodyB;
}; };
#endif //DYN_HINGE_CONSTRAINT_H #endif //DYN_HINGE_CONSTRAINT_H
 End of changes. 11 change blocks. 
23 lines changed or deleted 45 lines changed or added


 hinge_constraint_impl.h   hinge_constraint_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//hinge_constraint_impl.h //hinge_constraint_impl.h
#ifndef DYN_HINGE_CONSTRAINT_IMPL_H #ifndef DYN_HINGE_CONSTRAINT_IMPL_H
#define DYN_HINGE_CONSTRAINT_IMPL_H #define DYN_HINGE_CONSTRAINT_IMPL_H
#include "constraint_impl.h" #include "constraint_impl.h"
class hinge_constraint_impl_t: public constraint_impl_t class hinge_constraint_impl_t: public constraint_impl_t
{ {
public: public:
// //
virtual void set_pivot(vec3f const& p) = 0; virtual void set_world(vec3f const& p, quatf const& r) = 0;
virtual void get_pivot(vec3f& p) const = 0; virtual void get_world(vec3f& p, quatf& r) const = 0;
virtual void get_world_pivot(vec3f& p) const = 0; virtual void get_frameA(vec3f& p, quatf& r) const = 0;
virtual void set_world(vec3f const& p) = 0; virtual void get_frameB(vec3f& p, quatf& r) const = 0;
virtual void get_world(vec3f& p) const = 0; virtual void get_invFrameA(vec3f& p, quatf& r) const = 0;
virtual void get_invFrameB(vec3f& p, quatf& r) const = 0;
virtual void worldToA(vec3f& w, vec3f& p) const = 0;
virtual void worldFromB(vec3f& p, vec3f& w) const = 0;
// //
virtual void set_damping(float d) = 0; virtual void set_damping(float d) = 0;
virtual float damping() const = 0; virtual float damping() const = 0;
virtual void set_limit(float lower, float upper, float softness, float bias_factor, float relaxation_factor) = 0; virtual void set_limit(float lower, float upper, float softness, float bias_factor, float relaxation_factor) = 0;
virtual void set_axis(vec3f const& p) = 0; virtual void set_axis(vec3f const& p) = 0;
virtual void enable_motor(bool enable, float velocity, float impulse) = 0; virtual void enable_motor(bool enable, float velocity, float impulse) = 0;
public: public:
 End of changes. 2 change blocks. 
5 lines changed or deleted 11 lines changed or added


 mesh_shape.h   mesh_shape.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
12/24/2009 : Nail constraint improvements
*/ */
//mesh_shape.h //mesh_shape.h
#ifndef DYN_MESH_SHAPE_H #ifndef DYN_MESH_SHAPE_H
#define DYN_MESH_SHAPE_H #define DYN_MESH_SHAPE_H
#include "collision_shape.h" #include "collision_shape.h"
#include "collision_shape_impl.h" #include "collision_shape_impl.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 nailConstraintNode.h   nailConstraintNode.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//nailConstraintNode.h //nailConstraintNode.h
#ifndef DYN_NAIL_CONSTRAINT_NODE_H #ifndef DYN_NAIL_CONSTRAINT_NODE_H
#define DYN_NAIL_CONSTRAINT_NODE_H #define DYN_NAIL_CONSTRAINT_NODE_H
#include <maya/MString.h> #include <maya/MString.h>
#include <maya/MTypeId.h> #include <maya/MTypeId.h>
#include <maya/MPxLocatorNode.h> #include <maya/MPxLocatorNode.h>
skipping to change at line 64 skipping to change at line 67
virtual bool excludeAsLocator() const { return false; } virtual bool excludeAsLocator() const { return false; }
virtual bool isTransparent() const { return false; } virtual bool isTransparent() const { return false; }
static void * creator(); static void * creator();
static MStatus initialize(); static MStatus initialize();
public: public:
nail_constraint_t::pointer constraint(); nail_constraint_t::pointer constraint();
void update();
public: public:
//Attributes //Attributes
static MObject ia_rigidBody; static MObject ia_rigidBodyA;
static MObject ia_rigidBodyB;
static MObject ia_damping; static MObject ia_damping;
static MObject ia_pivotInA;
static MObject ia_pivotInB;
static MObject ca_constraint; static MObject ca_constraint;
static MObject ca_constraintParam; static MObject ca_constraintParam;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
void update();
void computeConstraint(const MPlug& plug, MDataBlock& data); void computeConstraint(const MPlug& plug, MDataBlock& data);
void computeConstraintParam(const MPlug& plug, MDataBlock& data); void computeConstraintParam(const MPlug& plug, MDataBlock& data);
void computeWorldMatrix(const MPlug& plug, MDataBlock& data); void computeWorldMatrix(const MPlug& plug, MDataBlock& data);
public: public:
static void nodeRemoved(MObject& node, void *clientData); static void nodeRemoved(MObject& node, void *clientData);
private: private:
nail_constraint_t::pointer m_constraint; nail_constraint_t::pointer m_constraint;
}; };
 End of changes. 5 change blocks. 
2 lines changed or deleted 8 lines changed or added


 nail_constraint.h   nail_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//nail_constraint.h //nail_constraint.h
#ifndef DYN_NAIL_CONSTRAINT_H #ifndef DYN_NAIL_CONSTRAINT_H
#define DYN_NAIL_CONSTRAINT_H #define DYN_NAIL_CONSTRAINT_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "rigid_body.h" #include "rigid_body.h"
#include "mathUtils.h" #include "mathUtils.h"
skipping to change at line 42 skipping to change at line 45
#include "constraint.h" #include "constraint.h"
#include "nail_constraint_impl.h" #include "nail_constraint_impl.h"
class nail_constraint_t: public constraint_t class nail_constraint_t: public constraint_t
{ {
public: public:
//typedefs //typedefs
typedef shared_ptr<nail_constraint_t> pointer; typedef shared_ptr<nail_constraint_t> pointer;
// //
rigid_body_t::pointer rigid_body() { return m_rigid_body; } rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; }
rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; }
// //local space pivots
void set_pivotA(vec3f const& p) { void set_pivotA(vec3f const& p) {
nail_constraint_impl_t* nail_impl = dynamic_cast<nail_constraint_im pl_t*>(impl()); nail_constraint_impl_t* nail_impl = dynamic_cast<nail_constraint_im pl_t*>(impl());
nail_impl->set_pivotA(p); nail_impl->set_pivotA(p);
} }
//local space pivot
void get_pivotA(vec3f& p) const { void get_pivotA(vec3f& p) const {
nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra int_impl_t const*>(impl()); nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra int_impl_t const*>(impl());
nail_impl->get_pivotA(p); nail_impl->get_pivotA(p);
} }
void set_pivotB(vec3f const& p) {
nail_constraint_impl_t* nail_impl = dynamic_cast<nail_constraint_im
pl_t*>(impl());
nail_impl->set_pivotB(p);
}
void get_pivotB(vec3f& p) const {
nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra
int_impl_t const*>(impl());
nail_impl->get_pivotB(p);
}
//world space pivots
void get_world_pivotA(vec3f& p) const {
nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra
int_impl_t const*>(impl());
nail_impl->get_world_pivotA(p);
}
void get_world_pivotB(vec3f& p) const {
nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra
int_impl_t const*>(impl());
nail_impl->get_world_pivotB(p);
}
// //
void set_world(vec3f const& p) { void set_world(vec3f const& p) {
nail_constraint_impl_t* nail_impl = dynamic_cast<nail_constraint_im pl_t*>(impl()); nail_constraint_impl_t* nail_impl = dynamic_cast<nail_constraint_im pl_t*>(impl());
nail_impl->set_world(p); nail_impl->set_world(p);
} }
// //
void get_world(vec3f& p) const { void get_world(vec3f& p) const {
nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra int_impl_t const*>(impl()); nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra int_impl_t const*>(impl());
skipping to change at line 84 skipping to change at line 103
float damping() const { float damping() const {
nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra int_impl_t const*>(impl()); nail_constraint_impl_t const* nail_impl = dynamic_cast<nail_constra int_impl_t const*>(impl());
return nail_impl->damping(); return nail_impl->damping();
} }
public: public:
virtual ~nail_constraint_t() {}; virtual ~nail_constraint_t() {};
protected: protected:
friend class solver_t; friend class solver_t;
nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_body): nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_bodyA):
constraint_t(impl), constraint_t(impl),
m_rigid_body(rigid_body) m_rigid_bodyA(rigid_bodyA),
m_rigid_bodyB(NULL)
{
}
nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointe
r& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB):
constraint_t(impl),
m_rigid_bodyA(rigid_bodyA),
m_rigid_bodyB(rigid_bodyB)
{ {
} }
private: private:
rigid_body_t::pointer m_rigid_body; rigid_body_t::pointer m_rigid_bodyA;
rigid_body_t::pointer m_rigid_bodyB;
}; };
#endif #endif
 End of changes. 8 change blocks. 
7 lines changed or deleted 40 lines changed or added


 nail_constraint_impl.h   nail_constraint_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//nail_constraint_impl.h //nail_constraint_impl.h
#ifndef DYN_NAIL_CONSTRAINT_IMPL_H #ifndef DYN_NAIL_CONSTRAINT_IMPL_H
#define DYN_NAIL_CONSTRAINT_IMPL_H #define DYN_NAIL_CONSTRAINT_IMPL_H
#include "constraint_impl.h" #include "constraint_impl.h"
class nail_constraint_impl_t: public constraint_impl_t class nail_constraint_impl_t: public constraint_impl_t
{ {
public: public:
// //
virtual void set_pivotA(vec3f const& p) = 0; virtual void set_pivotA(vec3f const& p) = 0;
virtual void get_pivotA(vec3f& p) const = 0; virtual void get_pivotA(vec3f& p) const = 0;
virtual void set_pivotB(vec3f const& p) = 0;
virtual void get_pivotB(vec3f& p) const = 0;
virtual void set_world(vec3f const& p) = 0; virtual void set_world(vec3f const& p) = 0;
virtual void get_world(vec3f& p) const = 0; virtual void get_world(vec3f& p) const = 0;
virtual void get_world_pivotA(vec3f& p) const = 0;
virtual void get_world_pivotB(vec3f& p) const = 0;
// //
virtual void set_damping(float d) = 0; virtual void set_damping(float d) = 0;
virtual float damping() const = 0; virtual float damping() const = 0;
public: public:
virtual ~nail_constraint_impl_t() {}; virtual ~nail_constraint_impl_t() {};
}; };
#endif #endif
 End of changes. 3 change blocks. 
0 lines changed or deleted 7 lines changed or added


 rigidBodyNode.h   rigidBodyNode.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//rigidBodyNode.h //rigidBodyNode.h
#ifndef DYN_RIGID_BODY_NODE_H #ifndef DYN_RIGID_BODY_NODE_H
#define DYN_RIGID_BODY_NODE_H #define DYN_RIGID_BODY_NODE_H
#include <maya/MString.h> #include <maya/MString.h>
#include <maya/MTypeId.h> #include <maya/MTypeId.h>
#include <maya/MPxLocatorNode.h> #include <maya/MPxLocatorNode.h>
skipping to change at line 64 skipping to change at line 67
virtual bool excludeAsLocator() const { return false; } virtual bool excludeAsLocator() const { return false; }
virtual bool isTransparent() const { return false; } virtual bool isTransparent() const { return false; }
static void * creator(); static void * creator();
static MStatus initialize(); static MStatus initialize();
public: public:
rigid_body_t::pointer rigid_body(); rigid_body_t::pointer rigid_body();
void update();
public: public:
//Attributes //Attributes
static MObject ia_collisionShape; static MObject ia_collisionShape;
static MObject ia_solver; static MObject ia_solver;
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;
skipping to change at line 90 skipping to change at line 94
static MObject ca_rigidBody; static MObject ca_rigidBody;
static MObject ca_rigidBodyParam; static MObject ca_rigidBodyParam;
static MObject ca_solver; static MObject ca_solver;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
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);
public: public:
static void nodeRemoved(MObject& node, void *clientData); static void nodeRemoved(MObject& node, void *clientData);
private: private:
rigid_body_t::pointer m_rigid_body; rigid_body_t::pointer m_rigid_body;
 End of changes. 3 change blocks. 
1 lines changed or deleted 4 lines changed or added


 rigid_body.h   rigid_body.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//rigid_body.h //rigid_body.h
#ifndef DYN_RIGID_BODY_H #ifndef DYN_RIGID_BODY_H
#define DYN_RIGID_BODY_H #define DYN_RIGID_BODY_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "collision_shape.h" #include "collision_shape.h"
#include "mathUtils.h" #include "mathUtils.h"
skipping to change at line 57 skipping to change at line 60
void set_mass(float mass) { m_impl->set_mass(mass); } void set_mass(float mass) { m_impl->set_mass(mass); }
void set_inertia(vec3f const& I) { m_impl->set_inertia(I); } void set_inertia(vec3f const& I) { m_impl->set_inertia(I); }
void set_restitution(float r) { m_impl->set_restitution(r); } void set_restitution(float r) { m_impl->set_restitution(r); }
void set_friction(float f) { m_impl->set_friction(f); } void set_friction(float f) { m_impl->set_friction(f); }
void set_linear_damping(float d) { m_impl->set_linear_damping(d ); } void set_linear_damping(float d) { m_impl->set_linear_damping(d ); }
void set_angular_damping(float d) { m_impl->set_angular_damping( d); } void set_angular_damping(float d) { m_impl->set_angular_damping( d); }
void set_transform(vec3f const& position, quatf const& rotation) { m _impl->set_transform(position, rotation); } void set_transform(vec3f const& position, quatf const& rotation) { m _impl->set_transform(position, rotation); }
void get_transform(vec3f& position, quatf& rotation) const { m _impl->get_transform(position, rotation); } void get_transform(vec3f& position, quatf& rotation) const { m _impl->get_transform(position, rotation); }
void get_transform(mat4x4f& xform) const { m _impl->get_transform(xform); } void get_transform(mat4x4f& xform) const { m _impl->get_transform(xform); }
void set_interpolation_transform(vec3f const& position, quatf const& ro tation) { m_impl->set_interpolation_transform(position, rotation); }
// //
void set_linear_velocity(vec3f const& v) { m _impl->set_linear_velocity(v); } void set_linear_velocity(vec3f const& v) { m _impl->set_linear_velocity(v); }
void get_linear_velocity(vec3f& v) const { m _impl->get_linear_velocity(v); } void get_linear_velocity(vec3f& v) const { m _impl->get_linear_velocity(v); }
void set_angular_velocity(vec3f const& v) { m _impl->set_angular_velocity(v); } void set_angular_velocity(vec3f const& v) { m _impl->set_angular_velocity(v); }
void get_angular_velocity(vec3f& v) const { m _impl->get_angular_velocity(v); } void get_angular_velocity(vec3f& v) const { m _impl->get_angular_velocity(v); }
// //
void clear_forces() { m _impl->clear_forces(); } void clear_forces() { m _impl->clear_forces(); }
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 rigid_body_impl.h   rigid_body_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//rigid_body_impl.h //rigid_body_impl.h
#ifndef DYN_RIGID_BODY_IMPL_H #ifndef DYN_RIGID_BODY_IMPL_H
#define DYN_RIGID_BODY_IMPL_H #define DYN_RIGID_BODY_IMPL_H
#include "mathUtils.h" #include "mathUtils.h"
#include "constraint/bt_constraint.h" #include "constraint/bt_constraint.h"
skipping to change at line 47 skipping to change at line 50
virtual void set_mass(float mass) = 0; virtual void set_mass(float mass) = 0;
virtual void set_inertia(vec3f const& I) = 0; virtual void set_inertia(vec3f const& I) = 0;
virtual void set_restitution(float r) = 0; virtual void set_restitution(float r) = 0;
virtual void set_friction(float f) = 0; virtual void set_friction(float f) = 0;
virtual void set_linear_damping(float d) = 0; virtual void set_linear_damping(float d) = 0;
virtual void set_angular_damping(float d) = 0; virtual void set_angular_damping(float d) = 0;
virtual void set_transform(vec3f const& position, quatf const& rotation ) = 0; virtual void set_transform(vec3f const& position, quatf const& rotation ) = 0;
virtual void get_transform(vec3f& position, quatf& rotation) const = 0; virtual void get_transform(vec3f& position, quatf& rotation) const = 0;
virtual void get_transform(mat4x4f& xform) const = 0; virtual void get_transform(mat4x4f& xform) const = 0;
virtual void set_interpolation_transform(vec3f const& position, quatf c onst& rotation) = 0;
virtual void set_linear_velocity(vec3f const& v) = 0; virtual void set_linear_velocity(vec3f const& v) = 0;
virtual void get_linear_velocity(vec3f& v) const = 0; virtual void get_linear_velocity(vec3f& v) const = 0;
virtual void set_angular_velocity(vec3f const& v) = 0; virtual void set_angular_velocity(vec3f const& v) = 0;
virtual void get_angular_velocity(vec3f& v) const = 0; virtual void get_angular_velocity(vec3f& v) const = 0;
virtual void clear_forces() = 0; virtual void clear_forces() = 0;
virtual void apply_central_force(vec3f const& f) = 0; virtual void apply_central_force(vec3f const& f) = 0;
virtual void apply_torque(vec3f const& t) = 0; virtual void apply_torque(vec3f const& t) = 0;
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 sixdofConstraintNode.h   sixdofConstraintNode.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//sixdofConstraintNode.h //sixdofConstraintNode.h
#ifndef DYN_SIXDOF_CONSTRAINT_NODE_H #ifndef DYN_SIXDOF_CONSTRAINT_NODE_H
#define DYN_SIXDOF_CONSTRAINT_NODE_H #define DYN_SIXDOF_CONSTRAINT_NODE_H
#include <maya/MString.h> #include <maya/MString.h>
#include <maya/MTypeId.h> #include <maya/MTypeId.h>
#include <maya/MPxLocatorNode.h> #include <maya/MPxLocatorNode.h>
skipping to change at line 64 skipping to change at line 67
virtual bool excludeAsLocator() const { return false; } virtual bool excludeAsLocator() const { return false; }
virtual bool isTransparent() const { return false; } virtual bool isTransparent() const { return false; }
static void * creator(); static void * creator();
static MStatus initialize(); static MStatus initialize();
public: public:
sixdof_constraint_t::pointer constraint(); sixdof_constraint_t::pointer constraint();
void update();
public: public:
//Attributes //Attributes
static MObject ia_rigidBodyA; static MObject ia_rigidBodyA;
static MObject ia_rigidBodyB; static MObject ia_rigidBodyB;
static MObject ia_damping; static MObject ia_damping;
static MObject ia_lowerLinLimit; static MObject ia_lowerLinLimit;
static MObject ia_upperLinLimit; static MObject ia_upperLinLimit;
static MObject ia_lowerAngLimit; static MObject ia_lowerAngLimit;
static MObject ia_upperAngLimit; static MObject ia_upperAngLimit;
static MObject ia_rotationInA;
static MObject ia_rotationInB;
static MObject ia_pivotInA;
static MObject ia_pivotInB;
static MObject ca_constraint; static MObject ca_constraint;
static MObject ca_constraintParam; static MObject ca_constraintParam;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
void update();
void computeConstraint(const MPlug& plug, MDataBlock& data); void computeConstraint(const MPlug& plug, MDataBlock& data);
void computeConstraintParam(const MPlug& plug, MDataBlock& data); void computeConstraintParam(const MPlug& plug, MDataBlock& data);
void computeWorldMatrix(const MPlug& plug, MDataBlock& data); void computeWorldMatrix(const MPlug& plug, MDataBlock& data);
public: public:
static void nodeRemoved(MObject& node, void *clientData); static void nodeRemoved(MObject& node, void *clientData);
private: private:
sixdof_constraint_t::pointer m_constraint; sixdof_constraint_t::pointer m_constraint;
}; };
 End of changes. 4 change blocks. 
1 lines changed or deleted 10 lines changed or added


 sixdof_constraint.h   sixdof_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//sixdof_constraint.h //sixdof_constraint.h
#ifndef DYN_SIXDOF_CONSTRAINT_H #ifndef DYN_SIXDOF_CONSTRAINT_H
#define DYN_SIXDOF_CONSTRAINT_H #define DYN_SIXDOF_CONSTRAINT_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "rigid_body.h" #include "rigid_body.h"
#include "mathUtils.h" #include "mathUtils.h"
skipping to change at line 46 skipping to change at line 49
{ {
public: public:
//typedefs //typedefs
typedef shared_ptr<sixdof_constraint_t> pointer; typedef shared_ptr<sixdof_constraint_t> pointer;
// //
rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; } rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; }
rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; } rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; }
// //
void set_pivot(vec3f const& p)
{
sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra
int_impl_t*>(impl());
sixdof_impl->set_pivot(p);
}
//local space pivot
void get_pivot(vec3f& p) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->get_pivot(p);
}
//
void get_world_pivot(vec3f& p) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->get_world_pivot(p);
}
//
void set_damping(float d) { void set_damping(float d) {
sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra int_impl_t*>(impl()); sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra int_impl_t*>(impl());
sixdof_impl->set_damping(d); sixdof_impl->set_damping(d);
} }
float damping() const { float damping() const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c onstraint_impl_t const*>(impl()); sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c onstraint_impl_t const*>(impl());
return sixdof_impl->damping(); return sixdof_impl->damping();
} }
void set_world(vec3f const& p) void set_LinLimit(vec3f& lower, vec3f& upper) {
{
sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra int_impl_t*>(impl()); sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra int_impl_t*>(impl());
sixdof_impl->set_world(p); sixdof_impl->set_LinLimit(lower, upper);
} }
//local space pivot void set_AngLimit(vec3f& lower, vec3f& upper) {
void get_world(vec3f& p) const { sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c int_impl_t*>(impl());
onstraint_impl_t const*>(impl()); sixdof_impl->set_AngLimit(lower, upper);
sixdof_impl->get_world(p);
} }
void set_LinLimit(float lower, float upper) { void get_frameA(vec3f& p, quatf& r) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->get_frameA(p, r);
}
void get_frameB(vec3f& p, quatf& r) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->get_frameB(p, r);
}
void get_invFrameA(vec3f& p, quatf& r) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->get_invFrameA(p, r);
}
void get_invFrameB(vec3f& p, quatf& r) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->get_invFrameB(p, r);
}
void worldToA(vec3f& w, vec3f& p) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->worldToA(w, p);
}
void worldFromB(vec3f& p, vec3f& w) const {
sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
onstraint_impl_t const*>(impl());
sixdof_impl->worldFromB(p, w);
}
void set_world(vec3f const& p, quatf const& r)
{
sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra int_impl_t*>(impl()); sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra int_impl_t*>(impl());
sixdof_impl->set_LinLimit(lower, upper); sixdof_impl->set_world(p, r);
} }
void set_AngLimit(float lower, float upper) { //local space pivot
sixdof_constraint_impl_t* sixdof_impl = dynamic_cast<sixdof_constra void get_world(vec3f& p, quatf& r) const {
int_impl_t*>(impl()); sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast<sixdof_c
sixdof_impl->set_AngLimit(lower, upper); onstraint_impl_t const*>(impl());
sixdof_impl->get_world(p, r);
} }
public: public:
virtual ~sixdof_constraint_t() {}; virtual ~sixdof_constraint_t() {};
protected: protected:
friend class solver_t; friend class solver_t;
sixdof_constraint_t(sixdof_constraint_impl_t* impl, rigid_body_t::point
er& rigid_body):
constraint_t(impl),
m_rigid_bodyA(rigid_body)
{
}
sixdof_constraint_t(sixdof_constraint_impl_t* impl, rigid_body_t::point er& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB): sixdof_constraint_t(sixdof_constraint_impl_t* impl, rigid_body_t::point er& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB):
constraint_t(impl), constraint_t(impl),
m_rigid_bodyA(rigid_bodyA), m_rigid_bodyA(rigid_bodyA),
m_rigid_bodyB(rigid_bodyB) m_rigid_bodyB(rigid_bodyB)
{ {
} }
private: private:
rigid_body_t::pointer m_rigid_bodyA; rigid_body_t::pointer m_rigid_bodyA;
rigid_body_t::pointer m_rigid_bodyB; rigid_body_t::pointer m_rigid_bodyB;
 End of changes. 9 change blocks. 
36 lines changed or deleted 53 lines changed or added


 sixdof_constraint_impl.h   sixdof_constraint_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//sixdof_constraint_impl.h //sixdof_constraint_impl.h
#ifndef DYN_SIXDOF_CONSTRAINT_IMPL_H #ifndef DYN_SIXDOF_CONSTRAINT_IMPL_H
#define DYN_SIXDOF_CONSTRAINT_IMPL_H #define DYN_SIXDOF_CONSTRAINT_IMPL_H
#include "constraint_impl.h" #include "constraint_impl.h"
class sixdof_constraint_impl_t: public constraint_impl_t class sixdof_constraint_impl_t: public constraint_impl_t
{ {
public: public:
// virtual void set_world(vec3f const& p, quatf const& r) = 0;
virtual void set_pivot(vec3f const& p) = 0; virtual void get_world(vec3f& p, quatf& r) const = 0;
virtual void get_pivot(vec3f& p) const = 0; virtual void get_frameA(vec3f& p, quatf& r) const = 0;
virtual void get_world_pivot(vec3f& p) const = 0; virtual void get_frameB(vec3f& p, quatf& r) const = 0;
virtual void set_world(vec3f const& p) = 0; virtual void get_invFrameA(vec3f& p, quatf& r) const = 0;
virtual void get_world(vec3f& p) const = 0; virtual void get_invFrameB(vec3f& p, quatf& r) const = 0;
virtual void worldToA(vec3f& w, vec3f& p) const = 0;
virtual void worldFromB(vec3f& p, vec3f& w) const = 0;
// //
virtual void set_damping(float d) = 0; virtual void set_damping(float d) = 0;
virtual float damping() const = 0; virtual float damping() const = 0;
virtual void set_LinLimit(float lower, float upper) = 0; virtual void set_LinLimit(vec3f& lower, vec3f& upper) = 0;
virtual void set_AngLimit(float lower, float upper) = 0; virtual void set_AngLimit(vec3f& lower, vec3f& upper) = 0;
public: public:
virtual ~sixdof_constraint_impl_t() {}; virtual ~sixdof_constraint_impl_t() {};
}; };
#endif //DYN_SIXDOF_CONSTRAINT_IMPL_H #endif //DYN_SIXDOF_CONSTRAINT_IMPL_H
 End of changes. 3 change blocks. 
8 lines changed or deleted 13 lines changed or added


 sliderConstraintNode.h   sliderConstraintNode.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//sliderConstraintNode.h //sliderConstraintNode.h
#ifndef DYN_SLIDER_CONSTRAINT_NODE_H #ifndef DYN_SLIDER_CONSTRAINT_NODE_H
#define DYN_SLIDER_CONSTRAINT_NODE_H #define DYN_SLIDER_CONSTRAINT_NODE_H
#include <maya/MString.h> #include <maya/MString.h>
#include <maya/MTypeId.h> #include <maya/MTypeId.h>
#include <maya/MPxLocatorNode.h> #include <maya/MPxLocatorNode.h>
skipping to change at line 64 skipping to change at line 67
virtual bool excludeAsLocator() const { return false; } virtual bool excludeAsLocator() const { return false; }
virtual bool isTransparent() const { return false; } virtual bool isTransparent() const { return false; }
static void * creator(); static void * creator();
static MStatus initialize(); static MStatus initialize();
public: public:
slider_constraint_t::pointer constraint(); slider_constraint_t::pointer constraint();
void update();
public: public:
//Attributes //Attributes
static MObject ia_rigidBodyA; static MObject ia_rigidBodyA;
static MObject ia_rigidBodyB; static MObject ia_rigidBodyB;
static MObject ia_damping; static MObject ia_damping;
static MObject ia_lowerLinLimit; static MObject ia_lowerLinLimit;
static MObject ia_upperLinLimit; static MObject ia_upperLinLimit;
static MObject ia_lowerAngLimit; static MObject ia_lowerAngLimit;
static MObject ia_upperAngLimit; static MObject ia_upperAngLimit;
static MObject ia_rotationInA;
static MObject ia_rotationInB;
static MObject ia_pivotInA;
static MObject ia_pivotInB;
static MObject ca_constraint; static MObject ca_constraint;
static MObject ca_constraintParam; static MObject ca_constraintParam;
public: public:
static MTypeId typeId; static MTypeId typeId;
static MString typeName; static MString typeName;
private: private:
void update();
void computeConstraint(const MPlug& plug, MDataBlock& data); void computeConstraint(const MPlug& plug, MDataBlock& data);
void computeConstraintParam(const MPlug& plug, MDataBlock& data); void computeConstraintParam(const MPlug& plug, MDataBlock& data);
void computeWorldMatrix(const MPlug& plug, MDataBlock& data); void computeWorldMatrix(const MPlug& plug, MDataBlock& data);
public: public:
static void nodeRemoved(MObject& node, void *clientData); static void nodeRemoved(MObject& node, void *clientData);
private: private:
slider_constraint_t::pointer m_constraint; slider_constraint_t::pointer m_constraint;
}; };
 End of changes. 4 change blocks. 
1 lines changed or deleted 10 lines changed or added


 slider_constraint.h   slider_constraint.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//slider_constraint.h //slider_constraint.h
#ifndef DYN_SLIDER_CONSTRAINT_H #ifndef DYN_SLIDER_CONSTRAINT_H
#define DYN_SLIDER_CONSTRAINT_H #define DYN_SLIDER_CONSTRAINT_H
#include "shared_ptr.h" #include "shared_ptr.h"
#include "rigid_body.h" #include "rigid_body.h"
#include "mathUtils.h" #include "mathUtils.h"
skipping to change at line 46 skipping to change at line 49
{ {
public: public:
//typedefs //typedefs
typedef shared_ptr<slider_constraint_t> pointer; typedef shared_ptr<slider_constraint_t> pointer;
// //
rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; } rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; }
rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; } rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; }
// //
void set_pivot(vec3f const& p)
{
slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra
int_impl_t*>(impl());
slider_impl->set_pivot(p);
}
//local space pivot
void get_pivot(vec3f& p) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_pivot(p);
}
//
void get_world_pivot(vec3f& p) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_world_pivot(p);
}
//
void set_damping(float d) { void set_damping(float d) {
slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra int_impl_t*>(impl()); slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra int_impl_t*>(impl());
slider_impl->set_damping(d); slider_impl->set_damping(d);
} }
float damping() const { float damping() const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c onstraint_impl_t const*>(impl()); slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c onstraint_impl_t const*>(impl());
return slider_impl->damping(); return slider_impl->damping();
} }
void set_world(vec3f const& p)
{
slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra
int_impl_t*>(impl());
slider_impl->set_world(p);
}
//local space pivot
void get_world(vec3f& p) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_world(p);
}
void set_LinLimit(float lower, float upper) { void set_LinLimit(float lower, float upper) {
slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra int_impl_t*>(impl()); slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra int_impl_t*>(impl());
slider_impl->set_LinLimit(lower, upper); slider_impl->set_LinLimit(lower, upper);
} }
void set_AngLimit(float lower, float upper) { void set_AngLimit(float lower, float upper) {
slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra int_impl_t*>(impl()); slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra int_impl_t*>(impl());
slider_impl->set_AngLimit(lower, upper); slider_impl->set_AngLimit(lower, upper);
} }
void get_frameA(vec3f& p, quatf& r) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_frameA(p, r);
}
void get_frameB(vec3f& p, quatf& r) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_frameB(p, r);
}
void get_invFrameA(vec3f& p, quatf& r) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_invFrameA(p, r);
}
void get_invFrameB(vec3f& p, quatf& r) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_invFrameB(p, r);
}
void worldToA(vec3f& w, vec3f& p) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->worldToA(w, p);
}
void worldFromB(vec3f& p, vec3f& w) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->worldFromB(p, w);
}
void set_world(vec3f const& p, quatf const& r)
{
slider_constraint_impl_t* slider_impl = dynamic_cast<slider_constra
int_impl_t*>(impl());
slider_impl->set_world(p, r);
}
//local space pivot
void get_world(vec3f& p, quatf& r) const {
slider_constraint_impl_t const* slider_impl = dynamic_cast<slider_c
onstraint_impl_t const*>(impl());
slider_impl->get_world(p, r);
}
public: public:
virtual ~slider_constraint_t() {}; virtual ~slider_constraint_t() {};
protected: protected:
friend class solver_t; friend class solver_t;
slider_constraint_t(slider_constraint_impl_t* impl, rigid_body_t::point
er& rigid_body):
constraint_t(impl),
m_rigid_bodyA(rigid_body)
{
}
slider_constraint_t(slider_constraint_impl_t* impl, rigid_body_t::point er& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB): slider_constraint_t(slider_constraint_impl_t* impl, rigid_body_t::point er& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB):
constraint_t(impl), constraint_t(impl),
m_rigid_bodyA(rigid_bodyA), m_rigid_bodyA(rigid_bodyA),
m_rigid_bodyB(rigid_bodyB) m_rigid_bodyB(rigid_bodyB)
{ {
} }
private: private:
rigid_body_t::pointer m_rigid_bodyA; rigid_body_t::pointer m_rigid_bodyA;
rigid_body_t::pointer m_rigid_bodyB; rigid_body_t::pointer m_rigid_bodyB;
 End of changes. 5 change blocks. 
36 lines changed or deleted 53 lines changed or added


 slider_constraint_impl.h   slider_constraint_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//slider_constraint_impl.h //slider_constraint_impl.h
#ifndef DYN_SLIDER_CONSTRAINT_IMPL_H #ifndef DYN_SLIDER_CONSTRAINT_IMPL_H
#define DYN_SLIDER_CONSTRAINT_IMPL_H #define DYN_SLIDER_CONSTRAINT_IMPL_H
#include "constraint_impl.h" #include "constraint_impl.h"
class slider_constraint_impl_t: public constraint_impl_t class slider_constraint_impl_t: public constraint_impl_t
{ {
public: public:
// //
virtual void set_pivot(vec3f const& p) = 0; virtual void set_world(vec3f const& p, quatf const& r) = 0;
virtual void get_pivot(vec3f& p) const = 0; virtual void get_world(vec3f& p, quatf& r) const = 0;
virtual void get_world_pivot(vec3f& p) const = 0; virtual void get_frameA(vec3f& p, quatf& r) const = 0;
virtual void set_world(vec3f const& p) = 0; virtual void get_frameB(vec3f& p, quatf& r) const = 0;
virtual void get_world(vec3f& p) const = 0; virtual void get_invFrameA(vec3f& p, quatf& r) const = 0;
virtual void get_invFrameB(vec3f& p, quatf& r) const = 0;
virtual void worldToA(vec3f& w, vec3f& p) const = 0;
virtual void worldFromB(vec3f& p, vec3f& w) const = 0;
// //
virtual void set_damping(float d) = 0; virtual void set_damping(float d) = 0;
virtual float damping() const = 0; virtual float damping() const = 0;
virtual void set_LinLimit(float lower, float upper) = 0; virtual void set_LinLimit(float lower, float upper) = 0;
virtual void set_AngLimit(float lower, float upper) = 0; virtual void set_AngLimit(float lower, float upper) = 0;
public: public:
virtual ~slider_constraint_impl_t() {}; virtual ~slider_constraint_impl_t() {};
}; };
 End of changes. 2 change blocks. 
5 lines changed or deleted 11 lines changed or added


 solver.h   solver.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
*/ */
//solver.h //solver.h
//basic class for all solvers //basic class for all solvers
#ifndef DYN_SOLVER_H #ifndef DYN_SOLVER_H
#define DYN_SOLVER_H #define DYN_SOLVER_H
#include <set> #include <set>
skipping to change at line 71 skipping to change at line 74
static convex_hull_shape_t::pointer create_convex_hull_shape(vec3f cons t* vertices, size_t num_vertices, static convex_hull_shape_t::pointer create_convex_hull_shape(vec3f cons t* vertices, size_t num_vertices,
vec3f cons t* normals, vec3f cons t* normals,
unsigned i nt const *indices, size_t num_indices); unsigned i nt const *indices, size_t num_indices);
static mesh_shape_t::pointer create_mesh_shape(vec3f const* vertices, s ize_t num_vertices, static mesh_shape_t::pointer create_mesh_shape(vec3f const* vertices, s ize_t num_vertices,
vec3f const* normals, vec3f const* normals,
unsigned int const *indi ces, size_t num_indices); unsigned int const *indi ces, size_t num_indices);
static rigid_body_t::pointer create_rigid_body(collision_shape_t::point er& cs); static rigid_body_t::pointer create_rigid_body(collision_shape_t::point er& cs);
static nail_constraint_t::pointer create_nail_constraint(rigid_body_t:: static nail_constraint_t::pointer create_nail_constraint(rigid_body_t::
pointer& rb, vec3f const& pivot = vec3f(0, 0, 0)); pointer& rb, vec3f const& pivot);
static hinge_constraint_t::pointer create_hinge_constraint(rigid_body_t static nail_constraint_t::pointer create_nail_constraint(rigid_body_t::
::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0)); pointer& rbA, rigid_body_t::pointer& rbB, vec3f const& pivotInA, vec3f cons
static slider_constraint_t::pointer create_slider_constraint(rigid_body t& pivotInB);
_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f co static hinge_constraint_t::pointer create_hinge_constraint(rigid_body_t
nst& pivotB = vec3f(0, 0, 0)); ::pointer& rb, vec3f const& pivot, quatf const& rot);
static sixdof_constraint_t::pointer create_sixdof_constraint(rigid_body static hinge_constraint_t::pointer create_hinge_constraint(rigid_body_t
_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f co ::pointer& rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_t::point
nst& pivotB = vec3f(0, 0, 0)); er& rbB, vec3f const& pivotB, quatf const& rotB);
static slider_constraint_t::pointer create_slider_constraint(rigid_body
_t::pointer& rb, vec3f const& pivot, quatf const& rot);
static slider_constraint_t::pointer create_slider_constraint(rigid_body
_t::pointer& rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_t::poi
nter& rbB, vec3f const& pivotB, quatf const& rotB);
static sixdof_constraint_t::pointer create_sixdof_constraint(rigid_body
_t::pointer& rb, vec3f const& pivot, quatf const& rot);
static sixdof_constraint_t::pointer create_sixdof_constraint(rigid_body
_t::pointer& rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_t::poi
nter& rbB, vec3f const& pivotB, quatf const& rotB);
//add/remove from world //add/remove from world
static void add_rigid_body(rigid_body_t::pointer& rb); static void add_rigid_body(rigid_body_t::pointer& rb);
static void remove_rigid_body(rigid_body_t::pointer& rb); static void remove_rigid_body(rigid_body_t::pointer& rb);
static void remove_all_rigid_bodies(); static void remove_all_rigid_bodies();
//add/remove from world //add/remove from world
static void add_constraint(constraint_t::pointer& c); static void add_constraint(constraint_t::pointer& c);
static void remove_constraint(constraint_t::pointer& c); static void remove_constraint(constraint_t::pointer& c);
static void remove_all_constraints(); static void remove_all_constraints();
// //
static void set_gravity(vec3f const& g); static void set_gravity(vec3f const& g);
// //
static void set_split_impulse(bool enabled); static void set_split_impulse(bool enabled);
// //
static void step_simulation(float dt); static void step_simulation(float dt);
static void debug_draw(int dbgMode);
static shared_ptr<solver_impl_t> get_solver(); static shared_ptr<solver_impl_t> get_solver();
private: private:
static shared_ptr<solver_impl_t> m_impl; static shared_ptr<solver_impl_t> m_impl;
static std::set<rigid_body_t::pointer> m_rigid_bodies; static std::set<rigid_body_t::pointer> m_rigid_bodies;
static std::set<constraint_t::pointer> m_constraints; static std::set<constraint_t::pointer> m_constraints;
}; };
#endif #endif
 End of changes. 3 change blocks. 
10 lines changed or deleted 25 lines changed or added


 solver_impl.h   solver_impl.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 1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. 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.
Written by: Nicola Candussi <nicola@fluidinteractive.com> Written by: Nicola Candussi <nicola@fluidinteractive.com>
Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked
01/27/2010 : Replaced COLLADA export with Bullet binary export
*/ */
//solver_impl.h //solver_impl.h
#ifndef DYN_SOLVER_IMPL_H #ifndef DYN_SOLVER_IMPL_H
#define DYN_SOLVER_IMPL_H #define DYN_SOLVER_IMPL_H
#include "rigid_body_impl.h" #include "rigid_body_impl.h"
#include "constraint/nail_constraint_impl.h" #include "constraint/nail_constraint_impl.h"
#include "collision_shape_impl.h" #include "collision_shape_impl.h"
skipping to change at line 56 skipping to change at line 60
vec3f const* n ormals, vec3f const* n ormals,
unsigned int c onst *indices, size_t num_indices) = 0; unsigned int c onst *indices, size_t num_indices) = 0;
virtual collision_shape_impl_t* create_mesh_shape(vec3f const* vertices , size_t num_vertices, virtual collision_shape_impl_t* create_mesh_shape(vec3f const* vertices , size_t num_vertices,
vec3f const* n ormals, vec3f const* n ormals,
unsigned int c onst *indices, size_t num_indices) = 0; unsigned int c onst *indices, size_t num_indices) = 0;
virtual rigid_body_impl_t* create_rigid_body(collision_shape_impl_t* cs ) = 0; virtual rigid_body_impl_t* create_rigid_body(collision_shape_impl_t* cs ) = 0;
virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_ t* rb, vec3f const& pivot) = 0; virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_ t* rb, vec3f const& pivot) = 0;
virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_imp virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_
l_t* rb, vec3f const& pivot) = 0; t* rbA, rigid_body_impl_t* rbB, vec3f const& pivotInA, vec3f const& pivotIn
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_i B) = 0;
mpl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivot virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_imp
B) = 0; l_t* rb, vec3f const& pivot, quatf const& rot) = 0;
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_i virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_imp
mpl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivot l_t* rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_impl_t* rbB, v
B) = 0; ec3f const& pivotB, quatf const& rotB) = 0;
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_i
mpl_t* rb, vec3f const& pivot, quatf const& rot) = 0;
virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_i
mpl_t* rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_impl_t* rbB,
vec3f const& pivotB, quatf const& rotB) = 0;
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_i
mpl_t* rb, vec3f const& pivot, quatf const& rot) = 0;
virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_i
mpl_t* rbA, vec3f const& pivotA, quatf const& rotA, rigid_body_impl_t* rbB,
vec3f const& pivotB, quatf const& rotB) = 0;
virtual void add_rigid_body(rigid_body_impl_t* rb) = 0; virtual void add_rigid_body(rigid_body_impl_t* rb) = 0;
virtual void remove_rigid_body(rigid_body_impl_t* rb) = 0; virtual void remove_rigid_body(rigid_body_impl_t* rb) = 0;
virtual void add_constraint(constraint_impl_t* rb) = 0; virtual void add_constraint(constraint_impl_t* rb) = 0;
virtual void remove_constraint(constraint_impl_t* rb) = 0; virtual void remove_constraint(constraint_impl_t* rb) = 0;
virtual void set_gravity(vec3f const& g) = 0; virtual void set_gravity(vec3f const& g) = 0;
virtual void set_split_impulse(bool enabled) = 0; virtual void set_split_impulse(bool enabled) = 0;
virtual void export_collada_file(const char* fileName) = 0; virtual void export_bullet_file(const char* fileName) = 0;
virtual void import_collada_file(const char* filename) = 0; virtual void import_bullet_file(const char* filename) = 0;
virtual void step_simulation(float dt) = 0; virtual void step_simulation(float dt) = 0;
virtual void debug_draw(int dbgMode) {}
public: public:
virtual ~solver_impl_t() { } virtual ~solver_impl_t() { }
}; };
#endif #endif
 End of changes. 5 change blocks. 
10 lines changed or deleted 26 lines changed or added


 vectormath2bullet.h   vectormath2bullet.h 
skipping to change at line 33 skipping to change at line 33
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T HE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF T HE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef AOS_VECTORMATH_BULLET_CONVERT_H #ifndef AOS_VECTORMATH_BULLET_CONVERT_H
#define AOS_VECTORMATH_BULLET_CONVERT_H #define AOS_VECTORMATH_BULLET_CONVERT_H
///only use a system-wide vectormath_aos.h on CELLOS_LV2 or if USE_SYSTEM_V
ECTORMATH
#if defined(__CELLOS_LV2__) || defined (USE_SYSTEM_VECTORMATH)
#include <vectormath_aos.h> #include <vectormath_aos.h>
//#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h" #else
#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h"
#endif
#include "LinearMath/btVector3.h" #include "LinearMath/btVector3.h"
#include "LinearMath/btQuaternion.h" #include "LinearMath/btQuaternion.h"
#include "LinearMath/btMatrix3x3.h" #include "LinearMath/btMatrix3x3.h"
inline Vectormath::Aos::Vector3 getVmVector3(const btVector3& bullet Vec) inline Vectormath::Aos::Vector3 getVmVector3(const btVector3& bullet Vec)
{ {
return Vectormath::Aos::Vector3(bulletVec.getX(),bulletVec.getY(),bu lletVec.getZ()); return Vectormath::Aos::Vector3(bulletVec.getX(),bulletVec.getY(),bu lletVec.getZ());
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 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/