Browse Source

(Perhaps) fixing BulletContact crashes on Linux

enn0x 14 years ago
parent
commit
4546fb9e77

+ 2 - 0
dtool/src/parser-inc/btBulletDynamicsCommon.h

@@ -76,6 +76,8 @@ class btTypedObject;
 class btVector3;
 class btVector3;
 class btVehicleRaycaster;
 class btVehicleRaycaster;
 
 
+template <typename T> class btAlignedObjectArray;
+
 class btWheelInfo {
 class btWheelInfo {
 public:
 public:
   class RaycastInfo;
   class RaycastInfo;

+ 1 - 1
panda/src/bullet/bulletContactResult.I

@@ -43,7 +43,7 @@ get_node1() const {
 INLINE const BulletManifoldPoint *BulletContact::
 INLINE const BulletManifoldPoint *BulletContact::
 get_manifold_point() const {
 get_manifold_point() const {
 
 
-  return new BulletManifoldPoint(*_mp);
+  return new BulletManifoldPoint(_mp);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 1 - 2
panda/src/bullet/bulletContactResult.cxx

@@ -36,10 +36,9 @@ addSingleResult(btManifoldPoint &mp,
                 const btCollisionObject *obj0, int part_id0, int idx0,
                 const btCollisionObject *obj0, int part_id0, int idx0,
                 const btCollisionObject *obj1, int part_id1, int idx1) {
                 const btCollisionObject *obj1, int part_id1, int idx1) {
 
 
-
   BulletContact contact;
   BulletContact contact;
 
 
-  contact._mp = &mp;
+  contact._mp = mp;
   contact._obj0 = obj0;
   contact._obj0 = obj0;
   contact._obj1 = obj1;
   contact._obj1 = obj1;
   contact._part_id0 = part_id0;
   contact._part_id0 = part_id0;

+ 2 - 2
panda/src/bullet/bulletContactResult.h

@@ -38,7 +38,7 @@ PUBLISHED:
   INLINE const int get_part_id1() const;
   INLINE const int get_part_id1() const;
 
 
 private:
 private:
-  btManifoldPoint *_mp;
+  btManifoldPoint _mp;
   const btCollisionObject *_obj0;
   const btCollisionObject *_obj0;
   const btCollisionObject *_obj1;
   const btCollisionObject *_obj1;
   int _part_id0;
   int _part_id0;
@@ -71,7 +71,7 @@ protected:
 private:
 private:
   static BulletContact _empty;
   static BulletContact _empty;
 
 
-  pvector<BulletContact> _contacts;
+  btAlignedObjectArray<BulletContact> _contacts;
 
 
   friend class BulletWorld;
   friend class BulletWorld;
 };
 };

+ 2 - 2
panda/src/bullet/bulletManifoldPoint.cxx

@@ -20,7 +20,7 @@
 //  Description:
 //  Description:
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 BulletManifoldPoint::
 BulletManifoldPoint::
-BulletManifoldPoint(btManifoldPoint &pt) : _pt(pt) {
+BulletManifoldPoint(const btManifoldPoint &pt) : _pt(pt) {
 
 
 }
 }
 
 
@@ -30,7 +30,7 @@ BulletManifoldPoint(btManifoldPoint &pt) : _pt(pt) {
 //  Description:
 //  Description:
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 int BulletManifoldPoint::
 int BulletManifoldPoint::
-get_lift_time() const {
+get_life_time() const {
 
 
   return _pt.getLifeTime();
   return _pt.getLifeTime();
 }
 }

+ 3 - 3
panda/src/bullet/bulletManifoldPoint.h

@@ -31,7 +31,7 @@ class EXPCL_PANDABULLET BulletManifoldPoint {
 PUBLISHED:
 PUBLISHED:
   INLINE ~BulletManifoldPoint();
   INLINE ~BulletManifoldPoint();
 
 
-  int get_lift_time() const;
+  int get_life_time() const;
   PN_stdfloat get_distance() const;
   PN_stdfloat get_distance() const;
   PN_stdfloat get_applied_impulse() const;
   PN_stdfloat get_applied_impulse() const;
   LPoint3 get_position_world_on_a() const;
   LPoint3 get_position_world_on_a() const;
@@ -45,10 +45,10 @@ PUBLISHED:
   int get_index1() const;
   int get_index1() const;
 
 
 public:
 public:
-  BulletManifoldPoint(btManifoldPoint &pt);
+  BulletManifoldPoint(const btManifoldPoint &pt);
 
 
 private:
 private:
-  btManifoldPoint &_pt;
+  const btManifoldPoint _pt;
 };
 };
 
 
 #include "bulletManifoldPoint.I"
 #include "bulletManifoldPoint.I"

+ 23 - 0
panda/src/bullet/bulletWorld.cxx

@@ -64,6 +64,29 @@ BulletWorld() {
   // Dispatcher
   // Dispatcher
   _dispatcher = new btCollisionDispatcher(_configuration);
   _dispatcher = new btCollisionDispatcher(_configuration);
 
 
+/*
+  _dispatcher.registerCollisionCreateFunc(
+    BroadphaseNativeType.ConvexTriangleMeshShape,
+    BroadphaseNativeType.ConvexTriangleMeshShape,
+    dcc.GetCollisionAlgorithmCreateFunc(
+      BroadphaseNativeType.TriangleMeshShape,
+      BroadphaseNativeType.TriangleMeshShape));
+
+  _dispatcher.registerCollisionCreateFunc(
+      BroadphaseNativeType.TriangleMeshShape,
+      BroadphaseNativeType.TriangleMeshShape,
+      dcc.GetCollisionAlgorithmCreateFunc(
+        BroadphaseNativeType.ConvexTriangleMeshShape,
+        BroadphaseNativeType.ConvexTriangleMeshShape));
+
+  _dispatcher.registerCollisionCreateFunc(
+     BroadphaseNativeType.ConvexTriangleMeshShape,
+     BroadphaseNativeType.ConvexTriangleMeshShape,
+     dcc.GetCollisionAlgorithmCreateFunc(
+       BroadphaseNativeType.ConvexTriangleMeshShape,
+       BroadphaseNativeType.ConvexTriangleMeshShape));
+*/
+
   // Solver
   // Solver
   _solver = new btSequentialImpulseConstraintSolver;
   _solver = new btSequentialImpulseConstraintSolver;