//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using System.Runtime.CompilerServices;
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// Implementation of GetTrianglesStart/Next that uses a multiple fixed lists of vertices for the triangles.
/// These are transformed into world space when getting the triangles.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:150
///
/// class GetTrianglesContextMultiVertexList
///
///
[InteropHandle]
public readonly partial struct GetTrianglesContextMultiVertexList : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:234
///
/// struct Part
///
///
[StructLayout(LayoutKind.Explicit, Size = 80)]
public partial struct Part
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:236
///
/// Mat44 mLocalToWorld
///
///
[FieldOffset(0)]
public float4x4 LocalToWorld;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:237
///
/// const Vec3 * mTriangleVertices
///
///
[FieldOffset(64)]
public Ptr TriangleVertices;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:238
///
/// size_t mNumTriangleVertices
///
///
[FieldOffset(72)]
public nuint NumTriangleVertices;
}
///
///
/// Constructor, to be called in GetTrianglesStart
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:154
///
/// GetTrianglesContextMultiVertexList(bool inIsInsideOut, const PhysicsMaterial *inMaterial)
///
///
public static GetTrianglesContextMultiVertexList Create(bool isInsideOut, PhysicsMaterial material) =>
Jolt.PInvoke.GetTrianglesContextMultiVertexList_Create(isInsideOut, material);
///
///
/// Add a mesh part and its transform
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:163
///
/// void AddPart(Mat44Arg inLocalToWorld, const Vec3 *inTriangleVertices, size_t inNumTriangleVertices)
///
///
///
///
/// triangleVertices is copied into a native buffer the object keeps; the span is only read.
///
///
public unsafe void AddPart(in float4x4 localToWorld, ReadOnlySpan triangleVertices)
{
fixed (float3* triangleVertices_fixed = triangleVertices)
{
Jolt.PInvoke.GetTrianglesContextMultiVertexList_AddPart(
this,
in localToWorld,
triangleVertices_fixed,
(nuint)triangleVertices.Length
);
}
}
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/GetTrianglesContext.h:171
///
/// int GetTrianglesNext(int inMaxTrianglesRequested, Float3 *outTriangleVertices, const PhysicsMaterial **outMaterials)
///
///
///
///
/// @see Shape::GetTrianglesNext
///
///
/// materials is a buffer of PhysicsMaterial handles you allocate and size; the handles the call writes into
/// it are borrowed from their owner - don't Dispose them.
///
///
public unsafe int GetTrianglesNext(
int maxTrianglesRequested,
Ptr triangleVertices,
Ptr materials
) =>
Jolt.PInvoke.GetTrianglesContextMultiVertexList_GetTrianglesNext(
this,
maxTrianglesRequested,
triangleVertices,
materials
);
public void Dispose() => Jolt.PInvoke.GetTrianglesContextMultiVertexList_Destroy(this);
}
}