aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2013-01-01 20:26:31 -0800
committerRobert Adams2013-01-04 17:06:48 -0800
commit2eda385f5e72e165150d0925c56b1188c77cafe8 (patch)
tree1708456178efde631dc397874880aa0d7d2bfb16
parentminor: Rename BUILDING.txt to BUILDING.md in distbin distribution nant target (diff)
downloadopensim-SC_OLD-2eda385f5e72e165150d0925c56b1188c77cafe8.zip
opensim-SC_OLD-2eda385f5e72e165150d0925c56b1188c77cafe8.tar.gz
opensim-SC_OLD-2eda385f5e72e165150d0925c56b1188c77cafe8.tar.bz2
opensim-SC_OLD-2eda385f5e72e165150d0925c56b1188c77cafe8.tar.xz
BulletSim: add ResetBroadphasePool and ResetConstraintSolver diagnostic
functions. If values set from console, the functions are called. Looking for why the collision pools fill up with unnecessary stuff.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs22
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs57
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs16
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs28
-rwxr-xr-xbin/lib32/BulletSim.dllbin551936 -> 551936 bytes
-rwxr-xr-xbin/lib32/libBulletSim.sobin1719480 -> 1715168 bytes
-rwxr-xr-xbin/lib64/BulletSim.dllbin700928 -> 700928 bytes
-rwxr-xr-xbin/lib64/libBulletSim.sobin1857745 -> 1857493 bytes
8 files changed, 73 insertions, 50 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index 8c6e7d6..45ecf56 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -530,12 +530,12 @@ public override void SetForceUpdateAllAabbs(BulletWorld world, bool force)
530// btDynamicsWorld entries 530// btDynamicsWorld entries
531public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) 531public override bool AddObjectToWorld(BulletWorld world, BulletBody obj)
532{ 532{
533 // Bullet resets several variables when an object is added to the world.
534 // Gravity is reset to world default depending on the static/dynamic
535 // type. Of course, the collision flags in the broadphase proxy are initialized to default.
536 BulletWorldUnman worldu = world as BulletWorldUnman; 533 BulletWorldUnman worldu = world as BulletWorldUnman;
537 BulletBodyUnman bodyu = obj as BulletBodyUnman; 534 BulletBodyUnman bodyu = obj as BulletBodyUnman;
538 535
536 // Bullet resets several variables when an object is added to the world.
537 // Gravity is reset to world default depending on the static/dynamic
538 // type. Of course, the collision flags in the broadphase proxy are initialized to default.
539 Vector3 origGrav = BSAPICPP.GetGravity2(bodyu.ptr); 539 Vector3 origGrav = BSAPICPP.GetGravity2(bodyu.ptr);
540 540
541 bool ret = BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr); 541 bool ret = BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr);
@@ -1259,6 +1259,16 @@ public override void DumpPhysicsStatistics(BulletWorld world)
1259 BulletWorldUnman worldu = world as BulletWorldUnman; 1259 BulletWorldUnman worldu = world as BulletWorldUnman;
1260 BSAPICPP.DumpPhysicsStatistics2(worldu.ptr); 1260 BSAPICPP.DumpPhysicsStatistics2(worldu.ptr);
1261} 1261}
1262public override void ResetBroadphasePool(BulletWorld world)
1263{
1264 BulletWorldUnman worldu = world as BulletWorldUnman;
1265 BSAPICPP.ResetBroadphasePool(worldu.ptr);
1266}
1267public override void ResetConstraintSolver(BulletWorld world)
1268{
1269 BulletWorldUnman worldu = world as BulletWorldUnman;
1270 BSAPICPP.ResetConstraintSolver(worldu.ptr);
1271}
1262 1272
1263// ===================================================================================== 1273// =====================================================================================
1264// ===================================================================================== 1274// =====================================================================================
@@ -1832,6 +1842,12 @@ public static extern void DumpAllInfo2(IntPtr sim);
1832[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1842[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1833public static extern void DumpPhysicsStatistics2(IntPtr sim); 1843public static extern void DumpPhysicsStatistics2(IntPtr sim);
1834 1844
1845[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1846public static extern void ResetBroadphasePool(IntPtr sim);
1847
1848[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1849public static extern void ResetConstraintSolver(IntPtr sim);
1850
1835} 1851}
1836 1852
1837} 1853}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 30a7bee..0c7f315 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -232,21 +232,25 @@ private sealed class BulletConstraintXNA : BulletConstraint
232 232
233 public override bool AddObjectToWorld(BulletWorld pWorld, BulletBody pBody) 233 public override bool AddObjectToWorld(BulletWorld pWorld, BulletBody pBody)
234 { 234 {
235 DiscreteDynamicsWorld world = ((BulletWorldXNA)pWorld).world;
236 CollisionObject cbody = ((BulletBodyXNA)pBody).body;
237 RigidBody rbody = cbody as RigidBody;
238
235 // Bullet resets several variables when an object is added to the world. In particular, 239 // Bullet resets several variables when an object is added to the world. In particular,
236 // BulletXNA resets position and rotation. Gravity is also reset depending on the static/dynamic 240 // BulletXNA resets position and rotation. Gravity is also reset depending on the static/dynamic
237 // type. Of course, the collision flags in the broadphase proxy are initialized to default. 241 // type. Of course, the collision flags in the broadphase proxy are initialized to default.
238 DiscreteDynamicsWorld world = ((BulletWorldXNA)pWorld).world; 242 IndexedMatrix origPos = cbody.GetWorldTransform();
239 RigidBody body = ((BulletBodyXNA)pBody).rigidBody; 243 if (rbody != null)
240 244 {
241 IndexedMatrix origPos = body.GetWorldTransform(); 245 IndexedVector3 origGrav = rbody.GetGravity();
242 IndexedVector3 origGrav = body.GetGravity(); 246 world.AddRigidBody(rbody);
243 247 rbody.SetGravity(origGrav);
244 //if (!(body.GetCollisionShape().GetShapeType() == BroadphaseNativeTypes.STATIC_PLANE_PROXYTYPE && body.GetCollisionShape().GetShapeType() == BroadphaseNativeTypes.TERRAIN_SHAPE_PROXYTYPE)) 248 }
245 249 else
246 world.AddRigidBody(body); 250 {
247 251 world.AddCollisionObject(rbody);
248 body.SetWorldTransform(origPos); 252 }
249 body.SetGravity(origGrav); 253 cbody.SetWorldTransform(origPos);
250 254
251 pBody.ApplyCollisionMask(pWorld.physicsScene); 255 pBody.ApplyCollisionMask(pWorld.physicsScene);
252 256
@@ -773,35 +777,6 @@ private sealed class BulletConstraintXNA : BulletConstraint
773 body.ApplyTorqueImpulse(ref fSum); 777 body.ApplyTorqueImpulse(ref fSum);
774 } 778 }
775 779
776 public override void DumpRigidBody(BulletWorld p, BulletBody p_2)
777 {
778 //TODO:
779 }
780
781 public override void DumpCollisionShape(BulletWorld p, BulletShape p_2)
782 {
783 //TODO:
784 }
785 public override void DumpConstraint(BulletWorld world, BulletConstraint constrain)
786 {
787 //TODO:
788 }
789
790 public override void DumpActivationInfo(BulletWorld world)
791 {
792 //TODO:
793 }
794
795 public override void DumpAllInfo(BulletWorld world)
796 {
797 //TODO:
798 }
799
800 public override void DumpPhysicsStatistics(BulletWorld world)
801 {
802 //TODO:
803 }
804
805 public override void DestroyObject(BulletWorld p, BulletBody p_2) 780 public override void DestroyObject(BulletWorld p, BulletBody p_2)
806 { 781 {
807 //TODO: 782 //TODO:
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index 8ad78ca..befb076 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -646,17 +646,21 @@ public abstract float GetMargin(BulletShape shape);
646 646
647// ===================================================================================== 647// =====================================================================================
648// Debugging 648// Debugging
649public abstract void DumpRigidBody(BulletWorld sim, BulletBody collisionObject); 649public virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject) { }
650 650
651public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape); 651public virtual void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape) { }
652 652
653public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain); 653public virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain) { }
654 654
655public abstract void DumpActivationInfo(BulletWorld sim); 655public virtual void DumpActivationInfo(BulletWorld sim) { }
656 656
657public abstract void DumpAllInfo(BulletWorld sim); 657public virtual void DumpAllInfo(BulletWorld sim) { }
658 658
659public abstract void DumpPhysicsStatistics(BulletWorld sim); 659public virtual void DumpPhysicsStatistics(BulletWorld sim) { }
660
661public virtual void ResetBroadphasePool(BulletWorld sim) { }
662
663public virtual void ResetConstraintSolver(BulletWorld sim) { }
660 664
661}; 665};
662} 666}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 69ac8cd..b9bd0bf 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -497,6 +497,16 @@ public static class BSParam
497 (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, 497 (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); },
498 (s) => { return (float)s.PhysicsMetricDumpFrames; }, 498 (s) => { return (float)s.PhysicsMetricDumpFrames; },
499 (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), 499 (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ),
500 new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool",
501 0f,
502 (s,cf,p,v) => { ; },
503 (s) => { return 0f; },
504 (s,p,l,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ),
505 new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver",
506 0f,
507 (s,cf,p,v) => { ; },
508 (s) => { return 0f; },
509 (s,p,l,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ),
500 }; 510 };
501 511
502 // Convert a boolean to our numeric true and false values 512 // Convert a boolean to our numeric true and false values
@@ -511,6 +521,24 @@ public static class BSParam
511 return (b == ConfigurationParameters.numericTrue ? true : false); 521 return (b == ConfigurationParameters.numericTrue ? true : false);
512 } 522 }
513 523
524 private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v)
525 {
526 BSScene physScene = pPhysScene;
527 physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate()
528 {
529 physScene.PE.ResetBroadphasePool(physScene.World);
530 });
531 }
532
533 private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v)
534 {
535 BSScene physScene = pPhysScene;
536 physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate()
537 {
538 physScene.PE.ResetConstraintSolver(physScene.World);
539 });
540 }
541
514 // Search through the parameter definitions and return the matching 542 // Search through the parameter definitions and return the matching
515 // ParameterDefn structure. 543 // ParameterDefn structure.
516 // Case does not matter as names are compared after converting to lower case. 544 // Case does not matter as names are compared after converting to lower case.
diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll
index 1f41e04..b01896e 100755
--- a/bin/lib32/BulletSim.dll
+++ b/bin/lib32/BulletSim.dll
Binary files differ
diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so
index 85ff318..d964c11 100755
--- a/bin/lib32/libBulletSim.so
+++ b/bin/lib32/libBulletSim.so
Binary files differ
diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll
index 674af3e..20eed6a 100755
--- a/bin/lib64/BulletSim.dll
+++ b/bin/lib64/BulletSim.dll
Binary files differ
diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so
index 14892a4..5bb28ed 100755
--- a/bin/lib64/libBulletSim.so
+++ b/bin/lib64/libBulletSim.so
Binary files differ