Browse Source

* Fix some threading issues in BulletXNA (the managed bullet library), this should better allow you to run it in multiple region scenarios (but why would you really want to do that?) Source in OpenSimLibs.
* Fixed a null ref during shutdown.

teravus 11 years ago
parent
commit
a6af561660

+ 3 - 2
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs

@@ -4089,7 +4089,7 @@ namespace OpenSim.Region.Framework.Scenes
             // For now, we use the NINJA naming scheme for identifying joints.
             // For now, we use the NINJA naming scheme for identifying joints.
             // In the future, we can support other joint specification schemes such as a 
             // In the future, we can support other joint specification schemes such as a 
             // custom checkbox in the viewer GUI.
             // custom checkbox in the viewer GUI.
-            if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
+            if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
             {
             {
                 return IsHingeJoint() || IsBallJoint();
                 return IsHingeJoint() || IsBallJoint();
             }
             }
@@ -4413,7 +4413,8 @@ namespace OpenSim.Region.Framework.Scenes
         public void RemoveFromPhysics()
         public void RemoveFromPhysics()
         {
         {
             ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
             ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
-            ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
+            if (ParentGroup.Scene.PhysicsScene != null)
+                ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
             PhysActor = null;
             PhysActor = null;
         }
         }
 
 

+ 45 - 1
OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs

@@ -1221,6 +1221,50 @@ private sealed class BulletConstraintXNA : BulletConstraint
         //BSParam.TerrainImplementation = 0;
         //BSParam.TerrainImplementation = 0;
         world.SetGravity(new IndexedVector3(0,0,p.gravity));
         world.SetGravity(new IndexedVector3(0,0,p.gravity));
 
 
+        // Turn off Pooling since globals and pooling are bad for threading.
+        BulletGlobals.VoronoiSimplexSolverPool.SetPoolingEnabled(false);
+        BulletGlobals.SubSimplexConvexCastPool.SetPoolingEnabled(false);
+        BulletGlobals.ManifoldPointPool.SetPoolingEnabled(false);
+        BulletGlobals.CastResultPool.SetPoolingEnabled(false);
+        BulletGlobals.SphereShapePool.SetPoolingEnabled(false);
+        BulletGlobals.DbvtNodePool.SetPoolingEnabled(false);
+        BulletGlobals.SingleRayCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.SubSimplexClosestResultPool.SetPoolingEnabled(false);
+        BulletGlobals.GjkPairDetectorPool.SetPoolingEnabled(false);
+        BulletGlobals.DbvtTreeColliderPool.SetPoolingEnabled(false);
+        BulletGlobals.SingleSweepCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.BroadphaseRayTesterPool.SetPoolingEnabled(false);
+        BulletGlobals.ClosestNotMeConvexResultCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.GjkEpaPenetrationDepthSolverPool.SetPoolingEnabled(false);
+        BulletGlobals.ContinuousConvexCollisionPool.SetPoolingEnabled(false);
+        BulletGlobals.DbvtStackDataBlockPool.SetPoolingEnabled(false);
+
+        BulletGlobals.BoxBoxCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.CompoundCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.ConvexConcaveCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.ConvexConvexAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.ConvexPlaneAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.SphereBoxCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.SphereSphereCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.SphereTriangleCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.GImpactCollisionAlgorithmPool.SetPoolingEnabled(false);
+        BulletGlobals.GjkEpaSolver2MinkowskiDiffPool.SetPoolingEnabled(false);
+        BulletGlobals.PersistentManifoldPool.SetPoolingEnabled(false);
+        BulletGlobals.ManifoldResultPool.SetPoolingEnabled(false);
+        BulletGlobals.GJKPool.SetPoolingEnabled(false);
+        BulletGlobals.GIM_ShapeRetrieverPool.SetPoolingEnabled(false);
+        BulletGlobals.TriangleShapePool.SetPoolingEnabled(false);
+        BulletGlobals.SphereTriangleDetectorPool.SetPoolingEnabled(false);
+        BulletGlobals.CompoundLeafCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.GjkConvexCastPool.SetPoolingEnabled(false);
+        BulletGlobals.LocalTriangleSphereCastCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.BridgeTriangleRaycastCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.BridgeTriangleConcaveRaycastCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.BridgeTriangleConvexcastCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.MyNodeOverlapCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.ClosestRayResultCallbackPool.SetPoolingEnabled(false);
+        BulletGlobals.DebugDrawcallbackPool.SetPoolingEnabled(false);
+
         return world;
         return world;
     }
     }
     //m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL
     //m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL
@@ -1914,7 +1958,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
                                                                            heightMap,  scaleFactor,
                                                                            heightMap,  scaleFactor,
                                                                            minHeight, maxHeight, upAxis,
                                                                            minHeight, maxHeight, upAxis,
                                                                             false);
                                                                             false);
-        terrainShape.SetMargin(collisionMargin + 0.5f);
+        terrainShape.SetMargin(collisionMargin);
         terrainShape.SetUseDiamondSubdivision(true);
         terrainShape.SetUseDiamondSubdivision(true);
         terrainShape.SetUserPointer(id);
         terrainShape.SetUserPointer(id);
         return new BulletShapeXNA(terrainShape, BSPhysicsShapeType.SHAPE_TERRAIN);
         return new BulletShapeXNA(terrainShape, BSPhysicsShapeType.SHAPE_TERRAIN);

BIN
bin/BulletXNA.dll


BIN
bin/BulletXNA.pdb