aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs31
1 files changed, 16 insertions, 15 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index e619b48..d5e2172 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -67,8 +67,8 @@ public class BSShapeCollection : IDisposable
67 public DateTime lastReferenced; 67 public DateTime lastReferenced;
68 } 68 }
69 69
70 private Dictionary<ulong, MeshDesc> Meshes = new Dictionary<ulong, MeshDesc>(); 70 private Dictionary<System.UInt64, MeshDesc> Meshes = new Dictionary<System.UInt64, MeshDesc>();
71 private Dictionary<ulong, HullDesc> Hulls = new Dictionary<ulong, HullDesc>(); 71 private Dictionary<System.UInt64, HullDesc> Hulls = new Dictionary<System.UInt64, HullDesc>();
72 private Dictionary<uint, BodyDesc> Bodies = new Dictionary<uint, BodyDesc>(); 72 private Dictionary<uint, BodyDesc> Bodies = new Dictionary<uint, BodyDesc>();
73 73
74 public BSShapeCollection(BSScene physScene) 74 public BSShapeCollection(BSScene physScene)
@@ -121,7 +121,7 @@ public class BSShapeCollection : IDisposable
121 // Track another user of a body 121 // Track another user of a body
122 // We presume the caller has allocated the body. 122 // We presume the caller has allocated the body.
123 // Bodies only have one user so the reference count is either 1 or 0. 123 // Bodies only have one user so the reference count is either 1 or 0.
124 public void ReferenceBody(BulletBody body, bool atTaintTime) 124 public void ReferenceBody(BulletBody body, bool inTaintTime)
125 { 125 {
126 lock (m_collectionActivityLock) 126 lock (m_collectionActivityLock)
127 { 127 {
@@ -147,7 +147,7 @@ public class BSShapeCollection : IDisposable
147 body.ID, body); 147 body.ID, body);
148 } 148 }
149 }; 149 };
150 if (atTaintTime) 150 if (inTaintTime)
151 createOperation(); 151 createOperation();
152 else 152 else
153 PhysicsScene.TaintedObject("BSShapeCollection.ReferenceBody", createOperation); 153 PhysicsScene.TaintedObject("BSShapeCollection.ReferenceBody", createOperation);
@@ -272,7 +272,7 @@ public class BSShapeCollection : IDisposable
272 272
273 // Release the usage of a shape. 273 // Release the usage of a shape.
274 // The collisionObject is released since it is a copy of the real collision shape. 274 // The collisionObject is released since it is a copy of the real collision shape.
275 public void DereferenceShape(BulletShape shape, bool atTaintTime, ShapeDestructionCallback shapeCallback) 275 public void DereferenceShape(BulletShape shape, bool inTaintTime, ShapeDestructionCallback shapeCallback)
276 { 276 {
277 if (shape.ptr == IntPtr.Zero) 277 if (shape.ptr == IntPtr.Zero)
278 return; 278 return;
@@ -294,14 +294,14 @@ public class BSShapeCollection : IDisposable
294 if (shape.ptr != IntPtr.Zero & shape.isNativeShape) 294 if (shape.ptr != IntPtr.Zero & shape.isNativeShape)
295 { 295 {
296 DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", 296 DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}",
297 BSScene.DetailLogZero, shape.ptr.ToString("X"), atTaintTime); 297 BSScene.DetailLogZero, shape.ptr.ToString("X"), inTaintTime);
298 if (shapeCallback != null) shapeCallback(shape); 298 if (shapeCallback != null) shapeCallback(shape);
299 BulletSimAPI.DeleteCollisionShape2(PhysicsScene.World.ptr, shape.ptr); 299 BulletSimAPI.DeleteCollisionShape2(PhysicsScene.World.ptr, shape.ptr);
300 } 300 }
301 break; 301 break;
302 } 302 }
303 }; 303 };
304 if (atTaintTime) 304 if (inTaintTime)
305 { 305 {
306 lock (m_collectionActivityLock) 306 lock (m_collectionActivityLock)
307 { 307 {
@@ -441,7 +441,7 @@ public class BSShapeCollection : IDisposable
441 441
442 // Native shapes are always built independently. 442 // Native shapes are always built independently.
443 newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType); 443 newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType);
444 newShape.shapeKey = (ulong)shapeKey; 444 newShape.shapeKey = (System.UInt64)shapeKey;
445 newShape.isNativeShape = true; 445 newShape.isNativeShape = true;
446 446
447 // Don't need to do a 'ReferenceShape()' here because native shapes are not tracked. 447 // Don't need to do a 'ReferenceShape()' here because native shapes are not tracked.
@@ -461,7 +461,7 @@ public class BSShapeCollection : IDisposable
461 BulletShape newShape = new BulletShape(IntPtr.Zero); 461 BulletShape newShape = new BulletShape(IntPtr.Zero);
462 462
463 float lod; 463 float lod;
464 ulong newMeshKey = ComputeShapeKey(shapeData, pbs, out lod); 464 System.UInt64 newMeshKey = ComputeShapeKey(shapeData, pbs, out lod);
465 465
466 // if this new shape is the same as last time, don't recreate the mesh 466 // if this new shape is the same as last time, don't recreate the mesh
467 if (newMeshKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH) 467 if (newMeshKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH)
@@ -484,7 +484,7 @@ public class BSShapeCollection : IDisposable
484 return true; // 'true' means a new shape has been added to this prim 484 return true; // 'true' means a new shape has been added to this prim
485 } 485 }
486 486
487 private BulletShape CreatePhysicalMesh(string objName, ulong newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 487 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
488 { 488 {
489 IMesh meshData = null; 489 IMesh meshData = null;
490 IntPtr meshPtr; 490 IntPtr meshPtr;
@@ -531,7 +531,7 @@ public class BSShapeCollection : IDisposable
531 BulletShape newShape; 531 BulletShape newShape;
532 532
533 float lod; 533 float lod;
534 ulong newHullKey = ComputeShapeKey(shapeData, pbs, out lod); 534 System.UInt64 newHullKey = ComputeShapeKey(shapeData, pbs, out lod);
535 535
536 // if the hull hasn't changed, don't rebuild it 536 // if the hull hasn't changed, don't rebuild it
537 if (newHullKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) 537 if (newHullKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL)
@@ -554,7 +554,7 @@ public class BSShapeCollection : IDisposable
554 } 554 }
555 555
556 List<ConvexResult> m_hulls; 556 List<ConvexResult> m_hulls;
557 private BulletShape CreatePhysicalHull(string objName, ulong newHullKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 557 private BulletShape CreatePhysicalHull(string objName, System.UInt64 newHullKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
558 { 558 {
559 559
560 IntPtr hullPtr; 560 IntPtr hullPtr;
@@ -667,7 +667,7 @@ public class BSShapeCollection : IDisposable
667 667
668 // Create a hash of all the shape parameters to be used as a key 668 // Create a hash of all the shape parameters to be used as a key
669 // for this particular shape. 669 // for this particular shape.
670 private ulong ComputeShapeKey(ShapeData shapeData, PrimitiveBaseShape pbs, out float retLod) 670 private System.UInt64 ComputeShapeKey(ShapeData shapeData, PrimitiveBaseShape pbs, out float retLod)
671 { 671 {
672 // level of detail based on size and type of the object 672 // level of detail based on size and type of the object
673 float lod = PhysicsScene.MeshLOD; 673 float lod = PhysicsScene.MeshLOD;
@@ -680,10 +680,10 @@ public class BSShapeCollection : IDisposable
680 lod = PhysicsScene.MeshMegaPrimLOD; 680 lod = PhysicsScene.MeshMegaPrimLOD;
681 681
682 retLod = lod; 682 retLod = lod;
683 return (ulong)pbs.GetMeshKey(shapeData.Size, lod); 683 return pbs.GetMeshKey(shapeData.Size, lod);
684 } 684 }
685 // For those who don't want the LOD 685 // For those who don't want the LOD
686 private ulong ComputeShapeKey(ShapeData shapeData, PrimitiveBaseShape pbs) 686 private System.UInt64 ComputeShapeKey(ShapeData shapeData, PrimitiveBaseShape pbs)
687 { 687 {
688 float lod; 688 float lod;
689 return ComputeShapeKey(shapeData, pbs, out lod); 689 return ComputeShapeKey(shapeData, pbs, out lod);
@@ -717,6 +717,7 @@ public class BSShapeCollection : IDisposable
717 717
718 if (mustRebuild || forceRebuild) 718 if (mustRebuild || forceRebuild)
719 { 719 {
720 // Free any old body
720 DereferenceBody(prim.BSBody, true, bodyCallback); 721 DereferenceBody(prim.BSBody, true, bodyCallback);
721 722
722 BulletBody aBody; 723 BulletBody aBody;