diff options
Diffstat (limited to 'OpenSim/Region/Physics')
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 | /* | ||
112 | public void SetHeightMap(BulletWorld world, float[] heightmap); | ||
113 | |||
114 | */ | ||
115 | public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | 111 | public 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 | /* | ||
280 | public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, | 277 | public 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 | ||
297 | public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin) | 295 | public 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 | ||
302 | public override BulletShape CreateTerrainShape(IntPtr mapInfo) | 300 | public 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 | ||
980 | public override void DumpMapInfo(BulletWorld sim, BulletHMapInfo mapInfo) | ||
981 | { | ||
982 | BSAPICPP.DumpMapInfo2(sim.ptr, mapInfo.ptr); | ||
983 | } | ||
984 | |||
985 | public override void DumpConstraint(BulletWorld sim, BulletConstraint constrain) | 980 | public 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] |
1028 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); | ||
1029 | |||
1030 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1031 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | 1023 | public 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] |
1123 | public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, | 1116 | public 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] |
1131 | public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); | 1124 | public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); |
1125 | */ | ||
1132 | 1126 | ||
1133 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1127 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1134 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); | 1128 | public 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] |
1137 | public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); | 1131 | public 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 | /* | ||
306 | public abstract void SetHeightMap(BulletWorld world, float[] heightmap); | ||
307 | |||
308 | */ | ||
309 | public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | 305 | public 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); | |||
369 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); | 365 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); |
370 | 366 | ||
371 | // ===================================================================================== | 367 | // ===================================================================================== |
372 | // Terrain creation and helper routines | ||
373 | public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
374 | float[] heightMap, float collisionMargin); | ||
375 | |||
376 | public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
377 | float[] heightMap, float collisionMargin); | ||
378 | |||
379 | public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo); | ||
380 | |||
381 | public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); | 368 | public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); |
382 | 369 | ||
383 | public abstract BulletShape CreateTerrainShape(IntPtr mapInfo); | 370 | public 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 | ||
668 | public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape); | 656 | public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape); |
669 | 657 | ||
670 | public abstract void DumpMapInfo(BulletWorld sim, BulletHMapInfo mapInfo); | ||
671 | |||
672 | public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain); | 658 | public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain); |
673 | 659 | ||
674 | public abstract void DumpActivationInfo(BulletWorld sim); | 660 | public 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. |
190 | public class BulletHMapInfo | 190 | public 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; |