mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
455 lines
20 KiB
C#
455 lines
20 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>
|
|
/// Fast SIMD based quad tree BroadPhase that is multithreading aware and tries to do a minimal amount of
|
|
/// locking.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L14">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:14</see>
|
|
/// <br/>
|
|
/// <c>class BroadPhaseQuadTree final : public BroadPhase</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct BroadPhaseQuadTree : IDisposable
|
|
{
|
|
public static BroadPhaseQuadTree Create() => Jolt.PInvoke.BroadPhaseQuadTree_Create();
|
|
|
|
/// <inheritdoc cref="BroadPhase.Init(BodyManager, BroadPhaseLayerInterface)"/>
|
|
public void Init(BodyManager bodyManager, BroadPhaseLayerInterface layerInterface) =>
|
|
((BroadPhase)this).Init(bodyManager, layerInterface);
|
|
|
|
/// <inheritdoc cref="BroadPhase.Optimize()"/>
|
|
public void Optimize() => ((BroadPhase)this).Optimize();
|
|
|
|
/// <inheritdoc cref="BroadPhase.FrameSync()"/>
|
|
public void FrameSync() => ((BroadPhase)this).FrameSync();
|
|
|
|
/// <inheritdoc cref="BroadPhase.LockModifications()"/>
|
|
public void LockModifications() => ((BroadPhase)this).LockModifications();
|
|
|
|
/// <inheritdoc cref="BroadPhase.UnlockModifications()"/>
|
|
public void UnlockModifications() => ((BroadPhase)this).UnlockModifications();
|
|
|
|
/// <inheritdoc cref="BroadPhase.RemoveBodies(Span{uint})"/>
|
|
public unsafe void RemoveBodies(Span<uint> bodies) => ((BroadPhase)this).RemoveBodies(bodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L34">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:34</see>
|
|
/// <br/>
|
|
/// <c>virtual void NotifyBodiesAABBChanged(BodyID *ioBodies, int inNumber, bool inTakeLock) override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// bodies is the buffer the native call works on, and its element count travels with it: the call may write
|
|
/// through the span, and only for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void NotifyBodiesAABBChanged(Span<uint> bodies, bool takeLock)
|
|
{
|
|
fixed (uint* bodies_fixed = bodies)
|
|
{
|
|
Jolt.PInvoke.BroadPhaseQuadTree_NotifyBodiesAABBChanged(
|
|
this,
|
|
bodies_fixed,
|
|
(int)bodies.Length,
|
|
takeLock
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="BroadPhase.NotifyBodiesLayerChanged(Span{uint})"/>
|
|
public unsafe void NotifyBodiesLayerChanged(Span<uint> bodies) =>
|
|
((BroadPhase)this).NotifyBodiesLayerChanged(bodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L36">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:36</see>
|
|
/// <br/>
|
|
/// <c>virtual void CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into castrayresults, 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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe uint CastRay(
|
|
in RayCast ray,
|
|
Span<BroadPhaseCastResult> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
)
|
|
{
|
|
fixed (BroadPhaseCastResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.BroadPhaseQuadTree_CastRay(
|
|
this,
|
|
in ray,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L36">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:36</see>
|
|
/// <br/>
|
|
/// <c>virtual void CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public bool CastRayClosest(
|
|
in RayCast ray,
|
|
out BroadPhaseCastResult result,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
) =>
|
|
Jolt.PInvoke.BroadPhaseQuadTree_CastRayClosest(
|
|
this,
|
|
in ray,
|
|
out result,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
) != 0;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L37">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:37</see>
|
|
/// <br/>
|
|
/// <c>virtual void CollideAABox(const AABox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into collideaaboxresults, 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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe uint CollideAABox(
|
|
in AABox box,
|
|
Span<uint> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
)
|
|
{
|
|
fixed (uint* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.BroadPhaseQuadTree_CollideAABox(
|
|
this,
|
|
in box,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L38">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:38</see>
|
|
/// <br/>
|
|
/// <c>virtual void CollideSphere(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into collidesphereresults, 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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe uint CollideSphere(
|
|
float3 center,
|
|
float radius,
|
|
Span<uint> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
)
|
|
{
|
|
fixed (uint* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.BroadPhaseQuadTree_CollideSphere(
|
|
this,
|
|
center,
|
|
radius,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L39">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:39</see>
|
|
/// <br/>
|
|
/// <c>virtual void CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into collidepointresults, 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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe uint CollidePoint(
|
|
float3 point,
|
|
Span<uint> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
)
|
|
{
|
|
fixed (uint* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.BroadPhaseQuadTree_CollidePoint(
|
|
this,
|
|
point,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L40">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:40</see>
|
|
/// <br/>
|
|
/// <c>virtual void CollideOrientedBox(const OrientedBox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into collideorientedboxresults, 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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe uint CollideOrientedBox(
|
|
OrientedBox box,
|
|
Span<uint> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
)
|
|
{
|
|
fixed (uint* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.BroadPhaseQuadTree_CollideOrientedBox(
|
|
this,
|
|
box,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="BroadPhase.CastAABoxNoLock(in AABoxCast, Span{BroadPhaseCastResult}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
|
|
public unsafe uint CastAABoxNoLock(
|
|
in AABoxCast box,
|
|
Span<BroadPhaseCastResult> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
) =>
|
|
((BroadPhase)this).CastAABoxNoLock(
|
|
in box,
|
|
results,
|
|
out totalHits,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
|
|
/// <inheritdoc cref="BroadPhase.CastAABoxNoLockClosest(in AABoxCast, out BroadPhaseCastResult, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
|
|
public bool CastAABoxNoLockClosest(
|
|
in AABoxCast box,
|
|
out BroadPhaseCastResult result,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
) => ((BroadPhase)this).CastAABoxNoLockClosest(in box, out result, broadPhaseLayerFilter, objectLayerFilter);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L42">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:42</see>
|
|
/// <br/>
|
|
/// <c>virtual void CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into castaaboxresults, 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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe uint CastAABox(
|
|
in AABoxCast box,
|
|
Span<BroadPhaseCastResult> results,
|
|
out uint totalHits,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
)
|
|
{
|
|
fixed (BroadPhaseCastResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.BroadPhaseQuadTree_CastAABox(
|
|
this,
|
|
in box,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h#L42">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h:42</see>
|
|
/// <br/>
|
|
/// <c>virtual void CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override</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>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public bool CastAABoxClosest(
|
|
in AABoxCast box,
|
|
out BroadPhaseCastResult result,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
) =>
|
|
Jolt.PInvoke.BroadPhaseQuadTree_CastAABoxClosest(
|
|
this,
|
|
in box,
|
|
out result,
|
|
broadPhaseLayerFilter,
|
|
objectLayerFilter
|
|
) != 0;
|
|
|
|
/// <inheritdoc cref="BroadPhase.FindCollidingPairs(Span{uint}, float, ObjectVsBroadPhaseLayerFilter, ObjectLayerPairFilter, Span{BodyPair}, out uint)"/>
|
|
public unsafe uint FindCollidingPairs(
|
|
Span<uint> activeBodies,
|
|
float speculativeContactDistance,
|
|
ObjectVsBroadPhaseLayerFilter objectVsBroadPhaseLayerFilter,
|
|
ObjectLayerPairFilter objectLayerPairFilter,
|
|
Span<BodyPair> results,
|
|
out uint totalHits
|
|
) =>
|
|
((BroadPhase)this).FindCollidingPairs(
|
|
activeBodies,
|
|
speculativeContactDistance,
|
|
objectVsBroadPhaseLayerFilter,
|
|
objectLayerPairFilter,
|
|
results,
|
|
out totalHits
|
|
);
|
|
|
|
/// <inheritdoc cref="BroadPhaseQuery.GetBounds()"/>
|
|
public AABox GetBounds() => ((BroadPhaseQuery)this).GetBounds();
|
|
|
|
public static implicit operator BroadPhase(BroadPhaseQuadTree value) =>
|
|
Unsafe.BitCast<BroadPhaseQuadTree, BroadPhase>(value);
|
|
|
|
public static implicit operator BroadPhaseQuery(BroadPhaseQuadTree value) =>
|
|
Unsafe.BitCast<BroadPhaseQuadTree, BroadPhaseQuery>(value);
|
|
|
|
public void Dispose() => Jolt.PInvoke.BroadPhaseQuadTree_Destroy(this);
|
|
}
|
|
}
|