GIMPACT cleanup
This commit is contained in:
Родитель
e14c5d270c
Коммит
709b6d84f5
|
@ -2,3 +2,4 @@ obj
|
|||
bin
|
||||
packages
|
||||
*.suo
|
||||
*.user
|
||||
|
|
|
@ -108,10 +108,10 @@ namespace BulletSharp
|
|||
internal IntPtr Native;
|
||||
private bool _preventDelete;
|
||||
|
||||
internal Aabb(IntPtr native, bool preventDelete)
|
||||
internal Aabb(IntPtr native)
|
||||
{
|
||||
Native = native;
|
||||
_preventDelete = preventDelete;
|
||||
_preventDelete = true;
|
||||
}
|
||||
|
||||
public Aabb()
|
||||
|
|
|
@ -2,45 +2,46 @@ using BulletSharp.Math;
|
|||
|
||||
namespace BulletSharp
|
||||
{
|
||||
class MyCallback : TriangleRaycastCallback
|
||||
{
|
||||
int _ignorePart;
|
||||
int _ignoreTriangleIndex;
|
||||
internal class MyCallback : TriangleRaycastCallback
|
||||
{
|
||||
private readonly int _ignorePart;
|
||||
private readonly int _ignoreTriangleIndex;
|
||||
|
||||
public MyCallback(ref Vector3 from, ref Vector3 to, int ignorePart, int ignoreTriangleIndex)
|
||||
: base(ref from, ref to)
|
||||
public MyCallback(ref Vector3 from, ref Vector3 to, int ignorePart, int ignoreTriangleIndex)
|
||||
: base(ref from, ref to)
|
||||
{
|
||||
_ignorePart = ignorePart;
|
||||
_ignoreTriangleIndex = ignoreTriangleIndex;
|
||||
_ignorePart = ignorePart;
|
||||
_ignoreTriangleIndex = ignoreTriangleIndex;
|
||||
}
|
||||
|
||||
public override float ReportHit(ref Vector3 hitNormalLocal, float hitFraction, int partId, int triangleIndex)
|
||||
{
|
||||
if (partId != _ignorePart || triangleIndex != _ignoreTriangleIndex)
|
||||
{
|
||||
if (hitFraction < HitFraction)
|
||||
return hitFraction;
|
||||
}
|
||||
public override float ReportHit(ref Vector3 hitNormalLocal, float hitFraction, int partId, int triangleIndex)
|
||||
{
|
||||
if (partId != _ignorePart || triangleIndex != _ignoreTriangleIndex)
|
||||
{
|
||||
if (hitFraction < HitFraction)
|
||||
return hitFraction;
|
||||
}
|
||||
|
||||
return HitFraction;
|
||||
}
|
||||
}
|
||||
return HitFraction;
|
||||
}
|
||||
}
|
||||
|
||||
class MyInternalTriangleIndexCallback : InternalTriangleIndexCallback
|
||||
{
|
||||
private CompoundShape _colShape;
|
||||
private float _depth;
|
||||
private GImpactMeshShape _meshShape;
|
||||
internal class MyInternalTriangleIndexCallback : InternalTriangleIndexCallback
|
||||
{
|
||||
private readonly CompoundShape _collisionShape;
|
||||
private readonly float _depth;
|
||||
private readonly GImpactMeshShape _meshShape;
|
||||
//private readonly static Vector3 _redColor = new Vector3(1, 0, 0);
|
||||
|
||||
public MyInternalTriangleIndexCallback(CompoundShape colShape, GImpactMeshShape meshShape, float depth)
|
||||
{
|
||||
_colShape = colShape;
|
||||
_depth = depth;
|
||||
_meshShape = meshShape;
|
||||
}
|
||||
public MyInternalTriangleIndexCallback(CompoundShape collisionShape, GImpactMeshShape meshShape, float depth)
|
||||
{
|
||||
_collisionShape = collisionShape;
|
||||
_depth = depth;
|
||||
_meshShape = meshShape;
|
||||
}
|
||||
|
||||
public override void InternalProcessTriangleIndex(ref Vector3 vertex0, ref Vector3 vertex1, ref Vector3 vertex2, int partId, int triangleIndex)
|
||||
{
|
||||
public override void InternalProcessTriangleIndex(ref Vector3 vertex0, ref Vector3 vertex1, ref Vector3 vertex2, int partId, int triangleIndex)
|
||||
{
|
||||
Vector3 scale = _meshShape.LocalScaling;
|
||||
Vector3 v0 = vertex0 * scale;
|
||||
Vector3 v1 = vertex1 * scale;
|
||||
|
@ -59,31 +60,28 @@ namespace BulletSharp
|
|||
{
|
||||
rayTo = Vector3.Lerp(cb.From, cb.To, cb.HitFraction);
|
||||
//rayTo = cb.From;
|
||||
//gDebugDraw.drawLine(tr(centroid), tr(centroid + normal), btVector3(1, 0, 0));
|
||||
//Vector3 to = centroid + normal;
|
||||
//debugDraw.DrawLine(ref centroid, ref to, ref _redColor);
|
||||
}
|
||||
}
|
||||
|
||||
BuSimplex1To4 tet = new BuSimplex1To4(v0, v1, v2, rayTo);
|
||||
_colShape.AddChildShape(Matrix.Identity, tet);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CompoundFromGImpact
|
||||
{
|
||||
private CompoundFromGImpact()
|
||||
{
|
||||
var triangle = new BuSimplex1To4(v0, v1, v2, rayTo);
|
||||
_collisionShape.AddChildShape(Matrix.Identity, triangle);
|
||||
}
|
||||
}
|
||||
|
||||
public static CompoundShape Create(GImpactMeshShape gImpactMesh, float depth)
|
||||
{
|
||||
CompoundShape colShape = new CompoundShape();
|
||||
using (var cb = new MyInternalTriangleIndexCallback(colShape, gImpactMesh, depth))
|
||||
{
|
||||
Vector3 aabbMin, aabbMax;
|
||||
gImpactMesh.GetAabb(Matrix.Identity, out aabbMin, out aabbMax);
|
||||
gImpactMesh.MeshInterface.InternalProcessAllTriangles(cb, aabbMin, aabbMax);
|
||||
}
|
||||
return colShape;
|
||||
}
|
||||
public static class CompoundFromGImpact
|
||||
{
|
||||
public static CompoundShape Create(GImpactMeshShape impactMesh, float depth)
|
||||
{
|
||||
var shape = new CompoundShape();
|
||||
using (var callback = new MyInternalTriangleIndexCallback(shape, impactMesh, depth))
|
||||
{
|
||||
Vector3 aabbMin, aabbMax;
|
||||
impactMesh.GetAabb(Matrix.Identity, out aabbMin, out aabbMax);
|
||||
impactMesh.MeshInterface.InternalProcessAllTriangles(callback, aabbMin, aabbMax);
|
||||
}
|
||||
return shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +1,37 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using BulletSharp.Math;
|
||||
using System;
|
||||
|
||||
namespace BulletSharp
|
||||
{
|
||||
public class GimPair : IDisposable
|
||||
public class GImpactPair : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
|
||||
internal GimPair(IntPtr native)
|
||||
public GImpactPair()
|
||||
{
|
||||
_native = native;
|
||||
Native = UnsafeNativeMethods.GIM_PAIR_new();
|
||||
}
|
||||
|
||||
public GimPair()
|
||||
public GImpactPair(GImpactPair pair)
|
||||
{
|
||||
_native = GIM_PAIR_new();
|
||||
Native = UnsafeNativeMethods.GIM_PAIR_new2(pair.Native);
|
||||
}
|
||||
|
||||
public GimPair(GimPair p)
|
||||
public GImpactPair(int index1, int index2)
|
||||
{
|
||||
_native = GIM_PAIR_new2(p._native);
|
||||
}
|
||||
|
||||
public GimPair(int index1, int index2)
|
||||
{
|
||||
_native = GIM_PAIR_new3(index1, index2);
|
||||
Native = UnsafeNativeMethods.GIM_PAIR_new3(index1, index2);
|
||||
}
|
||||
|
||||
public int Index1
|
||||
{
|
||||
get { return GIM_PAIR_getIndex1(_native); }
|
||||
set { GIM_PAIR_setIndex1(_native, value); }
|
||||
get { return UnsafeNativeMethods.GIM_PAIR_getIndex1(Native); }
|
||||
set { UnsafeNativeMethods.GIM_PAIR_setIndex1(Native, value); }
|
||||
}
|
||||
|
||||
public int Index2
|
||||
{
|
||||
get { return GIM_PAIR_getIndex2(_native); }
|
||||
set { GIM_PAIR_setIndex2(_native, value); }
|
||||
get { return UnsafeNativeMethods.GIM_PAIR_getIndex2(Native); }
|
||||
set { UnsafeNativeMethods.GIM_PAIR_setIndex2(Native, value); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -49,91 +42,85 @@ namespace BulletSharp
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
GIM_PAIR_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
UnsafeNativeMethods.GIM_PAIR_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
~GimPair()
|
||||
~GImpactPair()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_PAIR_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_PAIR_new2(IntPtr p);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_PAIR_new3(int index1, int index2);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int GIM_PAIR_getIndex1(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int GIM_PAIR_getIndex2(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_PAIR_setIndex1(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_PAIR_setIndex2(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_PAIR_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class PairSet
|
||||
public class PairSet : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
|
||||
internal PairSet(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
}
|
||||
/*
|
||||
public PairSet()
|
||||
{
|
||||
_native = btPairSet_new();
|
||||
Native = UnsafeNativeMethods.btPairSet_new();
|
||||
}
|
||||
*/
|
||||
|
||||
public void PushPair(int index1, int index2)
|
||||
{
|
||||
btPairSet_push_pair(_native, index1, index2);
|
||||
UnsafeNativeMethods.btPairSet_push_pair(Native, index1, index2);
|
||||
}
|
||||
|
||||
public void PushPairInv(int index1, int index2)
|
||||
{
|
||||
btPairSet_push_pair_inv(_native, index1, index2);
|
||||
UnsafeNativeMethods.btPairSet_push_pair_inv(Native, index1, index2);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btPairSet_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPairSet_push_pair(IntPtr obj, int index1, int index2);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPairSet_push_pair_inv(IntPtr obj, int index1, int index2);
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
UnsafeNativeMethods.btPairSet_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
~PairSet()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class GimBvhData : IDisposable
|
||||
public sealed class GImpactBvhData : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
private bool _preventDelete;
|
||||
|
||||
internal GimBvhData(IntPtr native)
|
||||
internal GImpactBvhData(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
Native = native;
|
||||
_preventDelete = true;
|
||||
}
|
||||
|
||||
public GimBvhData()
|
||||
public GImpactBvhData()
|
||||
{
|
||||
_native = GIM_BVH_DATA_new();
|
||||
Native = UnsafeNativeMethods.GIM_BVH_DATA_new();
|
||||
}
|
||||
|
||||
public Aabb Bound
|
||||
{
|
||||
get { return new Aabb(GIM_BVH_DATA_getBound(_native), true); }
|
||||
get { return new Aabb(UnsafeNativeMethods.GIM_BVH_DATA_getBound(Native)); }
|
||||
set { UnsafeNativeMethods.GIM_BVH_DATA_setBound(Native, value.Native); }
|
||||
}
|
||||
|
||||
public int Data
|
||||
{
|
||||
get { return GIM_BVH_DATA_getData(_native); }
|
||||
set { GIM_BVH_DATA_setData(_native, value); }
|
||||
get { return UnsafeNativeMethods.GIM_BVH_DATA_getData(Native); }
|
||||
set { UnsafeNativeMethods.GIM_BVH_DATA_setData(Native, value); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -142,66 +129,59 @@ namespace BulletSharp
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
GIM_BVH_DATA_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
if (!_preventDelete)
|
||||
{
|
||||
UnsafeNativeMethods.GIM_BVH_DATA_delete(Native);
|
||||
}
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
~GimBvhData()
|
||||
~GImpactBvhData()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_BVH_DATA_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_BVH_DATA_getBound(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int GIM_BVH_DATA_getData(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_BVH_DATA_setData(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_BVH_DATA_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class GimBvhTreeNode : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
|
||||
internal GimBvhTreeNode(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
Native = native;
|
||||
}
|
||||
|
||||
public GimBvhTreeNode()
|
||||
{
|
||||
_native = GIM_BVH_TREE_NODE_new();
|
||||
Native = UnsafeNativeMethods.GIM_BVH_TREE_NODE_new();
|
||||
}
|
||||
|
||||
public Aabb Bound
|
||||
{
|
||||
get { return new Aabb(GIM_BVH_TREE_NODE_getBound(_native), true); }
|
||||
get { return new Aabb(UnsafeNativeMethods.GIM_BVH_TREE_NODE_getBound(Native)); }
|
||||
set { UnsafeNativeMethods.GIM_BVH_TREE_NODE_setBound(Native, value.Native); }
|
||||
}
|
||||
|
||||
public int DataIndex
|
||||
{
|
||||
get { return GIM_BVH_TREE_NODE_getDataIndex(_native); }
|
||||
set { GIM_BVH_TREE_NODE_setDataIndex(_native, value); }
|
||||
get { return UnsafeNativeMethods.GIM_BVH_TREE_NODE_getDataIndex(Native); }
|
||||
set { UnsafeNativeMethods.GIM_BVH_TREE_NODE_setDataIndex(Native, value); }
|
||||
}
|
||||
|
||||
public int EscapeIndex
|
||||
{
|
||||
get { return GIM_BVH_TREE_NODE_getEscapeIndex(_native); }
|
||||
set { GIM_BVH_TREE_NODE_setEscapeIndex(_native, value); }
|
||||
get { return UnsafeNativeMethods.GIM_BVH_TREE_NODE_getEscapeIndex(Native); }
|
||||
set { UnsafeNativeMethods.GIM_BVH_TREE_NODE_setEscapeIndex(Native, value); }
|
||||
}
|
||||
|
||||
public bool IsLeafNode
|
||||
{
|
||||
get { return GIM_BVH_TREE_NODE_isLeafNode(_native); }
|
||||
get { return UnsafeNativeMethods.GIM_BVH_TREE_NODE_isLeafNode(Native); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -212,10 +192,10 @@ namespace BulletSharp
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
GIM_BVH_TREE_NODE_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
UnsafeNativeMethods.GIM_BVH_TREE_NODE_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,24 +203,6 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_BVH_TREE_NODE_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_BVH_TREE_NODE_getBound(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int GIM_BVH_TREE_NODE_getDataIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int GIM_BVH_TREE_NODE_getEscapeIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool GIM_BVH_TREE_NODE_isLeafNode(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_BVH_TREE_NODE_setDataIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_BVH_TREE_NODE_setEscapeIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_BVH_TREE_NODE_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class GimBvhDataArray
|
||||
|
@ -251,14 +213,12 @@ namespace BulletSharp
|
|||
{
|
||||
_native = native;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public GimBvhDataArray()
|
||||
{
|
||||
_native = GIM_BVH_DATA_ARRAY_new();
|
||||
_native = UnsafeNativeMethods.GIM_BVH_DATA_ARRAY_new();
|
||||
}
|
||||
*/
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_BVH_DATA_ARRAY_new();
|
||||
*/
|
||||
}
|
||||
|
||||
public class GimBvhTreeNodeArray
|
||||
|
@ -269,14 +229,12 @@ namespace BulletSharp
|
|||
{
|
||||
_native = native;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public GimBvhTreeNodeArray()
|
||||
{
|
||||
_native = GIM_BVH_TREE_NODE_ARRAY_new();
|
||||
_native = UnsafeNativeMethods.GIM_BVH_TREE_NODE_ARRAY_new();
|
||||
}
|
||||
*/
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_BVH_TREE_NODE_ARRAY_new();
|
||||
*/
|
||||
}
|
||||
|
||||
public class BvhTree : IDisposable
|
||||
|
@ -290,67 +248,67 @@ namespace BulletSharp
|
|||
|
||||
public BvhTree()
|
||||
{
|
||||
_native = btBvhTree_new();
|
||||
_native = UnsafeNativeMethods.btBvhTree_new();
|
||||
}
|
||||
|
||||
public void BuildTree(GimBvhDataArray primitiveBoxes)
|
||||
{
|
||||
btBvhTree_build_tree(_native, primitiveBoxes._native);
|
||||
UnsafeNativeMethods.btBvhTree_build_tree(_native, primitiveBoxes._native);
|
||||
}
|
||||
|
||||
public void ClearNodes()
|
||||
{
|
||||
btBvhTree_clearNodes(_native);
|
||||
UnsafeNativeMethods.btBvhTree_clearNodes(_native);
|
||||
}
|
||||
|
||||
public GimBvhTreeNode GetNodePointer()
|
||||
{
|
||||
return new GimBvhTreeNode(btBvhTree_get_node_pointer(_native));
|
||||
return new GimBvhTreeNode(UnsafeNativeMethods.btBvhTree_get_node_pointer(_native));
|
||||
}
|
||||
|
||||
public GimBvhTreeNode GetNodePointer(int index)
|
||||
{
|
||||
return new GimBvhTreeNode(btBvhTree_get_node_pointer2(_native, index));
|
||||
return new GimBvhTreeNode(UnsafeNativeMethods.btBvhTree_get_node_pointer2(_native, index));
|
||||
}
|
||||
|
||||
public int GetEscapeNodeIndex(int nodeIndex)
|
||||
{
|
||||
return btBvhTree_getEscapeNodeIndex(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btBvhTree_getEscapeNodeIndex(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public int GetLeftNode(int nodeIndex)
|
||||
{
|
||||
return btBvhTree_getLeftNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btBvhTree_getLeftNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void GetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btBvhTree_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btBvhTree_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public int GetNodeData(int nodeIndex)
|
||||
{
|
||||
return btBvhTree_getNodeData(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btBvhTree_getNodeData(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public int GetRightNode(int nodeIndex)
|
||||
{
|
||||
return btBvhTree_getRightNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btBvhTree_getRightNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public bool IsLeafNode(int nodeIndex)
|
||||
{
|
||||
return btBvhTree_isLeafNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btBvhTree_isLeafNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void SetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btBvhTree_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btBvhTree_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public int NodeCount
|
||||
{
|
||||
get { return btBvhTree_getNodeCount(_native); }
|
||||
get { return UnsafeNativeMethods.btBvhTree_getNodeCount(_native); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -363,7 +321,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
{
|
||||
btBvhTree_delete(_native);
|
||||
UnsafeNativeMethods.btBvhTree_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -372,65 +330,35 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btBvhTree_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btBvhTree_build_tree(IntPtr obj, IntPtr primitive_boxes);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btBvhTree_clearNodes(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btBvhTree_get_node_pointer(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btBvhTree_get_node_pointer2(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btBvhTree_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btBvhTree_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btBvhTree_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btBvhTree_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btBvhTree_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btBvhTree_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btBvhTree_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btBvhTree_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btBvhTree_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class PrimitiveManagerBase : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
|
||||
internal PrimitiveManagerBase(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
Native = native;
|
||||
}
|
||||
|
||||
public void GetPrimitiveBox(int primIndex, Aabb primbox)
|
||||
public void GetPrimitiveBox(int primitiveIndex, Aabb primitiveBox)
|
||||
{
|
||||
btPrimitiveManagerBase_get_primitive_box(_native, primIndex, primbox.Native);
|
||||
UnsafeNativeMethods.btPrimitiveManagerBase_get_primitive_box(Native, primitiveIndex, primitiveBox.Native);
|
||||
}
|
||||
/*
|
||||
public void GetPrimitiveTriangle(int primIndex, PrimitiveTriangle triangle)
|
||||
|
||||
public void GetPrimitiveTriangle(int primitiveIndex, PrimitiveTriangle triangle)
|
||||
{
|
||||
btPrimitiveManagerBase_get_primitive_triangle(_native, primIndex, triangle._native);
|
||||
UnsafeNativeMethods.btPrimitiveManagerBase_get_primitive_triangle(Native, primitiveIndex, triangle.Native);
|
||||
}
|
||||
*/
|
||||
|
||||
public bool IsTrimesh
|
||||
{
|
||||
get { return btPrimitiveManagerBase_is_trimesh(_native); }
|
||||
get { return UnsafeNativeMethods.btPrimitiveManagerBase_is_trimesh(Native); }
|
||||
}
|
||||
|
||||
public int PrimitiveCount
|
||||
{
|
||||
get { return btPrimitiveManagerBase_get_primitive_count(_native); }
|
||||
get { return UnsafeNativeMethods.btPrimitiveManagerBase_get_primitive_count(Native); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -441,10 +369,10 @@ namespace BulletSharp
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
btPrimitiveManagerBase_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
UnsafeNativeMethods.btPrimitiveManagerBase_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,18 +380,6 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveManagerBase_get_primitive_box(IntPtr obj, int prim_index, IntPtr primbox);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btPrimitiveManagerBase_get_primitive_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveManagerBase_get_primitive_triangle(IntPtr obj, int prim_index, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btPrimitiveManagerBase_is_trimesh(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveManagerBase_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class GImpactBvh : IDisposable
|
||||
|
@ -479,117 +395,117 @@ namespace BulletSharp
|
|||
|
||||
public GImpactBvh()
|
||||
{
|
||||
_native = btGImpactBvh_new();
|
||||
_native = UnsafeNativeMethods.btGImpactBvh_new();
|
||||
}
|
||||
|
||||
public GImpactBvh(PrimitiveManagerBase primitiveManager)
|
||||
{
|
||||
_native = btGImpactBvh_new2(primitiveManager._native);
|
||||
_native = UnsafeNativeMethods.btGImpactBvh_new2(primitiveManager.Native);
|
||||
_primitiveManager = primitiveManager;
|
||||
}
|
||||
/*
|
||||
public bool BoxQuery(Aabb box, AlignedIntArray collidedResults)
|
||||
/*
|
||||
public bool BoxQuery(Aabb box, AlignedIntArray collidedResults)
|
||||
{
|
||||
return btGImpactBvh_boxQuery(_native, box._native, collidedResults._native);
|
||||
return UnsafeNativeMethods.btGImpactBvh_boxQuery(_native, box._native, collidedResults._native);
|
||||
}
|
||||
|
||||
public bool BoxQueryTrans(Aabb box, Matrix transform, AlignedIntArray collidedResults)
|
||||
public bool BoxQueryTrans(Aabb box, Matrix transform, AlignedIntArray collidedResults)
|
||||
{
|
||||
return btGImpactBvh_boxQueryTrans(_native, box._native, ref transform,
|
||||
return UnsafeNativeMethods.btGImpactBvh_boxQueryTrans(_native, box._native, ref transform,
|
||||
collidedResults._native);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public void BuildSet()
|
||||
{
|
||||
btGImpactBvh_buildSet(_native);
|
||||
UnsafeNativeMethods.btGImpactBvh_buildSet(_native);
|
||||
}
|
||||
|
||||
public static void FindCollision(GImpactBvh boxset1, Matrix trans1, GImpactBvh boxset2,
|
||||
Matrix trans2, PairSet collisionPairs)
|
||||
public static void FindCollision(GImpactBvh boxSet1, ref Matrix transform1, GImpactBvh boxSet2,
|
||||
ref Matrix transform2, PairSet collisionPairs)
|
||||
{
|
||||
btGImpactBvh_find_collision(boxset1._native, ref trans1, boxset2._native,
|
||||
ref trans2, collisionPairs._native);
|
||||
UnsafeNativeMethods.btGImpactBvh_find_collision(boxSet1._native, ref transform1, boxSet2._native,
|
||||
ref transform2, collisionPairs.Native);
|
||||
}
|
||||
|
||||
public GimBvhTreeNode GetNodePointer(int index = 0)
|
||||
{
|
||||
return new GimBvhTreeNode(btGImpactBvh_get_node_pointer(_native, index));
|
||||
return new GimBvhTreeNode(UnsafeNativeMethods.btGImpactBvh_get_node_pointer(_native, index));
|
||||
}
|
||||
|
||||
public int GetEscapeNodeIndex(int nodeIndex)
|
||||
{
|
||||
return btGImpactBvh_getEscapeNodeIndex(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactBvh_getEscapeNodeIndex(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public int GetLeftNode(int nodeIndex)
|
||||
{
|
||||
return btGImpactBvh_getLeftNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactBvh_getLeftNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void GetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btGImpactBvh_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btGImpactBvh_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public int GetNodeData(int nodeIndex)
|
||||
{
|
||||
return btGImpactBvh_getNodeData(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactBvh_getNodeData(_native, nodeIndex);
|
||||
}
|
||||
/*
|
||||
|
||||
public void GetNodeTriangle(int nodeIndex, PrimitiveTriangle triangle)
|
||||
{
|
||||
btGImpactBvh_getNodeTriangle(_native, nodeIndex, triangle._native);
|
||||
UnsafeNativeMethods.btGImpactBvh_getNodeTriangle(_native, nodeIndex, triangle.Native);
|
||||
}
|
||||
*/
|
||||
|
||||
public int GetRightNode(int nodeIndex)
|
||||
{
|
||||
return btGImpactBvh_getRightNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactBvh_getRightNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public bool IsLeafNode(int nodeIndex)
|
||||
{
|
||||
return btGImpactBvh_isLeafNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactBvh_isLeafNode(_native, nodeIndex);
|
||||
}
|
||||
/*
|
||||
public bool RayQuery(Vector3 rayDir, Vector3 rayOrigin, AlignedIntArray collidedResults)
|
||||
/*
|
||||
public bool RayQuery(Vector3 rayDir, Vector3 rayOrigin, AlignedIntArray collidedResults)
|
||||
{
|
||||
return btGImpactBvh_rayQuery(_native, ref rayDir, ref rayOrigin, collidedResults._native);
|
||||
return UnsafeNativeMethods.btGImpactBvh_rayQuery(_native, ref rayDir, ref rayOrigin, collidedResults._native);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public void SetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btGImpactBvh_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btGImpactBvh_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
btGImpactBvh_update(_native);
|
||||
UnsafeNativeMethods.btGImpactBvh_update(_native);
|
||||
}
|
||||
|
||||
public Aabb GlobalBox
|
||||
{
|
||||
get { return new Aabb(btGImpactBvh_getGlobalBox(_native), true); }
|
||||
get { return new Aabb(UnsafeNativeMethods.btGImpactBvh_getGlobalBox(_native)); }
|
||||
}
|
||||
|
||||
public bool HasHierarchy
|
||||
{
|
||||
get { return btGImpactBvh_hasHierarchy(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactBvh_hasHierarchy(_native); }
|
||||
}
|
||||
|
||||
public bool IsTrimesh
|
||||
{
|
||||
get { return btGImpactBvh_isTrimesh(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactBvh_isTrimesh(_native); }
|
||||
}
|
||||
|
||||
public int NodeCount
|
||||
{
|
||||
get { return btGImpactBvh_getNodeCount(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactBvh_getNodeCount(_native); }
|
||||
}
|
||||
|
||||
public PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get { return new PrimitiveManagerBase(btGImpactBvh_getPrimitiveManager(_native)); }
|
||||
set { btGImpactBvh_setPrimitiveManager(_native, value._native); }
|
||||
get { return new PrimitiveManagerBase(UnsafeNativeMethods.btGImpactBvh_getPrimitiveManager(_native)); }
|
||||
set { UnsafeNativeMethods.btGImpactBvh_setPrimitiveManager(_native, value.Native); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -602,7 +518,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
{
|
||||
btGImpactBvh_delete(_native);
|
||||
UnsafeNativeMethods.btGImpactBvh_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -611,60 +527,5 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactBvh_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactBvh_new2(IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactBvh_boxQuery(IntPtr obj, IntPtr box, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactBvh_boxQueryTrans(IntPtr obj, IntPtr box, [In] ref Matrix transform, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_buildSet(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_find_collision(IntPtr boxset1, [In] ref Matrix trans1, IntPtr boxset2, [In] ref Matrix trans2, IntPtr collision_pairs);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactBvh_get_node_pointer(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactBvh_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactBvh_getGlobalBox(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactBvh_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactBvh_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactBvh_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_getNodeTriangle(IntPtr obj, int nodeindex, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactBvh_getPrimitiveManager(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactBvh_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactBvh_hasHierarchy(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactBvh_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactBvh_isTrimesh(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactBvh_rayQuery(IntPtr obj, [In] ref Vector3 ray_dir, [In] ref Vector3 ray_origin, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_setPrimitiveManager(IntPtr obj, IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_update(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactBvh_delete(IntPtr obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace BulletSharp
|
||||
{
|
||||
|
@ -14,18 +12,15 @@ namespace BulletSharp
|
|||
}
|
||||
|
||||
public CreateFunc()
|
||||
: base(btGImpactCollisionAlgorithm_CreateFunc_new(), false)
|
||||
: base(UnsafeNativeMethods.btGImpactCollisionAlgorithm_CreateFunc_new(), false)
|
||||
{
|
||||
}
|
||||
|
||||
public override CollisionAlgorithm CreateCollisionAlgorithm(CollisionAlgorithmConstructionInfo __unnamed0, CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap)
|
||||
{
|
||||
return new GImpactCollisionAlgorithm(btCollisionAlgorithmCreateFunc_CreateCollisionAlgorithm(
|
||||
_native, __unnamed0._native, body0Wrap._native, body1Wrap._native));
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactCollisionAlgorithm_CreateFunc_new();
|
||||
public override CollisionAlgorithm CreateCollisionAlgorithm(CollisionAlgorithmConstructionInfo __unnamed0, CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap)
|
||||
{
|
||||
return new GImpactCollisionAlgorithm(btCollisionAlgorithmCreateFunc_CreateCollisionAlgorithm(
|
||||
_native, __unnamed0._native, body0Wrap._native, body1Wrap._native));
|
||||
}
|
||||
}
|
||||
|
||||
internal GImpactCollisionAlgorithm(IntPtr native)
|
||||
|
@ -33,9 +28,9 @@ namespace BulletSharp
|
|||
{
|
||||
}
|
||||
|
||||
public GImpactCollisionAlgorithm(CollisionAlgorithmConstructionInfo ci, CollisionObjectWrapper body0Wrap,
|
||||
public GImpactCollisionAlgorithm(CollisionAlgorithmConstructionInfo constructionInfo, CollisionObjectWrapper body0Wrap,
|
||||
CollisionObjectWrapper body1Wrap)
|
||||
: base(btGImpactCollisionAlgorithm_new(ci._native, body0Wrap._native,
|
||||
: base(UnsafeNativeMethods.btGImpactCollisionAlgorithm_new(constructionInfo._native, body0Wrap._native,
|
||||
body1Wrap._native))
|
||||
{
|
||||
}
|
||||
|
@ -43,94 +38,63 @@ namespace BulletSharp
|
|||
public void GImpactVsCompoundShape(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap,
|
||||
GImpactShapeInterface shape0, CompoundShape shape1, bool swapped)
|
||||
{
|
||||
btGImpactCollisionAlgorithm_gimpact_vs_compoundshape(_native, body0Wrap._native,
|
||||
UnsafeNativeMethods.btGImpactCollisionAlgorithm_gimpact_vs_compoundshape(_native, body0Wrap._native,
|
||||
body1Wrap._native, shape0._native, shape1._native, swapped);
|
||||
}
|
||||
|
||||
public void GImpactVsConcave(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap,
|
||||
GImpactShapeInterface shape0, ConcaveShape shape1, bool swapped)
|
||||
{
|
||||
btGImpactCollisionAlgorithm_gimpact_vs_concave(_native, body0Wrap._native,
|
||||
UnsafeNativeMethods.btGImpactCollisionAlgorithm_gimpact_vs_concave(_native, body0Wrap._native,
|
||||
body1Wrap._native, shape0._native, shape1._native, swapped);
|
||||
}
|
||||
|
||||
public void GImpactVsGImpact(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap,
|
||||
GImpactShapeInterface shape0, GImpactShapeInterface shape1)
|
||||
{
|
||||
btGImpactCollisionAlgorithm_gimpact_vs_gimpact(_native, body0Wrap._native,
|
||||
UnsafeNativeMethods.btGImpactCollisionAlgorithm_gimpact_vs_gimpact(_native, body0Wrap._native,
|
||||
body1Wrap._native, shape0._native, shape1._native);
|
||||
}
|
||||
|
||||
public void GImpactVsShape(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap,
|
||||
GImpactShapeInterface shape0, CollisionShape shape1, bool swapped)
|
||||
{
|
||||
btGImpactCollisionAlgorithm_gimpact_vs_shape(_native, body0Wrap._native,
|
||||
UnsafeNativeMethods.btGImpactCollisionAlgorithm_gimpact_vs_shape(_native, body0Wrap._native,
|
||||
body1Wrap._native, shape0._native, shape1._native, swapped);
|
||||
}
|
||||
|
||||
public ManifoldResult InternalGetResultOut()
|
||||
{
|
||||
return new ManifoldResult(btGImpactCollisionAlgorithm_internalGetResultOut(_native));
|
||||
return new ManifoldResult(UnsafeNativeMethods.btGImpactCollisionAlgorithm_internalGetResultOut(_native));
|
||||
}
|
||||
|
||||
public static void RegisterAlgorithm(CollisionDispatcher dispatcher)
|
||||
{
|
||||
btGImpactCollisionAlgorithm_registerAlgorithm(dispatcher._native);
|
||||
UnsafeNativeMethods.btGImpactCollisionAlgorithm_registerAlgorithm(dispatcher._native);
|
||||
}
|
||||
|
||||
public int Face0
|
||||
{
|
||||
get { return btGImpactCollisionAlgorithm_getFace0(_native); }
|
||||
set { btGImpactCollisionAlgorithm_setFace0(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactCollisionAlgorithm_getFace0(_native); }
|
||||
set { UnsafeNativeMethods.btGImpactCollisionAlgorithm_setFace0(_native, value); }
|
||||
}
|
||||
|
||||
public int Face1
|
||||
{
|
||||
get { return btGImpactCollisionAlgorithm_getFace1(_native); }
|
||||
set { btGImpactCollisionAlgorithm_setFace1(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactCollisionAlgorithm_getFace1(_native); }
|
||||
set { UnsafeNativeMethods.btGImpactCollisionAlgorithm_setFace1(_native, value); }
|
||||
}
|
||||
|
||||
public int Part0
|
||||
{
|
||||
get { return btGImpactCollisionAlgorithm_getPart0(_native); }
|
||||
set { btGImpactCollisionAlgorithm_setPart0(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactCollisionAlgorithm_getPart0(_native); }
|
||||
set { UnsafeNativeMethods.btGImpactCollisionAlgorithm_setPart0(_native, value); }
|
||||
}
|
||||
|
||||
public int Part1
|
||||
{
|
||||
get { return btGImpactCollisionAlgorithm_getPart1(_native); }
|
||||
set { btGImpactCollisionAlgorithm_setPart1(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactCollisionAlgorithm_getPart1(_native); }
|
||||
set { UnsafeNativeMethods.btGImpactCollisionAlgorithm_setPart1(_native, value); }
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactCollisionAlgorithm_new(IntPtr ci, IntPtr body0Wrap, IntPtr body1Wrap);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactCollisionAlgorithm_getFace0(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactCollisionAlgorithm_getFace1(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactCollisionAlgorithm_getPart0(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactCollisionAlgorithm_getPart1(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_gimpact_vs_compoundshape(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1, bool swapped);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_gimpact_vs_concave(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1, bool swapped);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_gimpact_vs_gimpact(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_gimpact_vs_shape(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1, bool swapped);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactCollisionAlgorithm_internalGetResultOut(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_registerAlgorithm(IntPtr dispatcher);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_setFace0(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_setFace1(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_setPart0(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactCollisionAlgorithm_setPart1(IntPtr obj, int value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using BulletSharp.Math;
|
||||
using System;
|
||||
|
||||
namespace BulletSharp
|
||||
{
|
||||
|
@ -16,47 +14,47 @@ namespace BulletSharp
|
|||
|
||||
public GImpactQuantizedBvhNode()
|
||||
{
|
||||
_native = BT_QUANTIZED_BVH_NODE_new();
|
||||
_native = UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_new();
|
||||
}
|
||||
|
||||
public bool TestQuantizedBoxOverlapp(ushort[] quantizedMin, ushort[] quantizedMax)
|
||||
{
|
||||
return BT_QUANTIZED_BVH_NODE_testQuantizedBoxOverlapp(_native, quantizedMin, quantizedMax);
|
||||
return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_testQuantizedBoxOverlapp(_native, quantizedMin, quantizedMax);
|
||||
}
|
||||
|
||||
public int DataIndex
|
||||
{
|
||||
get { return BT_QUANTIZED_BVH_NODE_getDataIndex(_native); }
|
||||
set { BT_QUANTIZED_BVH_NODE_setDataIndex(_native, value); }
|
||||
get { return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_getDataIndex(_native); }
|
||||
set { UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_setDataIndex(_native, value); }
|
||||
}
|
||||
|
||||
public int EscapeIndex
|
||||
{
|
||||
get { return BT_QUANTIZED_BVH_NODE_getEscapeIndex(_native); }
|
||||
set { BT_QUANTIZED_BVH_NODE_setEscapeIndex(_native, value); }
|
||||
get { return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_getEscapeIndex(_native); }
|
||||
set { UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_setEscapeIndex(_native, value); }
|
||||
}
|
||||
|
||||
public int EscapeIndexOrDataIndex
|
||||
{
|
||||
get { return BT_QUANTIZED_BVH_NODE_getEscapeIndexOrDataIndex(_native); }
|
||||
set { BT_QUANTIZED_BVH_NODE_setEscapeIndexOrDataIndex(_native, value); }
|
||||
get { return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_getEscapeIndexOrDataIndex(_native); }
|
||||
set { UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_setEscapeIndexOrDataIndex(_native, value); }
|
||||
}
|
||||
|
||||
public bool IsLeafNode
|
||||
{
|
||||
get { return BT_QUANTIZED_BVH_NODE_isLeafNode(_native); }
|
||||
get { return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_isLeafNode(_native); }
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public UShortArray QuantizedAabbMax
|
||||
{
|
||||
get { return BT_QUANTIZED_BVH_NODE_getQuantizedAabbMax(_native); }
|
||||
get { return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_getQuantizedAabbMax(_native); }
|
||||
}
|
||||
|
||||
public UShortArray QuantizedAabbMin
|
||||
{
|
||||
get { return BT_QUANTIZED_BVH_NODE_getQuantizedAabbMin(_native); }
|
||||
get { return UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_getQuantizedAabbMin(_native); }
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
|
@ -67,7 +65,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
{
|
||||
BT_QUANTIZED_BVH_NODE_delete(_native);
|
||||
UnsafeNativeMethods.BT_QUANTIZED_BVH_NODE_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -76,51 +74,22 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr BT_QUANTIZED_BVH_NODE_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int BT_QUANTIZED_BVH_NODE_getDataIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int BT_QUANTIZED_BVH_NODE_getEscapeIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int BT_QUANTIZED_BVH_NODE_getEscapeIndexOrDataIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr BT_QUANTIZED_BVH_NODE_getQuantizedAabbMax(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr BT_QUANTIZED_BVH_NODE_getQuantizedAabbMin(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool BT_QUANTIZED_BVH_NODE_isLeafNode(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void BT_QUANTIZED_BVH_NODE_setDataIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void BT_QUANTIZED_BVH_NODE_setEscapeIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void BT_QUANTIZED_BVH_NODE_setEscapeIndexOrDataIndex(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool BT_QUANTIZED_BVH_NODE_testQuantizedBoxOverlapp(IntPtr obj, ushort[] quantizedMin, ushort[] quantizedMax);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void BT_QUANTIZED_BVH_NODE_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class GimGImpactQuantizedBvhNodeArray
|
||||
public class GImpactQuantizedBvhNodeArray
|
||||
{
|
||||
internal IntPtr _native;
|
||||
|
||||
internal GimGImpactQuantizedBvhNodeArray(IntPtr native)
|
||||
internal GImpactQuantizedBvhNodeArray(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
}
|
||||
/*
|
||||
public GimGImpactQuantizedBvhNodeArray()
|
||||
{
|
||||
_native = GIM_QUANTIZED_BVH_NODE_ARRAY_new();
|
||||
_native = UnsafeNativeMethods.GIM_QUANTIZED_BVH_NODE_ARRAY_new();
|
||||
}
|
||||
*/
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_QUANTIZED_BVH_NODE_ARRAY_new();
|
||||
}
|
||||
|
||||
public class QuantizedBvhTree : IDisposable
|
||||
|
@ -134,72 +103,72 @@ namespace BulletSharp
|
|||
|
||||
public QuantizedBvhTree()
|
||||
{
|
||||
_native = btQuantizedBvhTree_new();
|
||||
_native = UnsafeNativeMethods.btQuantizedBvhTree_new();
|
||||
}
|
||||
|
||||
public void BuildTree(GimBvhDataArray primitiveBoxes)
|
||||
{
|
||||
btQuantizedBvhTree_build_tree(_native, primitiveBoxes._native);
|
||||
UnsafeNativeMethods.btQuantizedBvhTree_build_tree(_native, primitiveBoxes._native);
|
||||
}
|
||||
|
||||
public void ClearNodes()
|
||||
{
|
||||
btQuantizedBvhTree_clearNodes(_native);
|
||||
UnsafeNativeMethods.btQuantizedBvhTree_clearNodes(_native);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public GImpactQuantizedBvhNode GetNodePointer(int index = 0)
|
||||
{
|
||||
return btQuantizedBvhTree_get_node_pointer(_native, index);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_get_node_pointer(_native, index);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public int GetEscapeNodeIndex(int nodeIndex)
|
||||
{
|
||||
return btQuantizedBvhTree_getEscapeNodeIndex(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_getEscapeNodeIndex(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public int GetLeftNode(int nodeIndex)
|
||||
{
|
||||
return btQuantizedBvhTree_getLeftNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_getLeftNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void GetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btQuantizedBvhTree_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btQuantizedBvhTree_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public int GetNodeData(int nodeIndex)
|
||||
{
|
||||
return btQuantizedBvhTree_getNodeData(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_getNodeData(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public int GetRightNode(int nodeIndex)
|
||||
{
|
||||
return btQuantizedBvhTree_getRightNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_getRightNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public bool IsLeafNode(int nodeIndex)
|
||||
{
|
||||
return btQuantizedBvhTree_isLeafNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_isLeafNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void QuantizePoint(ushort[] quantizedpoint, Vector3 point)
|
||||
{
|
||||
btQuantizedBvhTree_quantizePoint(_native, quantizedpoint, ref point);
|
||||
UnsafeNativeMethods.btQuantizedBvhTree_quantizePoint(_native, quantizedpoint, ref point);
|
||||
}
|
||||
|
||||
public void SetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btQuantizedBvhTree_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btQuantizedBvhTree_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public bool TestQuantizedBoxOverlap(int nodeIndex, ushort[] quantizedMin, ushort[] quantizedMax)
|
||||
public bool TestQuantizedBoxOverlap(int nodeIndex, ushort[] quantizedMin, ushort[] quantizedMax)
|
||||
{
|
||||
return btQuantizedBvhTree_testQuantizedBoxOverlapp(_native, nodeIndex, quantizedMin, quantizedMax);
|
||||
return UnsafeNativeMethods.btQuantizedBvhTree_testQuantizedBoxOverlapp(_native, nodeIndex, quantizedMin, quantizedMax);
|
||||
}
|
||||
|
||||
public int NodeCount
|
||||
{
|
||||
get { return btQuantizedBvhTree_getNodeCount(_native); }
|
||||
get { return UnsafeNativeMethods.btQuantizedBvhTree_getNodeCount(_native); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -212,7 +181,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
{
|
||||
btQuantizedBvhTree_delete(_native);
|
||||
UnsafeNativeMethods.btQuantizedBvhTree_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -221,39 +190,6 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btQuantizedBvhTree_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btQuantizedBvhTree_build_tree(IntPtr obj, IntPtr primitive_boxes);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btQuantizedBvhTree_clearNodes(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btQuantizedBvhTree_get_node_pointer(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btQuantizedBvhTree_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btQuantizedBvhTree_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btQuantizedBvhTree_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btQuantizedBvhTree_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btQuantizedBvhTree_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btQuantizedBvhTree_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btQuantizedBvhTree_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btQuantizedBvhTree_quantizePoint(IntPtr obj, ushort[] quantizedpoint, [In] ref Vector3 point);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btQuantizedBvhTree_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btQuantizedBvhTree_testQuantizedBoxOverlapp(IntPtr obj, int node_index, ushort[] quantizedMin, ushort[] quantizedMax);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btQuantizedBvhTree_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class GImpactQuantizedBvh : IDisposable
|
||||
|
@ -269,112 +205,112 @@ namespace BulletSharp
|
|||
|
||||
public GImpactQuantizedBvh()
|
||||
{
|
||||
_native = btGImpactQuantizedBvh_new();
|
||||
_native = UnsafeNativeMethods.btGImpactQuantizedBvh_new();
|
||||
}
|
||||
|
||||
public GImpactQuantizedBvh(PrimitiveManagerBase primitiveManager)
|
||||
{
|
||||
_native = btGImpactQuantizedBvh_new2(primitiveManager._native);
|
||||
_native = UnsafeNativeMethods.btGImpactQuantizedBvh_new2(primitiveManager.Native);
|
||||
_primitiveManager = primitiveManager;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public bool BoxQuery(Aabb box, AlignedIntArray collidedResults)
|
||||
{
|
||||
return btGImpactQuantizedBvh_boxQuery(_native, box._native, collidedResults._native);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_boxQuery(_native, box._native, collidedResults._native);
|
||||
}
|
||||
|
||||
public bool BoxQueryTrans(Aabb box, Matrix transform, AlignedIntArray collidedResults)
|
||||
public bool BoxQueryTrans(Aabb box, Matrix transform, AlignedIntArray collidedResults)
|
||||
{
|
||||
return btGImpactQuantizedBvh_boxQueryTrans(_native, box._native, ref transform,
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_boxQueryTrans(_native, box._native, ref transform,
|
||||
collidedResults._native);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public void BuildSet()
|
||||
{
|
||||
btGImpactQuantizedBvh_buildSet(_native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_buildSet(_native);
|
||||
}
|
||||
|
||||
public static void FindCollision(GImpactQuantizedBvh boxset1, Matrix trans1,
|
||||
GImpactQuantizedBvh boxset2, Matrix trans2, PairSet collisionPairs)
|
||||
{
|
||||
btGImpactQuantizedBvh_find_collision(boxset1._native, ref trans1, boxset2._native,
|
||||
ref trans2, collisionPairs._native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_find_collision(boxset1._native, ref trans1, boxset2._native,
|
||||
ref trans2, collisionPairs.Native);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public GImpactQuantizedBvhNode GetNodePointer(int index = 0)
|
||||
{
|
||||
return btGImpactQuantizedBvh_get_node_pointer(_native, index);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_get_node_pointer(_native, index);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public int GetEscapeNodeIndex(int nodeIndex)
|
||||
{
|
||||
return btGImpactQuantizedBvh_getEscapeNodeIndex(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_getEscapeNodeIndex(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public int GetLeftNode(int nodeIndex)
|
||||
{
|
||||
return btGImpactQuantizedBvh_getLeftNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_getLeftNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void GetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btGImpactQuantizedBvh_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_getNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public int GetNodeData(int nodeIndex)
|
||||
{
|
||||
return btGImpactQuantizedBvh_getNodeData(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_getNodeData(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public void GetNodeTriangle(int nodeIndex, PrimitiveTriangle triangle)
|
||||
{
|
||||
btGImpactQuantizedBvh_getNodeTriangle(_native, nodeIndex, triangle._native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_getNodeTriangle(_native, nodeIndex, triangle.Native);
|
||||
}
|
||||
|
||||
public int GetRightNode(int nodeIndex)
|
||||
{
|
||||
return btGImpactQuantizedBvh_getRightNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_getRightNode(_native, nodeIndex);
|
||||
}
|
||||
|
||||
public bool IsLeafNode(int nodeIndex)
|
||||
{
|
||||
return btGImpactQuantizedBvh_isLeafNode(_native, nodeIndex);
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_isLeafNode(_native, nodeIndex);
|
||||
}
|
||||
/*
|
||||
public bool RayQuery(Vector3 rayDir, Vector3 rayOrigin, AlignedIntArray collidedResults)
|
||||
/*
|
||||
public bool RayQuery(Vector3 rayDir, Vector3 rayOrigin, AlignedIntArray collidedResults)
|
||||
{
|
||||
return btGImpactQuantizedBvh_rayQuery(_native, ref rayDir, ref rayOrigin,
|
||||
return UnsafeNativeMethods.btGImpactQuantizedBvh_rayQuery(_native, ref rayDir, ref rayOrigin,
|
||||
collidedResults._native);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public void SetNodeBound(int nodeIndex, Aabb bound)
|
||||
{
|
||||
btGImpactQuantizedBvh_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_setNodeBound(_native, nodeIndex, bound.Native);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
btGImpactQuantizedBvh_update(_native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_update(_native);
|
||||
}
|
||||
|
||||
public Aabb GlobalBox
|
||||
{
|
||||
get { return new Aabb(btGImpactQuantizedBvh_getGlobalBox(_native), true); }
|
||||
get { return new Aabb(UnsafeNativeMethods.btGImpactQuantizedBvh_getGlobalBox(_native)); }
|
||||
}
|
||||
|
||||
public bool HasHierarchy
|
||||
{
|
||||
get { return btGImpactQuantizedBvh_hasHierarchy(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactQuantizedBvh_hasHierarchy(_native); }
|
||||
}
|
||||
|
||||
public bool IsTrimesh
|
||||
{
|
||||
get { return btGImpactQuantizedBvh_isTrimesh(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactQuantizedBvh_isTrimesh(_native); }
|
||||
}
|
||||
|
||||
public int NodeCount
|
||||
{
|
||||
get { return btGImpactQuantizedBvh_getNodeCount(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactQuantizedBvh_getNodeCount(_native); }
|
||||
}
|
||||
|
||||
public PrimitiveManagerBase PrimitiveManager
|
||||
|
@ -382,7 +318,7 @@ namespace BulletSharp
|
|||
get { return _primitiveManager; }
|
||||
set
|
||||
{
|
||||
btGImpactQuantizedBvh_setPrimitiveManager(_native, value._native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_setPrimitiveManager(_native, value.Native);
|
||||
_primitiveManager = value;
|
||||
}
|
||||
}
|
||||
|
@ -397,7 +333,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
{
|
||||
btGImpactQuantizedBvh_delete(_native);
|
||||
UnsafeNativeMethods.btGImpactQuantizedBvh_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -406,60 +342,5 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactQuantizedBvh_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactQuantizedBvh_new2(IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactQuantizedBvh_boxQuery(IntPtr obj, IntPtr box, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactQuantizedBvh_boxQueryTrans(IntPtr obj, IntPtr box, [In] ref Matrix transform, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_buildSet(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_find_collision(IntPtr boxset1, [In] ref Matrix trans1, IntPtr boxset2, [In] ref Matrix trans2, IntPtr collision_pairs);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactQuantizedBvh_get_node_pointer(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactQuantizedBvh_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactQuantizedBvh_getGlobalBox(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactQuantizedBvh_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactQuantizedBvh_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactQuantizedBvh_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_getNodeTriangle(IntPtr obj, int nodeindex, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactQuantizedBvh_getPrimitiveManager(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactQuantizedBvh_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactQuantizedBvh_hasHierarchy(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactQuantizedBvh_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactQuantizedBvh_isTrimesh(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btGImpactQuantizedBvh_rayQuery(IntPtr obj, [In] ref Vector3 ray_dir, [In] ref Vector3 ray_origin, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_setPrimitiveManager(IntPtr obj, IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_update(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactQuantizedBvh_delete(IntPtr obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using BulletSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using BulletSharp.Math;
|
||||
|
||||
namespace BulletSharp
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ namespace BulletSharp
|
|||
|
||||
public abstract class GImpactShapeInterface : ConcaveShape
|
||||
{
|
||||
protected List<CollisionShape> _childShapes = new List<CollisionShape>();
|
||||
protected List<CollisionShape> _childShapes = new List<CollisionShape>();
|
||||
|
||||
internal GImpactShapeInterface(IntPtr native)
|
||||
: base(native)
|
||||
|
@ -58,7 +58,7 @@ namespace BulletSharp
|
|||
|
||||
public CollisionShape GetChildShape(int index)
|
||||
{
|
||||
return _childShapes[index];
|
||||
return _childShapes[index];
|
||||
}
|
||||
|
||||
public Matrix GetChildTransform(int index)
|
||||
|
@ -70,7 +70,7 @@ namespace BulletSharp
|
|||
|
||||
public void GetPrimitiveTriangle(int index, PrimitiveTriangle triangle)
|
||||
{
|
||||
btGImpactShapeInterface_getPrimitiveTriangle(_native, index, triangle._native);
|
||||
btGImpactShapeInterface_getPrimitiveTriangle(_native, index, triangle.Native);
|
||||
}
|
||||
|
||||
public void LockChildShapes()
|
||||
|
@ -83,12 +83,12 @@ namespace BulletSharp
|
|||
btGImpactShapeInterface_postUpdate(_native);
|
||||
}
|
||||
|
||||
public void ProcessAllTrianglesRayRef(TriangleCallback cb, ref Vector3 rayFrom,
|
||||
ref Vector3 rayTo)
|
||||
{
|
||||
btGImpactShapeInterface_processAllTrianglesRay(_native, cb._native,
|
||||
ref rayFrom, ref rayTo);
|
||||
}
|
||||
public void ProcessAllTrianglesRayRef(TriangleCallback cb, ref Vector3 rayFrom,
|
||||
ref Vector3 rayTo)
|
||||
{
|
||||
btGImpactShapeInterface_processAllTrianglesRay(_native, cb._native,
|
||||
ref rayFrom, ref rayTo);
|
||||
}
|
||||
|
||||
public void ProcessAllTrianglesRay(TriangleCallback cb, Vector3 rayFrom,
|
||||
Vector3 rayTo)
|
||||
|
@ -116,16 +116,16 @@ namespace BulletSharp
|
|||
{
|
||||
btGImpactShapeInterface_updateBound(_native);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public GImpactBoxSet BoxSet
|
||||
{
|
||||
get { return btGImpactShapeInterface_getBoxSet(_native); }
|
||||
}
|
||||
*/
|
||||
public bool ChildrenHasTransform
|
||||
{
|
||||
get{return btGImpactShapeInterface_childrenHasTransform(_native);}
|
||||
}
|
||||
*/
|
||||
public bool ChildrenHasTransform
|
||||
{
|
||||
get{return btGImpactShapeInterface_childrenHasTransform(_native);}
|
||||
}
|
||||
|
||||
public GImpactShapeType GImpactShapeType
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ namespace BulletSharp
|
|||
|
||||
public Aabb LocalBox
|
||||
{
|
||||
get { return new Aabb(btGImpactShapeInterface_getLocalBox(_native), true); }
|
||||
get { return new Aabb(btGImpactShapeInterface_getLocalBox(_native)); }
|
||||
}
|
||||
|
||||
public bool NeedsRetrieveTetrahedrons
|
||||
|
@ -157,10 +157,10 @@ namespace BulletSharp
|
|||
get { return btGImpactShapeInterface_getNumChildShapes(_native); }
|
||||
}
|
||||
|
||||
public abstract PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get;
|
||||
}
|
||||
public abstract PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
|
@ -214,23 +214,18 @@ namespace BulletSharp
|
|||
|
||||
public class CompoundPrimitiveManager : PrimitiveManagerBase
|
||||
{
|
||||
GImpactCompoundShape _compoundShape;
|
||||
|
||||
internal CompoundPrimitiveManager(IntPtr native, GImpactCompoundShape compoundShape)
|
||||
internal CompoundPrimitiveManager(IntPtr native, GImpactCompoundShape compoundShape)
|
||||
: base(native)
|
||||
{
|
||||
_compoundShape = compoundShape;
|
||||
CompoundShape = compoundShape;
|
||||
}
|
||||
|
||||
public GImpactCompoundShape CompoundShape
|
||||
{
|
||||
get { return _compoundShape; }
|
||||
}
|
||||
public GImpactCompoundShape CompoundShape { get; }
|
||||
}
|
||||
|
||||
public class GImpactCompoundShape : GImpactShapeInterface
|
||||
{
|
||||
private CompoundPrimitiveManager _compoundPrimitiveManager;
|
||||
private CompoundPrimitiveManager _compoundPrimitiveManager;
|
||||
|
||||
internal GImpactCompoundShape(IntPtr native)
|
||||
: base(native)
|
||||
|
@ -244,31 +239,31 @@ namespace BulletSharp
|
|||
|
||||
public void AddChildShape(Matrix localTransform, CollisionShape shape)
|
||||
{
|
||||
_childShapes.Add(shape);
|
||||
_childShapes.Add(shape);
|
||||
btGImpactCompoundShape_addChildShape(_native, ref localTransform, shape._native);
|
||||
}
|
||||
|
||||
public void AddChildShape(CollisionShape shape)
|
||||
{
|
||||
_childShapes.Add(shape);
|
||||
_childShapes.Add(shape);
|
||||
btGImpactCompoundShape_addChildShape2(_native, shape._native);
|
||||
}
|
||||
|
||||
public override PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get { return CompoundPrimitiveManager; }
|
||||
}
|
||||
public override PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get { return CompoundPrimitiveManager; }
|
||||
}
|
||||
|
||||
public CompoundPrimitiveManager CompoundPrimitiveManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_compoundPrimitiveManager == null)
|
||||
{
|
||||
_compoundPrimitiveManager = new CompoundPrimitiveManager(btGImpactCompoundShape_getCompoundPrimitiveManager(_native), this);
|
||||
}
|
||||
return _compoundPrimitiveManager;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_compoundPrimitiveManager == null)
|
||||
{
|
||||
_compoundPrimitiveManager = new CompoundPrimitiveManager(btGImpactCompoundShape_getCompoundPrimitiveManager(_native), this);
|
||||
}
|
||||
return _compoundPrimitiveManager;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
|
@ -291,78 +286,78 @@ namespace BulletSharp
|
|||
}
|
||||
|
||||
public TrimeshPrimitiveManager(StridingMeshInterface meshInterface, int part)
|
||||
: base(btGImpactMeshShapePart_TrimeshPrimitiveManager_new(meshInterface._native,
|
||||
: base(UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_new(meshInterface._native,
|
||||
part))
|
||||
{
|
||||
_meshInterface = meshInterface;
|
||||
}
|
||||
|
||||
public TrimeshPrimitiveManager(TrimeshPrimitiveManager manager)
|
||||
: base(btGImpactMeshShapePart_TrimeshPrimitiveManager_new2(manager._native))
|
||||
: base(UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_new2(manager.Native))
|
||||
{
|
||||
}
|
||||
|
||||
public TrimeshPrimitiveManager()
|
||||
: base(btGImpactMeshShapePart_TrimeshPrimitiveManager_new3())
|
||||
: base(UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_new3())
|
||||
{
|
||||
}
|
||||
|
||||
public void GetBulletTriangle(int primIndex, TriangleShapeEx triangle)
|
||||
{
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_get_bullet_triangle(
|
||||
_native, primIndex, triangle._native);
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_get_bullet_triangle(
|
||||
Native, primIndex, triangle._native);
|
||||
}
|
||||
|
||||
public void GetIndices(int faceIndex, out uint i0, out uint i1, out uint i2b)
|
||||
{
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_get_indices(_native,
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_get_indices(Native,
|
||||
faceIndex, out i0, out i1, out i2b);
|
||||
}
|
||||
|
||||
public void GetVertex(uint vertexIndex, out Vector3 vertex)
|
||||
{
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex(_native,
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex(Native,
|
||||
vertexIndex, out vertex);
|
||||
}
|
||||
|
||||
public void Lock()
|
||||
{
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_lock(_native);
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_lock(Native);
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_unlock(_native);
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_unlock(Native);
|
||||
}
|
||||
|
||||
public IntPtr IndexBase
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexbase(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexbase(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexbase(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexbase(Native, value); }
|
||||
}
|
||||
|
||||
public int IndexStride
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexstride(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexstride(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexstride(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexstride(Native, value); }
|
||||
}
|
||||
|
||||
public PhyScalarType IndicesType
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndicestype(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndicestype(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndicestype(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndicestype(Native, value); }
|
||||
}
|
||||
|
||||
public int LockCount
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getLock_count(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setLock_count(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getLock_count(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setLock_count(Native, value); }
|
||||
}
|
||||
|
||||
public float Margin
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getMargin(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setMargin(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getMargin(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setMargin(Native, value); }
|
||||
}
|
||||
|
||||
public StridingMeshInterface MeshInterface
|
||||
|
@ -370,27 +365,27 @@ namespace BulletSharp
|
|||
get { return _meshInterface; }
|
||||
set
|
||||
{
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_setMeshInterface(_native, value._native);
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setMeshInterface(Native, value._native);
|
||||
_meshInterface = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Numfaces
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumfaces(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumfaces(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumfaces(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumfaces(Native, value); }
|
||||
}
|
||||
|
||||
public int Numverts
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumverts(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumverts(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumverts(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumverts(Native, value); }
|
||||
}
|
||||
|
||||
public int Part
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getPart(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setPart(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getPart(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setPart(Native, value); }
|
||||
}
|
||||
|
||||
public Vector3 Scale
|
||||
|
@ -398,110 +393,39 @@ namespace BulletSharp
|
|||
get
|
||||
{
|
||||
Vector3 value;
|
||||
btGImpactMeshShapePart_TrimeshPrimitiveManager_getScale(_native, out value);
|
||||
UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getScale(Native, out value);
|
||||
return value;
|
||||
}
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setScale(_native, ref value); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setScale(Native, ref value); }
|
||||
}
|
||||
|
||||
public int Stride
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getStride(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setStride(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getStride(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setStride(Native, value); }
|
||||
}
|
||||
|
||||
public PhyScalarType Type
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getType(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setType(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getType(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setType(Native, value); }
|
||||
}
|
||||
|
||||
public IntPtr VertexBase
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_getVertexbase(_native); }
|
||||
set { btGImpactMeshShapePart_TrimeshPrimitiveManager_setVertexbase(_native, value); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_getVertexbase(Native); }
|
||||
set { UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_setVertexbase(Native, value); }
|
||||
}
|
||||
|
||||
public int VertexCount
|
||||
{
|
||||
get { return btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex_count(_native); }
|
||||
get { return UnsafeNativeMethods.btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex_count(Native); }
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_new(IntPtr meshInterface, int part);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_new2(IntPtr manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_new3();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_get_bullet_triangle(IntPtr obj, int prim_index, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_get_indices(IntPtr obj, int face_index, out uint i0, out uint i1, out uint i2b);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex(IntPtr obj, uint vertex_index, out Vector3 vertex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexbase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexstride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern PhyScalarType btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndicestype(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getLock_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern float btGImpactMeshShapePart_TrimeshPrimitiveManager_getMargin(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_getMeshInterface(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumfaces(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumverts(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getPart(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_getScale(IntPtr obj, out Vector3 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getStride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern PhyScalarType btGImpactMeshShapePart_TrimeshPrimitiveManager_getType(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_getVertexbase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_lock(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexbase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexstride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndicestype(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setLock_count(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setMargin(IntPtr obj, float value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setMeshInterface(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumfaces(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumverts(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setPart(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setScale(IntPtr obj, [In] ref Vector3 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setStride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setType(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setVertexbase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_unlock(IntPtr obj);
|
||||
}
|
||||
|
||||
public class GImpactMeshShapePart : GImpactShapeInterface
|
||||
{
|
||||
private TrimeshPrimitiveManager _gImpactTrimeshPrimitiveManager;
|
||||
private TrimeshPrimitiveManager _gImpactTrimeshPrimitiveManager;
|
||||
|
||||
internal GImpactMeshShapePart(IntPtr native)
|
||||
: base(native)
|
||||
|
@ -528,21 +452,21 @@ namespace BulletSharp
|
|||
get { return btGImpactMeshShapePart_getPart(_native); }
|
||||
}
|
||||
|
||||
public override PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get { return GImpactTrimeshPrimitiveManager; }
|
||||
}
|
||||
|
||||
public TrimeshPrimitiveManager GImpactTrimeshPrimitiveManager
|
||||
public override PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_gImpactTrimeshPrimitiveManager == null)
|
||||
{
|
||||
_gImpactTrimeshPrimitiveManager = new TrimeshPrimitiveManager(btGImpactMeshShapePart_getTrimeshPrimitiveManager(_native));
|
||||
}
|
||||
return _gImpactTrimeshPrimitiveManager;
|
||||
}
|
||||
get { return GImpactTrimeshPrimitiveManager; }
|
||||
}
|
||||
|
||||
public TrimeshPrimitiveManager GImpactTrimeshPrimitiveManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_gImpactTrimeshPrimitiveManager == null)
|
||||
{
|
||||
_gImpactTrimeshPrimitiveManager = new TrimeshPrimitiveManager(btGImpactMeshShapePart_getTrimeshPrimitiveManager(_native));
|
||||
}
|
||||
return _gImpactTrimeshPrimitiveManager;
|
||||
}
|
||||
}
|
||||
|
||||
public int VertexCount
|
||||
|
@ -567,7 +491,7 @@ namespace BulletSharp
|
|||
public class GImpactMeshShape : GImpactShapeInterface
|
||||
{
|
||||
private StridingMeshInterface _meshInterface;
|
||||
bool _disposeMeshInterface;
|
||||
bool _disposeMeshInterface;
|
||||
|
||||
internal GImpactMeshShape(IntPtr native)
|
||||
: base(native)
|
||||
|
@ -587,15 +511,15 @@ namespace BulletSharp
|
|||
|
||||
public StridingMeshInterface MeshInterface
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_meshInterface == null)
|
||||
{
|
||||
_meshInterface = new StridingMeshInterface(btGImpactMeshShape_getMeshInterface(_native));
|
||||
_disposeMeshInterface = true;
|
||||
}
|
||||
return _meshInterface;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_meshInterface == null)
|
||||
{
|
||||
_meshInterface = new StridingMeshInterface(btGImpactMeshShape_getMeshInterface(_native));
|
||||
_disposeMeshInterface = true;
|
||||
}
|
||||
return _meshInterface;
|
||||
}
|
||||
}
|
||||
|
||||
public int MeshPartCount
|
||||
|
@ -603,20 +527,20 @@ namespace BulletSharp
|
|||
get { return btGImpactMeshShape_getMeshPartCount(_native); }
|
||||
}
|
||||
|
||||
public override PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
public override PrimitiveManagerBase PrimitiveManager
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && _disposeMeshInterface)
|
||||
{
|
||||
_meshInterface.Dispose();
|
||||
_disposeMeshInterface = false;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && _disposeMeshInterface)
|
||||
{
|
||||
_meshInterface.Dispose();
|
||||
_disposeMeshInterface = false;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btGImpactMeshShape_new(IntPtr meshInterface);
|
||||
|
@ -628,15 +552,15 @@ namespace BulletSharp
|
|||
static extern int btGImpactMeshShape_getMeshPartCount(IntPtr obj);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GImpactMeshShapeData
|
||||
{
|
||||
public CollisionShapeFloatData CollisionShapeData;
|
||||
public StridingMeshInterfaceData MeshInterface;
|
||||
public Vector3FloatData LocalScaling;
|
||||
public float CollisionMargin;
|
||||
public int GImpactSubType;
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GImpactMeshShapeData
|
||||
{
|
||||
public CollisionShapeFloatData CollisionShapeData;
|
||||
public StridingMeshInterfaceData MeshInterface;
|
||||
public Vector3FloatData LocalScaling;
|
||||
public float CollisionMargin;
|
||||
public int GImpactSubType;
|
||||
|
||||
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(GImpactMeshShapeData), fieldName).ToInt32(); }
|
||||
}
|
||||
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(GImpactMeshShapeData), fieldName).ToInt32(); }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,48 +7,48 @@ namespace BulletSharp
|
|||
{
|
||||
public class GimTriangleContact : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
|
||||
internal GimTriangleContact(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
Native = native;
|
||||
}
|
||||
|
||||
public GimTriangleContact()
|
||||
{
|
||||
_native = GIM_TRIANGLE_CONTACT_new();
|
||||
Native = GIM_TRIANGLE_CONTACT_new();
|
||||
}
|
||||
|
||||
public GimTriangleContact(GimTriangleContact other)
|
||||
{
|
||||
_native = GIM_TRIANGLE_CONTACT_new2(other._native);
|
||||
Native = GIM_TRIANGLE_CONTACT_new2(other.Native);
|
||||
}
|
||||
|
||||
public void CopyFrom(GimTriangleContact other)
|
||||
{
|
||||
GIM_TRIANGLE_CONTACT_copy_from(_native, other._native);
|
||||
GIM_TRIANGLE_CONTACT_copy_from(Native, other.Native);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public void MergePoints(Vector4 plane, float margin, Vector3 points, int pointCount)
|
||||
{
|
||||
GIM_TRIANGLE_CONTACT_merge_points(_native, ref plane, margin, ref points, pointCount);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public float PenetrationDepth
|
||||
{
|
||||
get { return GIM_TRIANGLE_CONTACT_getPenetration_depth(_native); }
|
||||
set { GIM_TRIANGLE_CONTACT_setPenetration_depth(_native, value); }
|
||||
get { return GIM_TRIANGLE_CONTACT_getPenetration_depth(Native); }
|
||||
set { GIM_TRIANGLE_CONTACT_setPenetration_depth(Native, value); }
|
||||
}
|
||||
|
||||
public int PointCount
|
||||
{
|
||||
get { return GIM_TRIANGLE_CONTACT_getPoint_count(_native); }
|
||||
set { GIM_TRIANGLE_CONTACT_setPoint_count(_native, value); }
|
||||
get { return GIM_TRIANGLE_CONTACT_getPoint_count(Native); }
|
||||
set { GIM_TRIANGLE_CONTACT_setPoint_count(Native, value); }
|
||||
}
|
||||
|
||||
public Vector3Array Points
|
||||
{
|
||||
get { return new Vector3Array(GIM_TRIANGLE_CONTACT_getPoints(_native), 16); }
|
||||
get { return new Vector3Array(GIM_TRIANGLE_CONTACT_getPoints(Native), 16); }
|
||||
}
|
||||
|
||||
public Vector4 SeparatingNormal
|
||||
|
@ -56,10 +56,10 @@ namespace BulletSharp
|
|||
get
|
||||
{
|
||||
Vector4 value;
|
||||
GIM_TRIANGLE_CONTACT_getSeparating_normal(_native, out value);
|
||||
GIM_TRIANGLE_CONTACT_getSeparating_normal(Native, out value);
|
||||
return value;
|
||||
}
|
||||
set { GIM_TRIANGLE_CONTACT_setSeparating_normal(_native, ref value); }
|
||||
set { GIM_TRIANGLE_CONTACT_setSeparating_normal(Native, ref value); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -70,10 +70,10 @@ namespace BulletSharp
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
GIM_TRIANGLE_CONTACT_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
GIM_TRIANGLE_CONTACT_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,86 +82,86 @@ namespace BulletSharp
|
|||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_TRIANGLE_CONTACT_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_TRIANGLE_CONTACT_new2(IntPtr other);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_copy_from(IntPtr obj, IntPtr other);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern float GIM_TRIANGLE_CONTACT_getPenetration_depth(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int GIM_TRIANGLE_CONTACT_getPoint_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr GIM_TRIANGLE_CONTACT_getPoints(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_getSeparating_normal(IntPtr obj, [Out] out Vector4 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_merge_points(IntPtr obj, [In] ref Vector4 plane, float margin, [In] ref Vector3 points, int point_count);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_setPenetration_depth(IntPtr obj, float value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_setPoint_count(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_setSeparating_normal(IntPtr obj, [In] ref Vector4 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void GIM_TRIANGLE_CONTACT_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class PrimitiveTriangle : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
internal IntPtr Native;
|
||||
|
||||
internal PrimitiveTriangle(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
Native = native;
|
||||
}
|
||||
|
||||
public PrimitiveTriangle()
|
||||
{
|
||||
_native = btPrimitiveTriangle_new();
|
||||
Native = btPrimitiveTriangle_new();
|
||||
}
|
||||
|
||||
public void ApplyTransform(Matrix t)
|
||||
{
|
||||
btPrimitiveTriangle_applyTransform(_native, ref t);
|
||||
btPrimitiveTriangle_applyTransform(Native, ref t);
|
||||
}
|
||||
|
||||
public void BuildTriPlane()
|
||||
{
|
||||
btPrimitiveTriangle_buildTriPlane(_native);
|
||||
btPrimitiveTriangle_buildTriPlane(Native);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
public int ClipTriangle(PrimitiveTriangle other, Vector3 clippedPoints)
|
||||
{
|
||||
return btPrimitiveTriangle_clip_triangle(_native, other._native, ref clippedPoints);
|
||||
return btPrimitiveTriangle_clip_triangle(Native, other.Native, ref clippedPoints);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public bool FindTriangleCollisionClipMethod(PrimitiveTriangle other, GimTriangleContact contacts)
|
||||
{
|
||||
return btPrimitiveTriangle_find_triangle_collision_clip_method(_native, other._native, contacts._native);
|
||||
return btPrimitiveTriangle_find_triangle_collision_clip_method(Native, other.Native, contacts.Native);
|
||||
}
|
||||
|
||||
public void GetEdgePlane(int edgeIndex, out Vector4 plane)
|
||||
{
|
||||
btPrimitiveTriangle_get_edge_plane(_native, edgeIndex, out plane);
|
||||
btPrimitiveTriangle_get_edge_plane(Native, edgeIndex, out plane);
|
||||
}
|
||||
|
||||
public bool OverlapTestConservative(PrimitiveTriangle other)
|
||||
{
|
||||
return btPrimitiveTriangle_overlap_test_conservative(_native, other._native);
|
||||
return btPrimitiveTriangle_overlap_test_conservative(Native, other.Native);
|
||||
}
|
||||
|
||||
public float Dummy
|
||||
{
|
||||
get { return btPrimitiveTriangle_getDummy(_native); }
|
||||
set { btPrimitiveTriangle_setDummy(_native, value); }
|
||||
get { return btPrimitiveTriangle_getDummy(Native); }
|
||||
set { btPrimitiveTriangle_setDummy(Native, value); }
|
||||
}
|
||||
|
||||
public float Margin
|
||||
{
|
||||
get { return btPrimitiveTriangle_getMargin(_native); }
|
||||
set { btPrimitiveTriangle_setMargin(_native, value); }
|
||||
get { return btPrimitiveTriangle_getMargin(Native); }
|
||||
set { btPrimitiveTriangle_setMargin(Native, value); }
|
||||
}
|
||||
|
||||
public Vector4 Plane
|
||||
|
@ -169,15 +169,15 @@ namespace BulletSharp
|
|||
get
|
||||
{
|
||||
Vector4 value;
|
||||
btPrimitiveTriangle_getPlane(_native, out value);
|
||||
btPrimitiveTriangle_getPlane(Native, out value);
|
||||
return value;
|
||||
}
|
||||
set { btPrimitiveTriangle_setPlane(_native, ref value); }
|
||||
set { btPrimitiveTriangle_setPlane(Native, ref value); }
|
||||
}
|
||||
|
||||
public Vector3Array Vertices
|
||||
{
|
||||
get { return new Vector3Array(btPrimitiveTriangle_getVertices(_native), 3); }
|
||||
get { return new Vector3Array(btPrimitiveTriangle_getVertices(Native), 3); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -188,10 +188,10 @@ namespace BulletSharp
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
btPrimitiveTriangle_delete(_native);
|
||||
_native = IntPtr.Zero;
|
||||
btPrimitiveTriangle_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,37 +200,37 @@ namespace BulletSharp
|
|||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btPrimitiveTriangle_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_applyTransform(IntPtr obj, [In] ref Matrix t);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_buildTriPlane(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btPrimitiveTriangle_clip_triangle(IntPtr obj, IntPtr other, [Out] out Vector3 clipped_points);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btPrimitiveTriangle_find_triangle_collision_clip_method(IntPtr obj, IntPtr other, IntPtr contacts);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_get_edge_plane(IntPtr obj, int edge_index, [Out] out Vector4 plane);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern float btPrimitiveTriangle_getDummy(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern float btPrimitiveTriangle_getMargin(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_getPlane(IntPtr obj, [Out] out Vector4 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btPrimitiveTriangle_getVertices(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
static extern bool btPrimitiveTriangle_overlap_test_conservative(IntPtr obj, IntPtr other);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_setDummy(IntPtr obj, float value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_setMargin(IntPtr obj, float value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_setPlane(IntPtr obj, [In] ref Vector4 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btPrimitiveTriangle_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,123 +9,163 @@ namespace BulletSharp
|
|||
{
|
||||
public class IndexedMesh : IDisposable
|
||||
{
|
||||
internal IntPtr _native;
|
||||
bool _preventDelete;
|
||||
private bool _ownsData;
|
||||
internal IntPtr Native;
|
||||
private bool _preventDelete;
|
||||
private bool _ownsData;
|
||||
|
||||
internal IndexedMesh(IntPtr native, bool preventDelete)
|
||||
{
|
||||
_native = native;
|
||||
Native = native;
|
||||
_preventDelete = preventDelete;
|
||||
}
|
||||
|
||||
public IndexedMesh()
|
||||
{
|
||||
_native = btIndexedMesh_new();
|
||||
Native = UnsafeNativeMethods.btIndexedMesh_new();
|
||||
}
|
||||
|
||||
public void Allocate(int numTriangles, int numVertices, int triangleIndexStride = sizeof(int) * 3, int vertexStride = sizeof(float) * 3)
|
||||
{
|
||||
if (_ownsData)
|
||||
{
|
||||
Free();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ownsData = true;
|
||||
}
|
||||
public void Allocate(int numTriangles, int numVertices, int triangleIndexStride = sizeof(int) * 3, int vertexStride = sizeof(float) * 3)
|
||||
{
|
||||
if (_ownsData)
|
||||
{
|
||||
Free();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ownsData = true;
|
||||
}
|
||||
|
||||
switch (triangleIndexStride)
|
||||
{
|
||||
case sizeof(byte) * 3:
|
||||
IndexType = PhyScalarType.Byte;
|
||||
break;
|
||||
case sizeof(short) * 3:
|
||||
IndexType = PhyScalarType.Int16;
|
||||
break;
|
||||
case sizeof(int) * 3:
|
||||
default:
|
||||
IndexType = PhyScalarType.Int32;
|
||||
break;
|
||||
}
|
||||
VertexType = PhyScalarType.Single;
|
||||
switch (triangleIndexStride)
|
||||
{
|
||||
case sizeof(byte) * 3:
|
||||
IndexType = PhyScalarType.Byte;
|
||||
break;
|
||||
case sizeof(short) * 3:
|
||||
IndexType = PhyScalarType.Int16;
|
||||
break;
|
||||
case sizeof(int) * 3:
|
||||
default:
|
||||
IndexType = PhyScalarType.Int32;
|
||||
break;
|
||||
}
|
||||
VertexType = PhyScalarType.Single;
|
||||
|
||||
NumTriangles = numTriangles;
|
||||
TriangleIndexBase = Marshal.AllocHGlobal(numTriangles * triangleIndexStride);
|
||||
TriangleIndexStride = triangleIndexStride;
|
||||
NumVertices = numVertices;
|
||||
VertexBase = Marshal.AllocHGlobal(numVertices * vertexStride);
|
||||
VertexStride = vertexStride;
|
||||
}
|
||||
NumTriangles = numTriangles;
|
||||
TriangleIndexBase = Marshal.AllocHGlobal(numTriangles * triangleIndexStride);
|
||||
TriangleIndexStride = triangleIndexStride;
|
||||
NumVertices = numVertices;
|
||||
VertexBase = Marshal.AllocHGlobal(numVertices * vertexStride);
|
||||
VertexStride = vertexStride;
|
||||
}
|
||||
|
||||
public void Free()
|
||||
{
|
||||
if (_ownsData)
|
||||
{
|
||||
Marshal.FreeHGlobal(TriangleIndexBase);
|
||||
Marshal.FreeHGlobal(VertexBase);
|
||||
_ownsData = false;
|
||||
}
|
||||
}
|
||||
public void Free()
|
||||
{
|
||||
if (_ownsData)
|
||||
{
|
||||
Marshal.FreeHGlobal(TriangleIndexBase);
|
||||
Marshal.FreeHGlobal(VertexBase);
|
||||
_ownsData = false;
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe UnmanagedMemoryStream GetTriangleStream()
|
||||
{
|
||||
int length = btIndexedMesh_getNumTriangles(_native) * btIndexedMesh_getTriangleIndexStride(_native);
|
||||
return new UnmanagedMemoryStream((byte*)btIndexedMesh_getTriangleIndexBase(_native).ToPointer(), length, length, FileAccess.ReadWrite);
|
||||
}
|
||||
public unsafe UnmanagedMemoryStream GetTriangleStream()
|
||||
{
|
||||
int length = NumTriangles * TriangleIndexStride;
|
||||
return new UnmanagedMemoryStream((byte*)TriangleIndexBase.ToPointer(), length, length, FileAccess.ReadWrite);
|
||||
}
|
||||
|
||||
public unsafe UnmanagedMemoryStream GetVertexStream()
|
||||
{
|
||||
int length = btIndexedMesh_getNumVertices(_native) * btIndexedMesh_getVertexStride(_native);
|
||||
return new UnmanagedMemoryStream((byte*)btIndexedMesh_getVertexBase(_native).ToPointer(), length, length, FileAccess.ReadWrite);
|
||||
}
|
||||
public unsafe UnmanagedMemoryStream GetVertexStream()
|
||||
{
|
||||
int length = NumVertices * VertexStride;
|
||||
return new UnmanagedMemoryStream((byte*)UnsafeNativeMethods.btIndexedMesh_getVertexBase(Native).ToPointer(), length, length, FileAccess.ReadWrite);
|
||||
}
|
||||
|
||||
public void SetData(ICollection<int> triangles, ICollection<float> vertices)
|
||||
{
|
||||
SetTriangles(triangles);
|
||||
|
||||
float[] vertexArray = vertices as float[];
|
||||
if (vertexArray == null)
|
||||
{
|
||||
vertexArray = new float[vertices.Count];
|
||||
vertices.CopyTo(vertexArray, 0);
|
||||
}
|
||||
Marshal.Copy(vertexArray, 0, VertexBase, vertices.Count);
|
||||
}
|
||||
|
||||
public void SetData(ICollection<int> triangles, ICollection<Vector3> vertices)
|
||||
{
|
||||
SetTriangles(triangles);
|
||||
|
||||
float[] vertexArray = new float[vertices.Count * 3];
|
||||
int i = 0;
|
||||
foreach (Vector3 v in vertices)
|
||||
{
|
||||
vertexArray[i] = v.X;
|
||||
vertexArray[i + 1] = v.Y;
|
||||
vertexArray[i + 2] = v.Z;
|
||||
i += 3;
|
||||
}
|
||||
Marshal.Copy(vertexArray, 0, VertexBase, vertexArray.Length);
|
||||
}
|
||||
|
||||
private void SetTriangles(ICollection<int> triangles)
|
||||
{
|
||||
int[] triangleArray = triangles as int[];
|
||||
if (triangleArray == null)
|
||||
{
|
||||
triangleArray = new int[triangles.Count];
|
||||
triangles.CopyTo(triangleArray, 0);
|
||||
}
|
||||
Marshal.Copy(triangleArray, 0, TriangleIndexBase, triangleArray.Length);
|
||||
}
|
||||
|
||||
public PhyScalarType IndexType
|
||||
{
|
||||
get { return btIndexedMesh_getIndexType(_native); }
|
||||
set { btIndexedMesh_setIndexType(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getIndexType(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setIndexType(Native, value); }
|
||||
}
|
||||
|
||||
public int NumTriangles
|
||||
{
|
||||
get { return btIndexedMesh_getNumTriangles(_native); }
|
||||
set { btIndexedMesh_setNumTriangles(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getNumTriangles(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setNumTriangles(Native, value); }
|
||||
}
|
||||
|
||||
public int NumVertices
|
||||
{
|
||||
get { return btIndexedMesh_getNumVertices(_native); }
|
||||
set { btIndexedMesh_setNumVertices(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getNumVertices(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setNumVertices(Native, value); }
|
||||
}
|
||||
|
||||
public IntPtr TriangleIndexBase
|
||||
{
|
||||
get { return btIndexedMesh_getTriangleIndexBase(_native); }
|
||||
set { btIndexedMesh_setTriangleIndexBase(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getTriangleIndexBase(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setTriangleIndexBase(Native, value); }
|
||||
}
|
||||
|
||||
public int TriangleIndexStride
|
||||
{
|
||||
get { return btIndexedMesh_getTriangleIndexStride(_native); }
|
||||
set { btIndexedMesh_setTriangleIndexStride(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getTriangleIndexStride(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setTriangleIndexStride(Native, value); }
|
||||
}
|
||||
|
||||
public IntPtr VertexBase
|
||||
public IntPtr VertexBase
|
||||
{
|
||||
get { return btIndexedMesh_getVertexBase(_native); }
|
||||
set { btIndexedMesh_setVertexBase(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getVertexBase(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setVertexBase(Native, value); }
|
||||
}
|
||||
|
||||
public int VertexStride
|
||||
{
|
||||
get { return btIndexedMesh_getVertexStride(_native); }
|
||||
set { btIndexedMesh_setVertexStride(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getVertexStride(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setVertexStride(Native, value); }
|
||||
}
|
||||
|
||||
public PhyScalarType VertexType
|
||||
{
|
||||
get { return btIndexedMesh_getVertexType(_native); }
|
||||
set { btIndexedMesh_setVertexType(_native, value); }
|
||||
get { return UnsafeNativeMethods.btIndexedMesh_getVertexType(Native); }
|
||||
set { UnsafeNativeMethods.btIndexedMesh_setVertexType(Native, value); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -136,14 +176,14 @@ namespace BulletSharp
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (_native != IntPtr.Zero)
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
Free();
|
||||
Free();
|
||||
if (!_preventDelete)
|
||||
{
|
||||
btIndexedMesh_delete(_native);
|
||||
UnsafeNativeMethods.btIndexedMesh_delete(Native);
|
||||
}
|
||||
_native = IntPtr.Zero;
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,50 +191,13 @@ namespace BulletSharp
|
|||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btIndexedMesh_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern PhyScalarType btIndexedMesh_getIndexType(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btIndexedMesh_getNumTriangles(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btIndexedMesh_getNumVertices(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btIndexedMesh_getTriangleIndexBase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btIndexedMesh_getTriangleIndexStride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btIndexedMesh_getVertexBase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern int btIndexedMesh_getVertexStride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern PhyScalarType btIndexedMesh_getVertexType(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setIndexType(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setNumTriangles(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setNumVertices(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setTriangleIndexBase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setTriangleIndexStride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setVertexBase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setVertexStride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_setVertexType(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern void btIndexedMesh_delete(IntPtr obj);
|
||||
}
|
||||
|
||||
public class TriangleIndexVertexArray : StridingMeshInterface
|
||||
{
|
||||
private List<IndexedMesh> _meshes = new List<IndexedMesh>();
|
||||
private IndexedMesh _initialMesh;
|
||||
private AlignedIndexedMeshArray _indexedMeshArray;
|
||||
private List<IndexedMesh> _meshes = new List<IndexedMesh>();
|
||||
private IndexedMesh _initialMesh;
|
||||
private AlignedIndexedMeshArray _indexedMeshArray;
|
||||
|
||||
internal TriangleIndexVertexArray(IntPtr native)
|
||||
: base(native)
|
||||
|
@ -206,92 +209,60 @@ namespace BulletSharp
|
|||
{
|
||||
}
|
||||
|
||||
public TriangleIndexVertexArray(ICollection<int> triangles, ICollection<float> vertices)
|
||||
: base(btTriangleIndexVertexArray_new())
|
||||
{
|
||||
_initialMesh = new IndexedMesh();
|
||||
_initialMesh.Allocate(triangles.Count / 3, vertices.Count / 3);
|
||||
|
||||
int[] triangleArray = triangles as int[];
|
||||
if (triangleArray == null)
|
||||
{
|
||||
triangleArray = new int[triangles.Count];
|
||||
triangles.CopyTo(triangleArray, 0);
|
||||
}
|
||||
Marshal.Copy(triangleArray, 0, _initialMesh.TriangleIndexBase, triangles.Count);
|
||||
|
||||
float[] vertexArray = vertices as float[];
|
||||
if (vertexArray == null)
|
||||
{
|
||||
vertexArray = new float[vertices.Count];
|
||||
vertices.CopyTo(vertexArray, 0);
|
||||
}
|
||||
Marshal.Copy(vertexArray, 0, _initialMesh.VertexBase, vertices.Count);
|
||||
|
||||
AddIndexedMesh(_initialMesh);
|
||||
}
|
||||
public TriangleIndexVertexArray(ICollection<int> triangles, ICollection<float> vertices)
|
||||
: base(btTriangleIndexVertexArray_new())
|
||||
{
|
||||
_initialMesh = new IndexedMesh();
|
||||
_initialMesh.Allocate(triangles.Count / 3, vertices.Count / 3);
|
||||
_initialMesh.SetData(triangles, vertices);
|
||||
AddIndexedMesh(_initialMesh);
|
||||
}
|
||||
|
||||
public TriangleIndexVertexArray(ICollection<int> triangles, ICollection<Vector3> vertices)
|
||||
: base(btTriangleIndexVertexArray_new())
|
||||
{
|
||||
_initialMesh = new IndexedMesh();
|
||||
_initialMesh.Allocate(triangles.Count / 3, vertices.Count);
|
||||
int[] triangleArray = triangles as int[];
|
||||
if (triangleArray == null)
|
||||
{
|
||||
triangleArray = new int[triangles.Count];
|
||||
triangles.CopyTo(triangleArray, 0);
|
||||
}
|
||||
Marshal.Copy(triangleArray, 0, _initialMesh.TriangleIndexBase, triangles.Count);
|
||||
float[] vertexArray = new float[vertices.Count * 3];
|
||||
int i = 0;
|
||||
foreach (Vector3 v in vertices)
|
||||
{
|
||||
vertexArray[i] = v.X;
|
||||
vertexArray[i + 1] = v.Y;
|
||||
vertexArray[i + 2] = v.Z;
|
||||
i += 3;
|
||||
}
|
||||
Marshal.Copy(vertexArray, 0, _initialMesh.VertexBase, vertices.Count);
|
||||
AddIndexedMesh(_initialMesh);
|
||||
}
|
||||
public TriangleIndexVertexArray(ICollection<int> triangles, ICollection<Vector3> vertices)
|
||||
: base(btTriangleIndexVertexArray_new())
|
||||
{
|
||||
_initialMesh = new IndexedMesh();
|
||||
_initialMesh.Allocate(triangles.Count / 3, vertices.Count);
|
||||
_initialMesh.SetData(triangles, vertices);
|
||||
AddIndexedMesh(_initialMesh);
|
||||
}
|
||||
|
||||
public TriangleIndexVertexArray(int numTriangles, IntPtr triangleIndexBase, int triangleIndexStride, int numVertices, IntPtr vertexBase, int vertexStride)
|
||||
public TriangleIndexVertexArray(int numTriangles, IntPtr triangleIndexBase, int triangleIndexStride, int numVertices, IntPtr vertexBase, int vertexStride)
|
||||
: base(btTriangleIndexVertexArray_new2(numTriangles, triangleIndexBase, triangleIndexStride, numVertices, vertexBase, vertexStride))
|
||||
{
|
||||
}
|
||||
|
||||
public void AddIndexedMesh(IndexedMesh mesh, PhyScalarType indexType = PhyScalarType.Int32)
|
||||
{
|
||||
_meshes.Add(mesh);
|
||||
btTriangleIndexVertexArray_addIndexedMesh(_native, mesh._native, indexType);
|
||||
_meshes.Add(mesh);
|
||||
btTriangleIndexVertexArray_addIndexedMesh(_native, mesh.Native, indexType);
|
||||
}
|
||||
|
||||
public AlignedIndexedMeshArray IndexedMeshArray
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: link _indexedMeshArray to _meshes
|
||||
if (_indexedMeshArray == null)
|
||||
{
|
||||
_indexedMeshArray = new AlignedIndexedMeshArray(btTriangleIndexVertexArray_getIndexedMeshArray(_native));
|
||||
}
|
||||
return _indexedMeshArray;
|
||||
}
|
||||
get
|
||||
{
|
||||
// TODO: link _indexedMeshArray to _meshes
|
||||
if (_indexedMeshArray == null)
|
||||
{
|
||||
_indexedMeshArray = new AlignedIndexedMeshArray(btTriangleIndexVertexArray_getIndexedMeshArray(_native));
|
||||
}
|
||||
return _indexedMeshArray;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_initialMesh != null)
|
||||
{
|
||||
_initialMesh.Dispose();
|
||||
_initialMesh = null;
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_initialMesh != null)
|
||||
{
|
||||
_initialMesh.Dispose();
|
||||
_initialMesh = null;
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr btTriangleIndexVertexArray_new();
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace BulletSharp
|
|||
|
||||
public void Add(IndexedMesh item)
|
||||
{
|
||||
btAlignedObjectArray_btIndexedMesh_push_back(_native, item._native);
|
||||
btAlignedObjectArray_btIndexedMesh_push_back(_native, item.Native);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
|
|
|
@ -32,6 +32,34 @@ namespace BulletSharp
|
|||
public static extern void BT_BOX_BOX_TRANSFORM_CACHE_transform(IntPtr obj, [In] ref Vector3 point, out Vector3 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void BT_BOX_BOX_TRANSFORM_CACHE_delete(IntPtr native);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr BT_QUANTIZED_BVH_NODE_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int BT_QUANTIZED_BVH_NODE_getDataIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int BT_QUANTIZED_BVH_NODE_getEscapeIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int BT_QUANTIZED_BVH_NODE_getEscapeIndexOrDataIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr BT_QUANTIZED_BVH_NODE_getQuantizedAabbMax(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr BT_QUANTIZED_BVH_NODE_getQuantizedAabbMin(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool BT_QUANTIZED_BVH_NODE_isLeafNode(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void BT_QUANTIZED_BVH_NODE_setDataIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void BT_QUANTIZED_BVH_NODE_setEscapeIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void BT_QUANTIZED_BVH_NODE_setEscapeIndexOrDataIndex(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool BT_QUANTIZED_BVH_NODE_testQuantizedBoxOverlapp(IntPtr obj, ushort[] quantizedMin, ushort[] quantizedMax);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void BT_QUANTIZED_BVH_NODE_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btAABB_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
|
@ -93,5 +121,400 @@ namespace BulletSharp
|
|||
public static extern void btAABB_setMin(IntPtr obj, [In] ref Vector3 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btAABB_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btBvhTree_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btBvhTree_build_tree(IntPtr obj, IntPtr primitive_boxes);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btBvhTree_clearNodes(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btBvhTree_get_node_pointer(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btBvhTree_get_node_pointer2(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btBvhTree_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btBvhTree_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btBvhTree_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btBvhTree_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btBvhTree_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btBvhTree_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btBvhTree_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btBvhTree_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btBvhTree_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactBvh_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactBvh_new2(IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactBvh_boxQuery(IntPtr obj, IntPtr box, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactBvh_boxQueryTrans(IntPtr obj, IntPtr box, [In] ref Matrix transform, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_buildSet(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_find_collision(IntPtr boxset1, [In] ref Matrix trans1, IntPtr boxset2, [In] ref Matrix trans2, IntPtr collision_pairs);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactBvh_get_node_pointer(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactBvh_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactBvh_getGlobalBox(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactBvh_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactBvh_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactBvh_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_getNodeTriangle(IntPtr obj, int nodeindex, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactBvh_getPrimitiveManager(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactBvh_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactBvh_hasHierarchy(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactBvh_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactBvh_isTrimesh(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactBvh_rayQuery(IntPtr obj, [In] ref Vector3 ray_dir, [In] ref Vector3 ray_origin, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_setPrimitiveManager(IntPtr obj, IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_update(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactBvh_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactCollisionAlgorithm_CreateFunc_new();
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactCollisionAlgorithm_new(IntPtr ci, IntPtr body0Wrap, IntPtr body1Wrap);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactCollisionAlgorithm_getFace0(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactCollisionAlgorithm_getFace1(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactCollisionAlgorithm_getPart0(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactCollisionAlgorithm_getPart1(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_gimpact_vs_compoundshape(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1, bool swapped);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_gimpact_vs_concave(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1, bool swapped);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_gimpact_vs_gimpact(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_gimpact_vs_shape(IntPtr obj, IntPtr body0Wrap, IntPtr body1Wrap, IntPtr shape0, IntPtr shape1, bool swapped);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactCollisionAlgorithm_internalGetResultOut(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_registerAlgorithm(IntPtr dispatcher);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_setFace0(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_setFace1(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_setPart0(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactCollisionAlgorithm_setPart1(IntPtr obj, int value);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_new(IntPtr meshInterface, int part);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_new2(IntPtr manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_new3();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_get_bullet_triangle(IntPtr obj, int prim_index, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_get_indices(IntPtr obj, int face_index, out uint i0, out uint i1, out uint i2b);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex(IntPtr obj, uint vertex_index, out Vector3 vertex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_get_vertex_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexbase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndexstride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern PhyScalarType btGImpactMeshShapePart_TrimeshPrimitiveManager_getIndicestype(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getLock_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern float btGImpactMeshShapePart_TrimeshPrimitiveManager_getMargin(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_getMeshInterface(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumfaces(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getNumverts(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getPart(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_getScale(IntPtr obj, out Vector3 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactMeshShapePart_TrimeshPrimitiveManager_getStride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern PhyScalarType btGImpactMeshShapePart_TrimeshPrimitiveManager_getType(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactMeshShapePart_TrimeshPrimitiveManager_getVertexbase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_lock(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexbase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndexstride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setIndicestype(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setLock_count(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setMargin(IntPtr obj, float value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setMeshInterface(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumfaces(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setNumverts(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setPart(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setScale(IntPtr obj, [In] ref Vector3 value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setStride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setType(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_setVertexbase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactMeshShapePart_TrimeshPrimitiveManager_unlock(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactQuantizedBvh_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactQuantizedBvh_new2(IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactQuantizedBvh_boxQuery(IntPtr obj, IntPtr box, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactQuantizedBvh_boxQueryTrans(IntPtr obj, IntPtr box, [In] ref Matrix transform, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_buildSet(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_find_collision(IntPtr boxset1, [In] ref Matrix trans1, IntPtr boxset2, [In] ref Matrix trans2, IntPtr collision_pairs);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactQuantizedBvh_get_node_pointer(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactQuantizedBvh_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactQuantizedBvh_getGlobalBox(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactQuantizedBvh_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactQuantizedBvh_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactQuantizedBvh_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_getNodeTriangle(IntPtr obj, int nodeindex, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btGImpactQuantizedBvh_getPrimitiveManager(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btGImpactQuantizedBvh_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactQuantizedBvh_hasHierarchy(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactQuantizedBvh_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactQuantizedBvh_isTrimesh(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btGImpactQuantizedBvh_rayQuery(IntPtr obj, [In] ref Vector3 ray_dir, [In] ref Vector3 ray_origin, IntPtr collided_results);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_setPrimitiveManager(IntPtr obj, IntPtr primitive_manager);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_update(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btGImpactQuantizedBvh_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btIndexedMesh_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern PhyScalarType btIndexedMesh_getIndexType(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btIndexedMesh_getNumTriangles(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btIndexedMesh_getNumVertices(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btIndexedMesh_getTriangleIndexBase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btIndexedMesh_getTriangleIndexStride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btIndexedMesh_getVertexBase(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btIndexedMesh_getVertexStride(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern PhyScalarType btIndexedMesh_getVertexType(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setIndexType(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setNumTriangles(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setNumVertices(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setTriangleIndexBase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setTriangleIndexStride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setVertexBase(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setVertexStride(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_setVertexType(IntPtr obj, PhyScalarType value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btIndexedMesh_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btPairSet_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btPairSet_push_pair(IntPtr obj, int index1, int index2);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btPairSet_push_pair_inv(IntPtr obj, int index1, int index2);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btPairSet_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btPrimitiveManagerBase_get_primitive_box(IntPtr obj, int prim_index, IntPtr primbox);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btPrimitiveManagerBase_get_primitive_count(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btPrimitiveManagerBase_get_primitive_triangle(IntPtr obj, int prim_index, IntPtr triangle);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btPrimitiveManagerBase_is_trimesh(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btPrimitiveManagerBase_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btQuantizedBvhTree_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btQuantizedBvhTree_build_tree(IntPtr obj, IntPtr primitive_boxes);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btQuantizedBvhTree_clearNodes(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr btQuantizedBvhTree_get_node_pointer(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btQuantizedBvhTree_getEscapeNodeIndex(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btQuantizedBvhTree_getLeftNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btQuantizedBvhTree_getNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btQuantizedBvhTree_getNodeCount(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btQuantizedBvhTree_getNodeData(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int btQuantizedBvhTree_getRightNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btQuantizedBvhTree_isLeafNode(IntPtr obj, int nodeindex);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btQuantizedBvhTree_quantizePoint(IntPtr obj, ushort[] quantizedpoint, [In] ref Vector3 point);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btQuantizedBvhTree_setNodeBound(IntPtr obj, int nodeindex, IntPtr bound);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool btQuantizedBvhTree_testQuantizedBoxOverlapp(IntPtr obj, int node_index, ushort[] quantizedMin, ushort[] quantizedMax);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void btQuantizedBvhTree_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_BVH_DATA_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_BVH_DATA_getBound(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int GIM_BVH_DATA_getData(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_DATA_setBound(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_DATA_setData(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_DATA_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_BVH_DATA_ARRAY_new();
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_BVH_TREE_NODE_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_BVH_TREE_NODE_getBound(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int GIM_BVH_TREE_NODE_getDataIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int GIM_BVH_TREE_NODE_getEscapeIndex(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool GIM_BVH_TREE_NODE_isLeafNode(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_TREE_NODE_setBound(IntPtr obj, IntPtr value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_TREE_NODE_setDataIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_TREE_NODE_setEscapeIndex(IntPtr obj, int index);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_BVH_TREE_NODE_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_BVH_TREE_NODE_ARRAY_new();
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_PAIR_new();
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_PAIR_new2(IntPtr p);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_PAIR_new3(int index1, int index2);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int GIM_PAIR_getIndex1(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern int GIM_PAIR_getIndex2(IntPtr obj);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_PAIR_setIndex1(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_PAIR_setIndex2(IntPtr obj, int value);
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern void GIM_PAIR_delete(IntPtr obj);
|
||||
|
||||
[DllImport(Native.Dll, CallingConvention = Native.Conv)]
|
||||
public static extern IntPtr GIM_QUANTIZED_BVH_NODE_ARRAY_new();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ namespace ConcaveConvexCastDemo
|
|||
private const int NumDynamicBoxesY = 30;
|
||||
|
||||
private bool _animatedMesh = true;
|
||||
private Stream _vertexStream;
|
||||
private BinaryWriter _vertexWriter;
|
||||
|
||||
private Vector3 _worldMin = new Vector3(-1000, -1000, -1000);
|
||||
private Vector3 _worldMax = new Vector3(1000, 1000, 1000);
|
||||
|
@ -141,6 +143,11 @@ namespace ConcaveConvexCastDemo
|
|||
_callback.Dispose();
|
||||
_indexVertexArrays.IndexedMeshArray[0].Dispose();
|
||||
_indexVertexArrays.Dispose();
|
||||
if (_vertexWriter != null)
|
||||
{
|
||||
_vertexWriter.Dispose();
|
||||
_vertexWriter = null;
|
||||
}
|
||||
|
||||
this.StandardCleanup();
|
||||
}
|
||||
|
@ -206,17 +213,19 @@ namespace ConcaveConvexCastDemo
|
|||
|
||||
private void SetVertexPositions(float waveHeight, float offset)
|
||||
{
|
||||
var vertexStream = _indexVertexArrays.GetVertexStream();
|
||||
using (var vertexWriter = new BinaryWriter(vertexStream))
|
||||
if (_vertexWriter == null)
|
||||
{
|
||||
for (int i = 0; i < NumVertsX; i++)
|
||||
_vertexStream = _indexVertexArrays.GetVertexStream();
|
||||
_vertexWriter = new BinaryWriter(_vertexStream);
|
||||
}
|
||||
_vertexStream.Position = 0;
|
||||
for (int i = 0; i < NumVertsX; i++)
|
||||
{
|
||||
for (int j = 0; j < NumVertsY; j++)
|
||||
{
|
||||
for (int j = 0; j < NumVertsY; j++)
|
||||
{
|
||||
vertexWriter.Write((i - NumVertsX * 0.5f) * TriangleSize);
|
||||
vertexWriter.Write(waveHeight * (float)Math.Sin(i + offset) * (float)Math.Cos(j + offset));
|
||||
vertexWriter.Write((j - NumVertsY * 0.5f) * TriangleSize);
|
||||
}
|
||||
_vertexWriter.Write((i - NumVertsX * 0.5f) * TriangleSize);
|
||||
_vertexWriter.Write(waveHeight * (float)Math.Sin(i + offset) * (float)Math.Cos(j + offset));
|
||||
_vertexWriter.Write((j - NumVertsY * 0.5f) * TriangleSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,13 +48,12 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BulletSharp, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="BulletSharp, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\bin\Release\BulletSharp.dll</HintPath>
|
||||
<HintPath>..\bin\Debug\BulletSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
@ -63,6 +62,7 @@
|
|||
<Compile Include="ContactSensorCallback.cs" />
|
||||
<Compile Include="DebugDrawTest.cs" />
|
||||
<Compile Include="DebugDrawTest2.cs" />
|
||||
<Compile Include="GImpactTests.cs" />
|
||||
<Compile Include="OverlapFilterCallbackTests.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
using BulletSharp;
|
||||
using BulletSharp.Math;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace BulletSharpTest
|
||||
{
|
||||
[TestFixture]
|
||||
[Category("GImpact")]
|
||||
public class GImpactTests
|
||||
{
|
||||
private GImpactMeshShape _impactMesh;
|
||||
private TriangleIndexVertexArray _meshInterface;
|
||||
private IndexedMesh _indexedMesh;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
int[] triangles1 = new[] { 0, 1, 2 };
|
||||
Vector3[] vertices1 = new Vector3[]
|
||||
{
|
||||
new Vector3(0, 0, 0),
|
||||
new Vector3(1, 0, 0),
|
||||
new Vector3(0, 1, 0)
|
||||
};
|
||||
_meshInterface = new TriangleIndexVertexArray(triangles1, vertices1);
|
||||
|
||||
int[] triangles2 = new[] { 0, 1, 2 };
|
||||
Vector3[] vertices2 = new Vector3[]
|
||||
{
|
||||
new Vector3(0, 0, 3),
|
||||
new Vector3(1, 0, 3),
|
||||
new Vector3(0, 1, 3)
|
||||
};
|
||||
_indexedMesh = new IndexedMesh();
|
||||
_indexedMesh.Allocate(triangles2.Length / 3, vertices2.Length);
|
||||
_indexedMesh.SetData(triangles2, vertices2);
|
||||
_meshInterface.AddIndexedMesh(_indexedMesh);
|
||||
|
||||
_impactMesh = new GImpactMeshShape(_meshInterface);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CompoundFromGImpactTest()
|
||||
{
|
||||
const float depth = 0.1f;
|
||||
CompoundShape compoundShape = CompoundFromGImpact.Create(_impactMesh, depth);
|
||||
Assert.AreEqual(compoundShape.NumChildShapes, 2);
|
||||
compoundShape.Dispose();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
_impactMesh.Dispose();
|
||||
_indexedMesh.Dispose();
|
||||
_meshInterface.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,13 +5,14 @@ using NUnit.Framework;
|
|||
namespace BulletSharpTest
|
||||
{
|
||||
[TestFixture]
|
||||
[Category("Serialization")]
|
||||
class SerializationTest
|
||||
{
|
||||
DefaultCollisionConfiguration _conf;
|
||||
CollisionDispatcher _dispatcher;
|
||||
DbvtBroadphase _broadphase;
|
||||
SequentialImpulseConstraintSolver _solver;
|
||||
DiscreteDynamicsWorld _world;
|
||||
private DefaultCollisionConfiguration _conf;
|
||||
private CollisionDispatcher _dispatcher;
|
||||
private DbvtBroadphase _broadphase;
|
||||
private SequentialImpulseConstraintSolver _solver;
|
||||
private DiscreteDynamicsWorld _world;
|
||||
|
||||
[Test]
|
||||
public void SerializeTest()
|
||||
|
@ -77,15 +78,14 @@ namespace BulletSharpTest
|
|||
Assert.True(fileLoader.LoadFile("data\\spider.bullet"));
|
||||
fileLoader.DeleteAllData();
|
||||
Assert.AreEqual(0, objects.Count);
|
||||
|
||||
/*
|
||||
Assert.True(fileLoader.LoadFile("data\\testFile.bullet"));
|
||||
fileLoader.DeleteAllData();
|
||||
Assert.AreEqual(0, objects.Count);
|
||||
/*
|
||||
*/
|
||||
Assert.True(fileLoader.LoadFile("data\\testFileFracture.bullet"));
|
||||
fileLoader.DeleteAllData();
|
||||
Assert.AreEqual(0, objects.Count);
|
||||
*/
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.5.0" targetFramework="net461" />
|
||||
<package id="NUnit3TestAdapter" version="3.5.1" targetFramework="net461" />
|
||||
<package id="NUnit" version="3.7.1" targetFramework="net461" />
|
||||
<package id="NUnit3TestAdapter" version="3.7.0" targetFramework="net461" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче