aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSNPlugin
diff options
context:
space:
mode:
authorteravus2013-01-20 08:06:15 -0500
committerteravus2013-01-20 08:06:15 -0500
commit82b954b2125acf3c3647422fbbe543e96b6d4e91 (patch)
treeae08205fd7bc81c9849325d3f091cb26ca576043 /OpenSim/Region/Physics/BulletSNPlugin
parent* Allow unsafe code with BulletSim (diff)
downloadopensim-SC-82b954b2125acf3c3647422fbbe543e96b6d4e91.zip
opensim-SC-82b954b2125acf3c3647422fbbe543e96b6d4e91.tar.gz
opensim-SC-82b954b2125acf3c3647422fbbe543e96b6d4e91.tar.bz2
opensim-SC-82b954b2125acf3c3647422fbbe543e96b6d4e91.tar.xz
* Tweak the BulletSimN API a bit.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSNPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs27
2 files changed, 18 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs
index 1a7c34b..4fc3e2a 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BSScene.cs
@@ -106,11 +106,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
106 106
107 // Pinned memory used to pass step information between managed and unmanaged 107 // Pinned memory used to pass step information between managed and unmanaged
108 internal int m_maxCollisionsPerFrame; 108 internal int m_maxCollisionsPerFrame;
109 private List<BulletXNA.CollisionDesc> m_collisionArray; 109 private BulletXNA.CollisionDesc[] m_collisionArray;
110 //private GCHandle m_collisionArrayPinnedHandle; 110 //private GCHandle m_collisionArrayPinnedHandle;
111 111
112 internal int m_maxUpdatesPerFrame; 112 internal int m_maxUpdatesPerFrame;
113 private List<BulletXNA.EntityProperties> m_updateArray; 113 private BulletXNA.EntityProperties[] m_updateArray;
114 //private GCHandle m_updateArrayPinnedHandle; 114 //private GCHandle m_updateArrayPinnedHandle;
115 115
116 116
@@ -201,9 +201,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
201 GetInitialParameterValues(config); 201 GetInitialParameterValues(config);
202 202
203 // allocate more pinned memory close to the above in an attempt to get the memory all together 203 // allocate more pinned memory close to the above in an attempt to get the memory all together
204 m_collisionArray = new List<BulletXNA.CollisionDesc>(); 204 m_collisionArray = new BulletXNA.CollisionDesc[0];
205 //m_collisionArrayPinnedHandle = GCHandle.Alloc(m_collisionArray, GCHandleType.Pinned); 205 //m_collisionArrayPinnedHandle = GCHandle.Alloc(m_collisionArray, GCHandleType.Pinned);
206 m_updateArray = new List<BulletXNA.EntityProperties>(); 206 m_updateArray = new BulletXNA.EntityProperties[0];
207 //m_updateArrayPinnedHandle = GCHandle.Alloc(m_updateArray, GCHandleType.Pinned); 207 //m_updateArrayPinnedHandle = GCHandle.Alloc(m_updateArray, GCHandleType.Pinned);
208 208
209 // Enable very detailed logging. 209 // Enable very detailed logging.
diff --git a/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs
index 93643c9..ba96905 100644
--- a/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSNPlugin/BulletSimAPI.cs
@@ -894,7 +894,7 @@ static class BulletSimAPI {
894 return capsuleShapeZ; 894 return capsuleShapeZ;
895 } 895 }
896 896
897 public static object Initialize2(Vector3 worldExtent, ConfigurationParameters[] o, int mMaxCollisionsPerFrame, ref List<BulletXNA.CollisionDesc> collisionArray, int mMaxUpdatesPerFrame, ref List<BulletXNA.EntityProperties> updateArray, object mDebugLogCallbackHandle) 897 public static object Initialize2(Vector3 worldExtent, ConfigurationParameters[] o, int mMaxCollisionsPerFrame, ref BulletXNA.CollisionDesc[] collisionArray, int mMaxUpdatesPerFrame, ref BulletXNA.EntityProperties[] updateArray, object mDebugLogCallbackHandle)
898 { 898 {
899 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData(); 899 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();
900 900
@@ -1436,14 +1436,14 @@ static class BulletSimAPI {
1436 1436
1437 } 1437 }
1438 1438
1439 internal static int PhysicsStep2(object pWorld, float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount, out List<BulletXNA.EntityProperties> updatedEntities, out int collidersCount, out List<BulletXNA.CollisionDesc>colliders) 1439 internal static int PhysicsStep2(object pWorld, float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount, out BulletXNA.EntityProperties[] updatedEntities, out int collidersCount, out BulletXNA.CollisionDesc[] colliders)
1440 { 1440 {
1441 int epic = PhysicsStepint2(pWorld, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out updatedEntities, 1441 int epic = PhysicsStepint2(pWorld, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out updatedEntities,
1442 out collidersCount, out colliders); 1442 out collidersCount, out colliders);
1443 return epic; 1443 return epic;
1444 } 1444 }
1445 1445
1446 private static int PhysicsStepint2(object pWorld,float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount, out List<BulletXNA.EntityProperties> updatedEntities, out int collidersCount, out List<BulletXNA.CollisionDesc> colliders) 1446 private static int PhysicsStepint2(object pWorld,float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount, out BulletXNA.EntityProperties[] updatedEntities, out int collidersCount, out BulletXNA.CollisionDesc[] colliders)
1447 { 1447 {
1448 int numSimSteps = 0; 1448 int numSimSteps = 0;
1449 1449
@@ -1462,16 +1462,16 @@ static class BulletSimAPI {
1462 numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep); 1462 numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep);
1463 int updates = 0; 1463 int updates = 0;
1464 1464
1465 updatedEntityCount = world.UpdatedObjects.Count; 1465 updatedEntityCount = world.UpdatedObjects.Length;
1466 updatedEntities = new List<BulletXNA.EntityProperties>(world.UpdatedObjects); 1466 updatedEntities = (world.UpdatedObjects);
1467 updatedEntityCount = updatedEntities.Count; 1467 updatedEntityCount = updatedEntities.Length;
1468 world.UpdatedObjects.Clear(); 1468 //world.UpdatedObjects = ;
1469 1469
1470 1470
1471 collidersCount = world.UpdatedCollisions.Count; 1471 collidersCount = world.UpdatedCollisions.Length;
1472 colliders = new List<BulletXNA.CollisionDesc>(world.UpdatedCollisions); 1472 colliders = (world.UpdatedCollisions);
1473 1473
1474 world.UpdatedCollisions.Clear(); 1474 world.UpdatedCollisions = new BulletXNA.CollisionDesc[0];
1475 m_collisionsThisFrame = 0; 1475 m_collisionsThisFrame = 0;
1476 int numManifolds = world.GetDispatcher().GetNumManifolds(); 1476 int numManifolds = world.GetDispatcher().GetNumManifolds();
1477 for (int j = 0; j < numManifolds; j++) 1477 for (int j = 0; j < numManifolds; j++)
@@ -1501,10 +1501,10 @@ static class BulletSimAPI {
1501 else 1501 else
1502 { 1502 {
1503 //if (updatedEntities is null) 1503 //if (updatedEntities is null)
1504 updatedEntities = new List<BulletXNA.EntityProperties>(); 1504 updatedEntities = new BulletXNA.EntityProperties[0];
1505 updatedEntityCount = 0; 1505 updatedEntityCount = 0;
1506 //if (colliders is null) 1506 //if (colliders is null)
1507 colliders = new List<BulletXNA.CollisionDesc>(); 1507 colliders = new BulletXNA.CollisionDesc[0];
1508 collidersCount = 0; 1508 collidersCount = 0;
1509 } 1509 }
1510 return numSimSteps; 1510 return numSimSteps;
@@ -1538,7 +1538,8 @@ static class BulletSimAPI {
1538 point = contact, 1538 point = contact,
1539 normal = contactNormal 1539 normal = contactNormal
1540 }; 1540 };
1541 world.UpdatedCollisions.Add(cDesc); 1541 if (world.LastCollisionDesc < world.UpdatedCollisions.Length)
1542 world.UpdatedCollisions[world.LastCollisionDesc++] = (cDesc);
1542 m_collisionsThisFrame++; 1543 m_collisionsThisFrame++;
1543 1544
1544 1545