API tweaks

main
cosmonaut 2022-06-23 23:50:43 -07:00
parent c90ea86940
commit 313a4f0660
1 changed files with 32 additions and 32 deletions

View File

@ -40,38 +40,43 @@ namespace Silkworm2CS
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct NodeCreateInfo public struct NodeCreateInfo
{ {
int X; public float X;
int Y; public float Y;
float Mass; public float Mass;
float Friction; public float Friction;
float Radius; public float Radius;
bool Pinned; public bool Pinned;
float PushFactor; public float PushFactor;
float WindFactor; public float WindFactor;
bool Destroyable; public bool Destroyable;
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct ClothCreateInfo public struct ClothCreateInfo
{ {
int X; public float X;
int Y; public float Y;
int HorizontalNodeCount; public float Z;
int VerticalNodeCount; public int HorizontalNodeCount;
float Mass; public int VerticalNodeCount;
float Friction; public float Mass;
float WindFactor; public float Friction;
float TearThreshold; public float WindFactor;
public float TearThreshold;
public float LeftUV;
public float TopUV;
public float RightUV;
public float BottomUV;
}; };
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vertex public struct Vertex
{ {
float X; public float X;
float Y; public float Y;
float Z; public float Z;
float U; public float U;
float V; public float V;
} }
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -85,7 +90,7 @@ namespace Silkworm2CS
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern IntPtr Silkworm_CreateNode(NodeCreateInfo* nodeCreateInfo); public unsafe static extern IntPtr Silkworm_CreateNode(in NodeCreateInfo nodeCreateInfo);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Silkworm_DestroyNode(IntPtr nodePtr); public static extern void Silkworm_DestroyNode(IntPtr nodePtr);
@ -99,7 +104,7 @@ namespace Silkworm2CS
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern IntPtr Silkworm_ClothCreate(ClothCreateInfo* clothCreateInfo); public unsafe static extern IntPtr Silkworm_ClothCreate(in ClothCreateInfo clothCreateInfo);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void Silkworm_ClothNodePin(IntPtr clothPtr, uint i, uint j); public unsafe static extern void Silkworm_ClothNodePin(IntPtr clothPtr, uint i, uint j);
@ -111,14 +116,9 @@ namespace Silkworm2CS
public unsafe static extern void Silkworm_ClothNodeDestroy(IntPtr clothPtr, uint i, uint j); public unsafe static extern void Silkworm_ClothNodeDestroy(IntPtr clothPtr, uint i, uint j);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int Silkworm_ClothFillTriangleBuffer( public unsafe static extern uint Silkworm_ClothRender(
IntPtr clothPtr, out IntPtr vertexBufferPointer,
IntPtr vertexBufferPtr, out uint vertexBufferLengthInBytes
float depth,
float leftUV,
float widthUV,
float topUV,
float heightUV
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]