mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
244 lines
11 KiB
C#
244 lines
11 KiB
C#
// <auto-generated/>
|
|
// 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
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Removes internal edges from collision results. Can be used to filter out 'ghost collisions'. Based on:
|
|
/// Contact generation for meshes - Pierre Terdiman (https://www.codercorner.com/MeshContacts.pdf)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L24">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:24</see>
|
|
/// <br/>
|
|
/// <c>class InternalEdgeRemovingCollector : public CollideShapeCollector</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Removes internal edges from collision results. Can be used to filter out 'ghost collisions'.
|
|
/// Based on: Contact generation for meshes - Pierre Terdiman (https://www.codercorner.com/MeshContacts.pdf)
|
|
///
|
|
/// Note that this class requires that CollideSettingsBase::mActiveEdgeMode == EActiveEdgeMode::CollideWithAll
|
|
/// and CollideSettingsBase::mCollectFacesMode == ECollectFacesMode::CollectFaces.
|
|
/// </code>
|
|
/// </remarks>
|
|
[InteropHandle]
|
|
public readonly partial struct InternalEdgeRemovingCollector
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// This algorithm tests a convex shape (shape 1) against a set of polygons (shape 2). This assumption
|
|
/// doesn't hold if the shape we're testing is a compound shape, so we must also store the sub shape ID and
|
|
/// ignore voided features that belong to another sub shape ID.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L267">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:267</see>
|
|
/// <br/>
|
|
/// <c>struct Voided</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
|
public partial struct Voided
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Feature that is voided (of shape 2). Read with Vec3::sLoadFloat3Unsafe so must not be the last
|
|
/// member.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L269">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:269</see>
|
|
/// <br/>
|
|
/// <c>Float3 mFeature</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(0)]
|
|
public float3 Feature;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Sub shape ID of the shape that is colliding against the feature (of shape 1).
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L270">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:270</see>
|
|
/// <br/>
|
|
/// <c>SubShapeID mSubShapeID</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(12)]
|
|
public uint SubShapeID;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// See: CollideShapeCollector::Reset
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L98">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:98</see>
|
|
/// <br/>
|
|
/// <c>virtual void Reset() override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Reset() => Jolt.PInvoke.InternalEdgeRemovingCollector_Reset(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// See: CollideShapeCollector::OnBody
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L109">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:109</see>
|
|
/// <br/>
|
|
/// <c>virtual void OnBody(const Body &inBody) override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void OnBody(Body body) => Jolt.PInvoke.InternalEdgeRemovingCollector_OnBody(this, body);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// See: CollideShapeCollector::AddHit
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L116">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:116</see>
|
|
/// <br/>
|
|
/// <c>virtual void AddHit(const CollideShapeResult &inResult) override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddHit(in CollideShapeResult result) =>
|
|
Jolt.PInvoke.InternalEdgeRemovingCollector_AddHit(this, in result);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// After all hits have been added, call this function to process the delayed results
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L140">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:140</see>
|
|
/// <br/>
|
|
/// <c>void Flush()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Flush() => Jolt.PInvoke.InternalEdgeRemovingCollector_Flush(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// See: CollideShapeCollector::OnBodyEnd
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L238">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:238</see>
|
|
/// <br/>
|
|
/// <c>virtual void OnBodyEnd() override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void OnBodyEnd() => Jolt.PInvoke.InternalEdgeRemovingCollector_OnBodyEnd(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Version of CollisionDispatch::sCollideShapeVsShape that removes internal edges
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L245">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:245</see>
|
|
/// <br/>
|
|
/// <c>static void sCollideShapeVsShape(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter = { }</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into collideshapevsshaperesults, which you allocate and size. Returns how many were
|
|
/// written; totalHits is how many the query found, so a larger span is needed when it exceeds the span's
|
|
/// length.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe uint CollideShapeVsShape(
|
|
Shape shape1,
|
|
Shape shape2,
|
|
float3 scale1,
|
|
float3 scale2,
|
|
in float4x4 centerOfMassTransform1,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
CollideShapeSettings collideShapeSettings,
|
|
Span<CollideShapeResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter = default
|
|
)
|
|
{
|
|
fixed (CollideShapeResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.InternalEdgeRemovingCollector_CollideShapeVsShape(
|
|
shape1,
|
|
shape2,
|
|
scale1,
|
|
scale2,
|
|
in centerOfMassTransform1,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
collideShapeSettings,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
shapeFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Version of CollisionDispatch::sCollideShapeVsShape that removes internal edges
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h#L245">Jolt/Physics/Collision/InternalEdgeRemovingCollector.h:245</see>
|
|
/// <br/>
|
|
/// <c>static void sCollideShapeVsShape(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter = { }</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Keeps only the closest (or deepest) hit. Returns false, and writes a native default-constructed result
|
|
/// (e.g. RayCastResult's fraction is 1 + epsilon), when nothing was hit.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static bool CollideShapeVsShapeClosest(
|
|
Shape shape1,
|
|
Shape shape2,
|
|
float3 scale1,
|
|
float3 scale2,
|
|
in float4x4 centerOfMassTransform1,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
CollideShapeSettings collideShapeSettings,
|
|
out CollideShapeResult result,
|
|
ShapeFilter shapeFilter = default
|
|
) =>
|
|
Jolt.PInvoke.InternalEdgeRemovingCollector_CollideShapeVsShapeClosest(
|
|
shape1,
|
|
shape2,
|
|
scale1,
|
|
scale2,
|
|
in centerOfMassTransform1,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
collideShapeSettings,
|
|
out result,
|
|
shapeFilter
|
|
) != 0;
|
|
}
|
|
}
|