brutal/Brutal.Jolt/Generated/Classes/BroadPhaseQuery.gen.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

340 lines
15 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>
/// Interface to the broadphase that can perform collision queries. These queries will only test the bounding
/// box of the body to quickly determine a potential set of colliding bodies. The shapes of the bodies are not
/// tested, if you want this then you should use the NarrowPhaseQuery interface.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L28">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:28</see>
/// <br/>
/// <c>class BroadPhaseQuery : public NonCopyable</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BroadPhaseQuery
{
/// <summary>
/// <para>
/// Cast a ray and add any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L35">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:35</see>
/// <br/>
/// <c>virtual void CastRay(const RayCast &amp;inRay, RayCastBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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>
/// </remarks>
public unsafe uint CastRay(
in RayCast ray,
Span<BroadPhaseCastResult> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (BroadPhaseCastResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CastRay(
this,
in ray,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Cast a ray and add any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L35">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:35</see>
/// <br/>
/// <c>virtual void CastRay(const RayCast &amp;inRay, RayCastBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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 bool CastRayClosest(
in RayCast ray,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
Jolt.PInvoke.BroadPhaseQuery_CastRayClosest(
this,
in ray,
out result,
broadPhaseLayerFilter,
objectLayerFilter
) != 0;
/// <summary>
/// <para>
/// Get bodies intersecting with inBox and any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L38">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:38</see>
/// <br/>
/// <c>virtual void CollideAABox(const AABox &amp;inBox, CollideShapeBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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>
/// </remarks>
public unsafe uint CollideAABox(
in AABox box,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollideAABox(
this,
in box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Get bodies intersecting with a sphere and any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L41">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:41</see>
/// <br/>
/// <c>virtual void CollideSphere(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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>
/// </remarks>
public unsafe uint CollideSphere(
float3 center,
float radius,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollideSphere(
this,
center,
radius,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Get bodies intersecting with a point and any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L44">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:44</see>
/// <br/>
/// <c>virtual void CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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>
/// </remarks>
public unsafe uint CollidePoint(
float3 point,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollidePoint(
this,
point,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Get bodies intersecting with an oriented box and any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L47">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:47</see>
/// <br/>
/// <c>virtual void CollideOrientedBox(const OrientedBox &amp;inBox, CollideShapeBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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>
/// </remarks>
public unsafe uint CollideOrientedBox(
OrientedBox box,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollideOrientedBox(
this,
box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Cast a box and add any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L50">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:50</see>
/// <br/>
/// <c>virtual void CastAABox(const AABoxCast &amp;inBox, CastShapeBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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>
/// </remarks>
public unsafe uint CastAABox(
in AABoxCast box,
Span<BroadPhaseCastResult> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (BroadPhaseCastResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CastAABox(
this,
in box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Cast a box and add any hits to ioCollector
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L50">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:50</see>
/// <br/>
/// <c>virtual void CastAABox(const AABoxCast &amp;inBox, CastShapeBodyCollector &amp;ioCollector, const BroadPhaseLayerFilter &amp;inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &amp;inObjectLayerFilter = { }) const = 0</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 bool CastAABoxClosest(
in AABoxCast box,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
Jolt.PInvoke.BroadPhaseQuery_CastAABoxClosest(
this,
in box,
out result,
broadPhaseLayerFilter,
objectLayerFilter
) != 0;
/// <summary>
/// <para>
/// Get the bounding box of all objects in the broadphase
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h#L53">Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:53</see>
/// <br/>
/// <c>virtual AABox GetBounds() const = 0</c>
/// </para>
/// </summary>
public AABox GetBounds() => Jolt.PInvoke.BroadPhaseQuery_GetBounds(this);
}
}