aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorRobert Adams2012-12-31 16:54:39 -0800
committerRobert Adams2012-12-31 19:57:25 -0800
commit9396ccc078516023d63b5a86b3262ff97a1e97fb (patch)
treee02d28a4bf16a98625f359358f883e866f5339d4 /OpenSim/Region/Physics/BulletSPlugin
parentBulletSim: complete movement of BulletSimAPI functions to BSAPITemplate. (diff)
downloadopensim-SC_OLD-9396ccc078516023d63b5a86b3262ff97a1e97fb.zip
opensim-SC_OLD-9396ccc078516023d63b5a86b3262ff97a1e97fb.tar.gz
opensim-SC_OLD-9396ccc078516023d63b5a86b3262ff97a1e97fb.tar.bz2
opensim-SC_OLD-9396ccc078516023d63b5a86b3262ff97a1e97fb.tar.xz
BulletSim: eliminate the use of the unmanaged HeightMapInfo structure.
Remove all related calls from the unmanaged and BSAPITemplate interfaces. Update DLLs and SOs to include the version without HeightMapInfo structures.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs26
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs18
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs14
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs4
4 files changed, 20 insertions, 42 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index 0355b94..cf37e56 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -108,10 +108,6 @@ private void BulletLoggerPhysLog(string msg)
108 PhysicsScene.DetailLog("[BULLETS UNMANAGED]:" + msg); 108 PhysicsScene.DetailLog("[BULLETS UNMANAGED]:" + msg);
109} 109}
110 110
111 /*
112public void SetHeightMap(BulletWorld world, float[] heightmap);
113
114 */
115public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, 111public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
116 out int updatedEntityCount, out int collidersCount) 112 out int updatedEntityCount, out int collidersCount)
117{ 113{
@@ -277,6 +273,7 @@ public override void DestroyObject(BulletWorld sim, BulletBody obj)
277 273
278// ===================================================================================== 274// =====================================================================================
279// Terrain creation and helper routines 275// Terrain creation and helper routines
276 /*
280public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, 277public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
281 float[] heightMap, float collisionMargin) 278 float[] heightMap, float collisionMargin)
282{ 279{
@@ -293,15 +290,18 @@ public override bool ReleaseHeightMapInfo(IntPtr heightMapInfo)
293{ 290{
294 return BSAPICPP.ReleaseHeightMapInfo2(heightMapInfo); 291 return BSAPICPP.ReleaseHeightMapInfo2(heightMapInfo);
295} 292}
293 */
296 294
297public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin) 295public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin)
298{ 296{
299 return new BulletShape(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE); 297 return new BulletShape(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE);
300} 298}
301 299
302public override BulletShape CreateTerrainShape(IntPtr mapInfo) 300public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
301 float scaleFactor, float collisionMargin)
303{ 302{
304 return new BulletShape(BSAPICPP.CreateTerrainShape2(mapInfo), BSPhysicsShapeType.SHAPE_TERRAIN); 303 return new BulletShape(BSAPICPP.CreateTerrainShape2(id, size, minHeight, maxHeight, heightMap, scaleFactor, collisionMargin),
304 BSPhysicsShapeType.SHAPE_TERRAIN);
305} 305}
306 306
307// ===================================================================================== 307// =====================================================================================
@@ -977,11 +977,6 @@ public override void DumpCollisionShape(BulletWorld sim, BulletShape collisionSh
977 BSAPICPP.DumpCollisionShape2(sim.ptr, collisionShape.ptr); 977 BSAPICPP.DumpCollisionShape2(sim.ptr, collisionShape.ptr);
978} 978}
979 979
980public override void DumpMapInfo(BulletWorld sim, BulletHMapInfo mapInfo)
981{
982 BSAPICPP.DumpMapInfo2(sim.ptr, mapInfo.ptr);
983}
984
985public override void DumpConstraint(BulletWorld sim, BulletConstraint constrain) 980public override void DumpConstraint(BulletWorld sim, BulletConstraint constrain)
986{ 981{
987 BSAPICPP.DumpConstraint2(sim.ptr, constrain.ptr); 982 BSAPICPP.DumpConstraint2(sim.ptr, constrain.ptr);
@@ -1025,9 +1020,6 @@ public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
1025 DebugLogCallback logRoutine); 1020 DebugLogCallback logRoutine);
1026 1021
1027[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1022[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1028public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
1029
1030[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1031public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, 1023public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
1032 out int updatedEntityCount, out int collidersCount); 1024 out int updatedEntityCount, out int collidersCount);
1033 1025
@@ -1119,6 +1111,7 @@ public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
1119 1111
1120// ===================================================================================== 1112// =====================================================================================
1121// Terrain creation and helper routines 1113// Terrain creation and helper routines
1114 /*
1122[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1115[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1123public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 1116public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
1124 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 1117 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
@@ -1129,12 +1122,15 @@ public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint
1129 1122
1130[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1123[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1131public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); 1124public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
1125 */
1132 1126
1133[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1127[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1134public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); 1128public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
1135 1129
1136[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1130[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1137public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); 1131public static extern IntPtr CreateTerrainShape2(uint id, Vector3 size, float minHeight, float maxHeight,
1132 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap,
1133 float scaleFactor, float collisionMargin);
1138 1134
1139// ===================================================================================== 1135// =====================================================================================
1140// Constraint creation and helper routines 1136// Constraint creation and helper routines
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index 64a886b..a618a21 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -302,10 +302,6 @@ public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet
302 int maxUpdates, ref EntityProperties[] updateArray 302 int maxUpdates, ref EntityProperties[] updateArray
303 ); 303 );
304 304
305 /*
306public abstract void SetHeightMap(BulletWorld world, float[] heightmap);
307
308 */
309public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, 305public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
310 out int updatedEntityCount, out int collidersCount); 306 out int updatedEntityCount, out int collidersCount);
311 307
@@ -369,18 +365,10 @@ public abstract void ReleaseBodyInfo(IntPtr obj);
369public abstract void DestroyObject(BulletWorld sim, BulletBody obj); 365public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
370 366
371// ===================================================================================== 367// =====================================================================================
372// Terrain creation and helper routines
373public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
374 float[] heightMap, float collisionMargin);
375
376public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
377 float[] heightMap, float collisionMargin);
378
379public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo);
380
381public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); 368public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin);
382 369
383public abstract BulletShape CreateTerrainShape(IntPtr mapInfo); 370public abstract BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
371 float scaleFactor, float collisionMargin);
384 372
385// ===================================================================================== 373// =====================================================================================
386// Constraint creation and helper routines 374// Constraint creation and helper routines
@@ -667,8 +655,6 @@ public abstract void DumpRigidBody(BulletWorld sim, BulletBody collisionObject);
667 655
668public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape); 656public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape);
669 657
670public abstract void DumpMapInfo(BulletWorld sim, BulletHMapInfo mapInfo);
671
672public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain); 658public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain);
673 659
674public abstract void DumpActivationInfo(BulletWorld sim); 660public abstract void DumpActivationInfo(BulletWorld sim);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
index 0802b3a..114c0aa 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
@@ -58,7 +58,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
58 { 58 {
59 initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION; 59 initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION;
60 } 60 }
61 m_mapInfo = new BulletHMapInfo(id, initialMap, IntPtr.Zero); 61 m_mapInfo = new BulletHMapInfo(id, initialMap);
62 m_mapInfo.minCoords = minTerrainCoords; 62 m_mapInfo.minCoords = minTerrainCoords;
63 m_mapInfo.maxCoords = maxTerrainCoords; 63 m_mapInfo.maxCoords = maxTerrainCoords;
64 m_mapInfo.terrainRegionBase = TerrainBase; 64 m_mapInfo.terrainRegionBase = TerrainBase;
@@ -72,7 +72,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
72 Vector3 minCoords, Vector3 maxCoords) 72 Vector3 minCoords, Vector3 maxCoords)
73 : base(physicsScene, regionBase, id) 73 : base(physicsScene, regionBase, id)
74 { 74 {
75 m_mapInfo = new BulletHMapInfo(id, initialMap, IntPtr.Zero); 75 m_mapInfo = new BulletHMapInfo(id, initialMap);
76 m_mapInfo.minCoords = minCoords; 76 m_mapInfo.minCoords = minCoords;
77 m_mapInfo.maxCoords = maxCoords; 77 m_mapInfo.maxCoords = maxCoords;
78 m_mapInfo.minZ = minCoords.Z; 78 m_mapInfo.minZ = minCoords.Z;
@@ -91,12 +91,11 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
91 // Using the information in m_mapInfo, create the physical representation of the heightmap. 91 // Using the information in m_mapInfo, create the physical representation of the heightmap.
92 private void BuildHeightmapTerrain() 92 private void BuildHeightmapTerrain()
93 { 93 {
94 m_mapInfo.ptr = PhysicsScene.PE.CreateHeightMapInfo(PhysicsScene.World, m_mapInfo.ID,
95 m_mapInfo.minCoords, m_mapInfo.maxCoords,
96 m_mapInfo.heightMap, BSParam.TerrainCollisionMargin);
97
98 // Create the terrain shape from the mapInfo 94 // Create the terrain shape from the mapInfo
99 m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape(m_mapInfo.ptr); 95 m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape( m_mapInfo.ID,
96 new Vector3(m_mapInfo.sizeX, m_mapInfo.sizeY, 0), m_mapInfo.minZ, m_mapInfo.maxZ,
97 m_mapInfo.heightMap, 1f, BSParam.TerrainCollisionMargin);
98
100 99
101 // The terrain object initial position is at the center of the object 100 // The terrain object initial position is at the center of the object
102 Vector3 centerPos; 101 Vector3 centerPos;
@@ -138,7 +137,6 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
138 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_mapInfo.terrainBody); 137 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_mapInfo.terrainBody);
139 // Frees both the body and the shape. 138 // Frees both the body and the shape.
140 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody); 139 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody);
141 PhysicsScene.PE.ReleaseHeightMapInfo(m_mapInfo.ptr);
142 } 140 }
143 } 141 }
144 m_mapInfo = null; 142 m_mapInfo = null;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index c8f4602..681d21e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -189,9 +189,8 @@ public class BulletConstraint
189// than making copies. 189// than making copies.
190public class BulletHMapInfo 190public class BulletHMapInfo
191{ 191{
192 public BulletHMapInfo(uint id, float[] hm, IntPtr xx) { 192 public BulletHMapInfo(uint id, float[] hm) {
193 ID = id; 193 ID = id;
194 ptr = xx;
195 heightMap = hm; 194 heightMap = hm;
196 terrainRegionBase = OMV.Vector3.Zero; 195 terrainRegionBase = OMV.Vector3.Zero;
197 minCoords = new OMV.Vector3(100f, 100f, 25f); 196 minCoords = new OMV.Vector3(100f, 100f, 25f);
@@ -200,7 +199,6 @@ public class BulletHMapInfo
200 sizeX = sizeY = 256f; 199 sizeX = sizeY = 256f;
201 } 200 }
202 public uint ID; 201 public uint ID;
203 public IntPtr ptr;
204 public float[] heightMap; 202 public float[] heightMap;
205 public OMV.Vector3 terrainRegionBase; 203 public OMV.Vector3 terrainRegionBase;
206 public OMV.Vector3 minCoords; 204 public OMV.Vector3 minCoords;