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.0.7.5-pf-bulletsim
parent
3d0fc70864
commit
9396ccc078
|
@ -108,10 +108,6 @@ private void BulletLoggerPhysLog(string msg)
|
|||
PhysicsScene.DetailLog("[BULLETS UNMANAGED]:" + msg);
|
||||
}
|
||||
|
||||
/*
|
||||
public void SetHeightMap(BulletWorld world, float[] heightmap);
|
||||
|
||||
*/
|
||||
public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
|
||||
out int updatedEntityCount, out int collidersCount)
|
||||
{
|
||||
|
@ -277,6 +273,7 @@ public override void DestroyObject(BulletWorld sim, BulletBody obj)
|
|||
|
||||
// =====================================================================================
|
||||
// Terrain creation and helper routines
|
||||
/*
|
||||
public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
|
||||
float[] heightMap, float collisionMargin)
|
||||
{
|
||||
|
@ -293,15 +290,18 @@ public override bool ReleaseHeightMapInfo(IntPtr heightMapInfo)
|
|||
{
|
||||
return BSAPICPP.ReleaseHeightMapInfo2(heightMapInfo);
|
||||
}
|
||||
*/
|
||||
|
||||
public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin)
|
||||
{
|
||||
return new BulletShape(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE);
|
||||
}
|
||||
|
||||
public override BulletShape CreateTerrainShape(IntPtr mapInfo)
|
||||
public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||
float scaleFactor, float collisionMargin)
|
||||
{
|
||||
return new BulletShape(BSAPICPP.CreateTerrainShape2(mapInfo), BSPhysicsShapeType.SHAPE_TERRAIN);
|
||||
return new BulletShape(BSAPICPP.CreateTerrainShape2(id, size, minHeight, maxHeight, heightMap, scaleFactor, collisionMargin),
|
||||
BSPhysicsShapeType.SHAPE_TERRAIN);
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
@ -977,11 +977,6 @@ public override void DumpCollisionShape(BulletWorld sim, BulletShape collisionSh
|
|||
BSAPICPP.DumpCollisionShape2(sim.ptr, collisionShape.ptr);
|
||||
}
|
||||
|
||||
public override void DumpMapInfo(BulletWorld sim, BulletHMapInfo mapInfo)
|
||||
{
|
||||
BSAPICPP.DumpMapInfo2(sim.ptr, mapInfo.ptr);
|
||||
}
|
||||
|
||||
public override void DumpConstraint(BulletWorld sim, BulletConstraint constrain)
|
||||
{
|
||||
BSAPICPP.DumpConstraint2(sim.ptr, constrain.ptr);
|
||||
|
@ -1024,9 +1019,6 @@ public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
|
|||
int maxUpdates, IntPtr updateArray,
|
||||
DebugLogCallback logRoutine);
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
|
||||
out int updatedEntityCount, out int collidersCount);
|
||||
|
@ -1119,6 +1111,7 @@ public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
|
|||
|
||||
// =====================================================================================
|
||||
// Terrain creation and helper routines
|
||||
/*
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
|
||||
[MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
|
||||
|
@ -1129,12 +1122,15 @@ public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint
|
|||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
|
||||
*/
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
|
||||
public static extern IntPtr CreateTerrainShape2(uint id, Vector3 size, float minHeight, float maxHeight,
|
||||
[MarshalAs(UnmanagedType.LPArray)] float[] heightMap,
|
||||
float scaleFactor, float collisionMargin);
|
||||
|
||||
// =====================================================================================
|
||||
// Constraint creation and helper routines
|
||||
|
|
|
@ -302,10 +302,6 @@ public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet
|
|||
int maxUpdates, ref EntityProperties[] updateArray
|
||||
);
|
||||
|
||||
/*
|
||||
public abstract void SetHeightMap(BulletWorld world, float[] heightmap);
|
||||
|
||||
*/
|
||||
public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
|
||||
out int updatedEntityCount, out int collidersCount);
|
||||
|
||||
|
@ -369,18 +365,10 @@ public abstract void ReleaseBodyInfo(IntPtr obj);
|
|||
public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
|
||||
|
||||
// =====================================================================================
|
||||
// Terrain creation and helper routines
|
||||
public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
|
||||
float[] heightMap, float collisionMargin);
|
||||
|
||||
public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
|
||||
float[] heightMap, float collisionMargin);
|
||||
|
||||
public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo);
|
||||
|
||||
public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin);
|
||||
|
||||
public abstract BulletShape CreateTerrainShape(IntPtr mapInfo);
|
||||
public abstract BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||
float scaleFactor, float collisionMargin);
|
||||
|
||||
// =====================================================================================
|
||||
// Constraint creation and helper routines
|
||||
|
@ -667,8 +655,6 @@ public abstract void DumpRigidBody(BulletWorld sim, BulletBody collisionObject);
|
|||
|
||||
public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape);
|
||||
|
||||
public abstract void DumpMapInfo(BulletWorld sim, BulletHMapInfo mapInfo);
|
||||
|
||||
public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain);
|
||||
|
||||
public abstract void DumpActivationInfo(BulletWorld sim);
|
||||
|
|
|
@ -58,7 +58,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
{
|
||||
initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION;
|
||||
}
|
||||
m_mapInfo = new BulletHMapInfo(id, initialMap, IntPtr.Zero);
|
||||
m_mapInfo = new BulletHMapInfo(id, initialMap);
|
||||
m_mapInfo.minCoords = minTerrainCoords;
|
||||
m_mapInfo.maxCoords = maxTerrainCoords;
|
||||
m_mapInfo.terrainRegionBase = TerrainBase;
|
||||
|
@ -72,7 +72,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
Vector3 minCoords, Vector3 maxCoords)
|
||||
: base(physicsScene, regionBase, id)
|
||||
{
|
||||
m_mapInfo = new BulletHMapInfo(id, initialMap, IntPtr.Zero);
|
||||
m_mapInfo = new BulletHMapInfo(id, initialMap);
|
||||
m_mapInfo.minCoords = minCoords;
|
||||
m_mapInfo.maxCoords = maxCoords;
|
||||
m_mapInfo.minZ = minCoords.Z;
|
||||
|
@ -91,12 +91,11 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
// Using the information in m_mapInfo, create the physical representation of the heightmap.
|
||||
private void BuildHeightmapTerrain()
|
||||
{
|
||||
m_mapInfo.ptr = PhysicsScene.PE.CreateHeightMapInfo(PhysicsScene.World, m_mapInfo.ID,
|
||||
m_mapInfo.minCoords, m_mapInfo.maxCoords,
|
||||
m_mapInfo.heightMap, BSParam.TerrainCollisionMargin);
|
||||
|
||||
// Create the terrain shape from the mapInfo
|
||||
m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape(m_mapInfo.ptr);
|
||||
m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape( m_mapInfo.ID,
|
||||
new Vector3(m_mapInfo.sizeX, m_mapInfo.sizeY, 0), m_mapInfo.minZ, m_mapInfo.maxZ,
|
||||
m_mapInfo.heightMap, 1f, BSParam.TerrainCollisionMargin);
|
||||
|
||||
|
||||
// The terrain object initial position is at the center of the object
|
||||
Vector3 centerPos;
|
||||
|
@ -138,7 +137,6 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_mapInfo.terrainBody);
|
||||
// Frees both the body and the shape.
|
||||
PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody);
|
||||
PhysicsScene.PE.ReleaseHeightMapInfo(m_mapInfo.ptr);
|
||||
}
|
||||
}
|
||||
m_mapInfo = null;
|
||||
|
|
|
@ -189,9 +189,8 @@ public class BulletConstraint
|
|||
// than making copies.
|
||||
public class BulletHMapInfo
|
||||
{
|
||||
public BulletHMapInfo(uint id, float[] hm, IntPtr xx) {
|
||||
public BulletHMapInfo(uint id, float[] hm) {
|
||||
ID = id;
|
||||
ptr = xx;
|
||||
heightMap = hm;
|
||||
terrainRegionBase = OMV.Vector3.Zero;
|
||||
minCoords = new OMV.Vector3(100f, 100f, 25f);
|
||||
|
@ -200,7 +199,6 @@ public class BulletHMapInfo
|
|||
sizeX = sizeY = 256f;
|
||||
}
|
||||
public uint ID;
|
||||
public IntPtr ptr;
|
||||
public float[] heightMap;
|
||||
public OMV.Vector3 terrainRegionBase;
|
||||
public OMV.Vector3 minCoords;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue