BulletSim: update unmanaged API for HACD parameter passing. Bullet HACD

mesh to hull conversion calls in place but code not working. Update
BulletSim DLLs and SOs for new API and HACD code.
user_profiles
Robert Adams 2013-04-01 11:10:05 -07:00
parent ebc1209fc9
commit 17aef1c883
7 changed files with 20 additions and 6 deletions

View File

@ -259,12 +259,12 @@ public override BulletShape CreateHullShape(BulletWorld world, int hullCount, fl
BSPhysicsShapeType.SHAPE_HULL);
}
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms)
{
BulletWorldUnman worldu = world as BulletWorldUnman;
BulletShapeUnman shapeu = meshShape as BulletShapeUnman;
return new BulletShapeUnman(
BSAPICPP.BuildHullShapeFromMesh2(worldu.ptr, shapeu.ptr),
BSAPICPP.BuildHullShapeFromMesh2(worldu.ptr, shapeu.ptr, parms),
BSPhysicsShapeType.SHAPE_HULL);
}
@ -1411,7 +1411,7 @@ public static extern IntPtr CreateHullShape2(IntPtr world,
int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape, HACDParams parms);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);

View File

@ -1773,10 +1773,9 @@ private sealed class BulletConstraintXNA : BulletConstraint
return new BulletShapeXNA(compoundshape, BSPhysicsShapeType.SHAPE_HULL);
}
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms)
{
/* TODO */ return null;
}
public override BulletShape CreateMeshShape(BulletWorld pWorld, int pIndicesCount, int[] indices, int pVerticesCount, float[] verticesAsFloats)

View File

@ -191,6 +191,21 @@ public struct ConfigurationParameters
public const float numericFalse = 0f;
}
// Parameters passed for the conversion of a mesh to a hull using Bullet's HACD library.
[StructLayout(LayoutKind.Sequential)]
public struct HACDParams
{
// usual default values
public float maxVerticesPerHull; // 100
public float minClusters; // 2
public float compacityWeight; // 0.1
public float volumeWeight; // 0.0
public float concavity; // 100
public float addExtraDistPoints; // false
public float addNeighboursDistPoints; // false
public float addFacesPoints; // false
public float shouldAdjustCollisionMargin; // false
}
// The states a bullet collision object can have
public enum ActivationState : uint
@ -308,7 +323,7 @@ public abstract BulletShape CreateMeshShape(BulletWorld world,
public abstract BulletShape CreateHullShape(BulletWorld world,
int hullCount, float[] hulls);
public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape);
public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms);
public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.