aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
diff options
context:
space:
mode:
authorRobert Adams2012-11-03 21:08:39 -0700
committerRobert Adams2012-11-03 21:16:02 -0700
commit79f7c466a116bf368423d4e18163f34fd8d66ce1 (patch)
tree8acd97fa89b1d900f785cec052fedfac7dde6027 /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
parentBulletSim: search the mesh and hull lists to find shapes if type is not known... (diff)
downloadopensim-SC_OLD-79f7c466a116bf368423d4e18163f34fd8d66ce1.zip
opensim-SC_OLD-79f7c466a116bf368423d4e18163f34fd8d66ce1.tar.gz
opensim-SC_OLD-79f7c466a116bf368423d4e18163f34fd8d66ce1.tar.bz2
opensim-SC_OLD-79f7c466a116bf368423d4e18163f34fd8d66ce1.tar.xz
BulletSim: fix compound linkset crash by not freeing shape of child prims.
Remove all compilation warnings (mostly 'protected' in sealed classes.) Add the dynamicAabbEnable parameter to creation of compound shapes.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 4a31c7d..29a23c0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -38,7 +38,7 @@ public sealed class BSShapeCollection : IDisposable
38{ 38{
39 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]"; 39 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]";
40 40
41 protected BSScene PhysicsScene { get; set; } 41 private BSScene PhysicsScene { get; set; }
42 42
43 private Object m_collectionActivityLock = new Object(); 43 private Object m_collectionActivityLock = new Object();
44 44
@@ -103,11 +103,12 @@ public sealed class BSShapeCollection : IDisposable
103 { 103 {
104 // Do we have the correct geometry for this type of object? 104 // Do we have the correct geometry for this type of object?
105 // Updates prim.BSShape with information/pointers to shape. 105 // Updates prim.BSShape with information/pointers to shape.
106 // CreateGeom returns 'true' of BSShape as changed to a new shape. 106 // Returns 'true' of BSShape is changed to a new shape.
107 bool newGeom = CreateGeom(forceRebuild, prim, shapeCallback); 107 bool newGeom = CreateGeom(forceRebuild, prim, shapeCallback);
108 // If we had to select a new shape geometry for the object, 108 // If we had to select a new shape geometry for the object,
109 // rebuild the body around it. 109 // rebuild the body around it.
110 // Updates prim.BSBody with information/pointers to requested body 110 // Updates prim.BSBody with information/pointers to requested body
111 // Returns 'true' if BSBody was changed.
111 bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, 112 bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World,
112 prim.PhysShape, bodyCallback); 113 prim.PhysShape, bodyCallback);
113 ret = newGeom || newBody; 114 ret = newGeom || newBody;
@@ -431,6 +432,7 @@ public sealed class BSShapeCollection : IDisposable
431 return ret; 432 return ret;
432 } 433 }
433 434
435 // Create a mesh/hull shape or a native shape if 'nativeShapePossible' is 'true'.
434 private bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) 436 private bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback)
435 { 437 {
436 bool ret = false; 438 bool ret = false;
@@ -797,15 +799,17 @@ public sealed class BSShapeCollection : IDisposable
797 private bool GetReferenceToCompoundShape(BSPhysObject prim, ShapeDestructionCallback shapeCallback) 799 private bool GetReferenceToCompoundShape(BSPhysObject prim, ShapeDestructionCallback shapeCallback)
798 { 800 {
799 // Remove reference to the old shape 801 // Remove reference to the old shape
800 // Don't need to do this as the shape is freed when we create the new root shape below. 802 // Don't need to do this as the shape is freed when the new root shape is created below.
801 // DereferenceShape(prim.PhysShape, true, shapeCallback); 803 // DereferenceShape(prim.PhysShape, true, shapeCallback);
802 804
803 BulletShape cShape = new BulletShape( 805 BulletShape cShape = new BulletShape(
804 BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr), ShapeData.PhysicsShapeType.SHAPE_COMPOUND); 806 BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), ShapeData.PhysicsShapeType.SHAPE_COMPOUND);
805 807
806 // Create the shape for the root prim and add it to the compound shape 808 // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape.
807 CreateGeomNonSpecial(true, prim, null); 809 CreateGeomMeshOrHull(prim, shapeCallback);
808 BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity); 810 BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity);
811 DetailLog("{0},BSShapeCollection.GetReferenceToCompoundShape,addRootPrim,compShape={1},rootShape={2}",
812 prim.LocalID, cShape, prim.PhysShape);
809 813
810 prim.PhysShape = cShape; 814 prim.PhysShape = cShape;
811 815