This commit is contained in:
Rian Drake 2026-10-15 14:09:11 +13:00
commit b578433e37
284 changed files with 784842 additions and 0 deletions

View file

@ -0,0 +1,65 @@
// <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>
/// Helper class to build an AABB tree
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/AABBTree/AABBTreeBuilder.h#L35">Jolt/AABBTree/AABBTreeBuilder.h:35</see>
/// <br/>
/// <c>class AABBTreeBuilder</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct AABBTreeBuilder : IDisposable
{
/// <summary>
/// <para>
/// Constructor
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/AABBTree/AABBTreeBuilder.h#L101">Jolt/AABBTree/AABBTreeBuilder.h:101</see>
/// <br/>
/// <c>explicit AABBTreeBuilder(TriangleSplitter &amp;inSplitter, uint inMaxTrianglesPerLeaf = 16)</c>
/// </para>
/// </summary>
public static AABBTreeBuilder Create(TriangleSplitter splitter, uint maxTrianglesPerLeaf = 16) =>
Jolt.PInvoke.AABBTreeBuilder_Create(splitter, maxTrianglesPerLeaf);
/// <summary>
/// <para>
/// Get all triangles
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/AABBTree/AABBTreeBuilder.h#L110">Jolt/AABBTree/AABBTreeBuilder.h:110</see>
/// <br/>
/// <c>const Array&lt;IndexedTriangle&gt; &amp;GetTriangles() const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The span is a view of the container's own storage, not a copy, so it costs nothing to take. It's only
/// valid until that container is resized or its owner is destroyed.
/// </para>
/// </remarks>
[return: Brutal.Attributes.Fixed]
public unsafe ReadOnlySpan<IndexedTriangle> GetTriangles()
{
Jolt.PInvoke.AABBTreeBuilder_GetTriangles(this, out var _outResult);
return new ReadOnlySpan<IndexedTriangle>((void*)_outResult.Data, checked((int)_outResult.Count));
}
public void Dispose() => Jolt.PInvoke.AABBTreeBuilder_Destroy(this);
}
}

View file

@ -0,0 +1,359 @@
// <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>
/// Constraint that constrains rotation along 1 axis
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L36">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:36</see>
/// <br/>
/// <c>class AngleConstraintPart</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Constraint that constrains rotation along 1 axis
///
/// Based on: "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, see section 2.4.5
///
/// Constraint equation (eq 108):
///
/// \f[C = \theta(t) - \theta_{min}\f]
///
/// Jacobian (eq 109):
///
/// \f[J = \begin{bmatrix}0 &amp; -a^T &amp; 0 &amp; a^T\end{bmatrix}\f]
///
/// Used terms (here and below, everything in world space):\n
/// a = axis around which rotation is constrained (normalized).\n
/// x1, x2 = center of mass for the bodies.\n
/// v = [v1, w1, v2, w2].\n
/// v1, v2 = linear velocity of body 1 and 2.\n
/// w1, w2 = angular velocity of body 1 and 2.\n
/// M = mass matrix, a diagonal matrix of the mass and inertia with diagonal [m1, I1, m2, I2].\n
/// \f$K^{-1} = \left( J M^{-1} J^T \right)^{-1}\f$ = effective mass.\n
/// b = velocity bias.\n
/// \f$\beta\f$ = baumgarte constant.
/// </code>
/// </remarks>
[InteropHandle]
public readonly partial struct AngleConstraintPart : IDisposable
{
public static AngleConstraintPart Create() => Jolt.PInvoke.AngleConstraintPart_Create();
/// <summary>
/// <para>
/// Calculate properties used during the functions below. Creates a constraint without spring.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L81">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:81</see>
/// <br/>
/// <c>inline void CalculateConstraintProperties(const Body &amp;inBody1, const Body &amp;inBody2, Vec3Arg inWorldSpaceAxis, float inBias = 0.0f)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Calculate properties used during the functions below. Creates a constraint without spring.
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis The axis of rotation along which the constraint acts (normalized)
/// Set the following terms to zero if you don't want to drive the constraint to zero with a spring:
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// </code>
/// </remarks>
public void CalculateConstraintProperties(Body body1, Body body2, float3 worldSpaceAxis, float bias = 0f) =>
Jolt.PInvoke.AngleConstraintPart_CalculateConstraintProperties(this, body1, body2, worldSpaceAxis, bias);
/// <summary>
/// <para>
/// Calculate properties used during the functions below. Set inFrequency to zero if you don't want to drive
/// using a spring.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L103">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:103</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithFrequencyAndDamping(float inDeltaTime, const Body &amp;inBody1, const Body &amp;inBody2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, float inFrequency, float inDamping)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Calculate properties used during the functions below. Set inFrequency to zero if you don't want to drive using a spring.
/// @param inDeltaTime Time step
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis The axis of rotation along which the constraint acts (normalized)
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// @param inC Value of the constraint equation (C)
/// @param inFrequency Oscillation frequency (Hz)
/// @param inDamping Damping factor (0 = no damping, 1 = critical damping)
/// </code>
/// </remarks>
public void CalculateConstraintPropertiesWithFrequencyAndDamping(
float deltaTime,
Body body1,
Body body2,
float3 worldSpaceAxis,
float bias,
float c,
float frequency,
float damping
) =>
Jolt.PInvoke.AngleConstraintPart_CalculateConstraintPropertiesWithFrequencyAndDamping(
this,
deltaTime,
body1,
body2,
worldSpaceAxis,
bias,
c,
frequency,
damping
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below. Set inStiffness and inDamping to zero if you don't
/// want to drive using a spring.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L127">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:127</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithStiffnessAndDamping(float inDeltaTime, const Body &amp;inBody1, const Body &amp;inBody2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, float inStiffness, float inDamping)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Calculate properties used during the functions below. Set inStiffness and inDamping to zero if you don't want to drive using a spring.
/// @param inDeltaTime Time step
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis The axis of rotation along which the constraint acts (normalized)
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// @param inC Value of the constraint equation (C)
/// @param inStiffness Spring stiffness k.
/// @param inDamping Spring damping coefficient c.
/// </code>
/// </remarks>
public void CalculateConstraintPropertiesWithStiffnessAndDamping(
float deltaTime,
Body body1,
Body body2,
float3 worldSpaceAxis,
float bias,
float c,
float stiffness,
float damping
) =>
Jolt.PInvoke.AngleConstraintPart_CalculateConstraintPropertiesWithStiffnessAndDamping(
this,
deltaTime,
body1,
body2,
worldSpaceAxis,
bias,
c,
stiffness,
damping
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below based on inSpringSettings. Turns to a hard limit
/// when inSpringSettings has stiffness / frequency = 0
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L144">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:144</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithSettingsForLimit(float inDeltaTime, const Body &amp;inBody1, const Body &amp;inBody2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, const SpringSettings &amp;inSpringSettings)</c>
/// </para>
/// </summary>
public void CalculateConstraintPropertiesWithSettingsForLimit(
float deltaTime,
Body body1,
Body body2,
float3 worldSpaceAxis,
float bias,
float c,
SpringSettings springSettings
) =>
Jolt.PInvoke.AngleConstraintPart_CalculateConstraintPropertiesWithSettingsForLimit(
this,
deltaTime,
body1,
body2,
worldSpaceAxis,
bias,
c,
springSettings
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below based on inSpringSettings. Assumes the spring has
/// either stiffness or damping.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L161">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:161</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithSettingsForMotor(float inDeltaTime, const Body &amp;inBody1, const Body &amp;inBody2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, const SpringSettings &amp;inSpringSettings)</c>
/// </para>
/// </summary>
public void CalculateConstraintPropertiesWithSettingsForMotor(
float deltaTime,
Body body1,
Body body2,
float3 worldSpaceAxis,
float bias,
float c,
SpringSettings springSettings
) =>
Jolt.PInvoke.AngleConstraintPart_CalculateConstraintPropertiesWithSettingsForMotor(
this,
deltaTime,
body1,
body2,
worldSpaceAxis,
bias,
c,
springSettings
);
/// <summary>
/// <para>
/// Deactivate this constraint
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L174">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:174</see>
/// <br/>
/// <c>inline void Deactivate()</c>
/// </para>
/// </summary>
public void Deactivate() => Jolt.PInvoke.AngleConstraintPart_Deactivate(this);
/// <summary>
/// <para>
/// Check if constraint is active
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L181">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:181</see>
/// <br/>
/// <c>inline bool IsActive() const</c>
/// </para>
/// </summary>
public bool IsActive() => Jolt.PInvoke.AngleConstraintPart_IsActive(this);
/// <summary>
/// <para>
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L190">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:190</see>
/// <br/>
/// <c>inline void WarmStart(Body &amp;ioBody1, Body &amp;ioBody2, float inWarmStartImpulseRatio)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inWarmStartImpulseRatio Ratio of new step to old time step (dt_new / dt_old) for scaling the lagrange multiplier of the previous frame
/// </code>
/// </remarks>
public void WarmStart(Body body1, Body body2, float warmStartImpulseRatio) =>
Jolt.PInvoke.AngleConstraintPart_WarmStart(this, body1, body2, warmStartImpulseRatio);
/// <summary>
/// <para>
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint
/// equation.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L202">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:202</see>
/// <br/>
/// <c>inline bool SolveVelocityConstraint(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis The axis of rotation along which the constraint acts (normalized)
/// @param inMinLambda Minimum angular impulse to apply (N m s)
/// @param inMaxLambda Maximum angular impulse to apply (N m s)
/// </code>
/// </remarks>
public bool SolveVelocityConstraint(
Body body1,
Body body2,
float3 worldSpaceAxis,
float minLambda,
float maxLambda
) =>
Jolt.PInvoke.AngleConstraintPart_SolveVelocityConstraint(
this,
body1,
body2,
worldSpaceAxis,
minLambda,
maxLambda
);
/// <summary>
/// <para>
/// Return lagrange multiplier
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L216">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:216</see>
/// <br/>
/// <c>float GetTotalLambda() const</c>
/// </para>
/// </summary>
public float GetTotalLambda() => Jolt.PInvoke.AngleConstraintPart_GetTotalLambda(this);
/// <summary>
/// <para>
/// Iteratively update the position constraint. Makes sure C(...) == 0.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h#L226">Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h:226</see>
/// <br/>
/// <c>inline bool SolvePositionConstraint(Body &amp;ioBody1, Body &amp;ioBody2, float inC, float inBaumgarte) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Iteratively update the position constraint. Makes sure C(...) == 0.
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inC Value of the constraint equation (C)
/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
/// </code>
/// </remarks>
public bool SolvePositionConstraint(Body body1, Body body2, float c, float baumgarte) =>
Jolt.PInvoke.AngleConstraintPart_SolvePositionConstraint(this, body1, body2, c, baumgarte);
public void Dispose() => Jolt.PInvoke.AngleConstraintPart_Destroy(this);
}
}

View file

@ -0,0 +1,402 @@
// <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>
/// Constraint that constrains motion along 1 axis
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L41">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:41</see>
/// <br/>
/// <c>class AxisConstraintPart</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Constraint that constrains motion along 1 axis
///
/// @see "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.1.1
/// (we're not using the approximation of eq 27 but instead add the U term as in eq 55)
///
/// Constraint equation (eq 25):
///
/// \f[C = (p_2 - p_1) \cdot n\f]
///
/// Jacobian (eq 28):
///
/// \f[J = \begin{bmatrix} -n^T &amp; (-(r_1 + u) \times n)^T &amp; n^T &amp; (r_2 \times n)^T \end{bmatrix}\f]
///
/// Used terms (here and below, everything in world space):\n
/// n = constraint axis (normalized).\n
/// p1, p2 = constraint points.\n
/// r1 = p1 - x1.\n
/// r2 = p2 - x2.\n
/// u = x2 + r2 - x1 - r1 = p2 - p1.\n
/// x1, x2 = center of mass for the bodies.\n
/// v = [v1, w1, v2, w2].\n
/// v1, v2 = linear velocity of body 1 and 2.\n
/// w1, w2 = angular velocity of body 1 and 2.\n
/// M = mass matrix, a diagonal matrix of the mass and inertia with diagonal [m1, I1, m2, I2].\n
/// \f$K^{-1} = \left( J M^{-1} J^T \right)^{-1}\f$ = effective mass.\n
/// b = velocity bias.\n
/// \f$\beta\f$ = baumgarte constant.
/// </code>
/// </remarks>
[InteropHandle]
public readonly partial struct AxisConstraintPart : IDisposable
{
public static AxisConstraintPart Create() => Jolt.PInvoke.AxisConstraintPart_Create();
/// <summary>
/// <para>
/// Calculate properties used during the functions below. Creates a constraint without spring.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L145">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:145</see>
/// <br/>
/// <c>inline void CalculateConstraintProperties(const Body &amp;inBody1, Vec3Arg inR1PlusU, const Body &amp;inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias = 0.0f)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Calculate properties used during the functions below. Creates a constraint without spring.
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inR1PlusU See equations above (r1 + u)
/// @param inR2 See equations above (r2)
/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized, pointing from body 1 to 2)
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// </code>
/// </remarks>
public void CalculateConstraintProperties(
Body body1,
float3 r1PlusU,
Body body2,
float3 r2,
float3 worldSpaceAxis,
float bias = 0f
) =>
Jolt.PInvoke.AxisConstraintPart_CalculateConstraintProperties(
this,
body1,
r1PlusU,
body2,
r2,
worldSpaceAxis,
bias
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below. Set inFrequency to zero if you don't want to drive
/// using a spring.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L169">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:169</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithFrequencyAndDamping(float inDeltaTime, const Body &amp;inBody1, Vec3Arg inR1PlusU, const Body &amp;inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, float inFrequency, float inDamping)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Calculate properties used during the functions below. Set inFrequency to zero if you don't want to drive using a spring.
/// @param inDeltaTime Time step
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inR1PlusU See equations above (r1 + u)
/// @param inR2 See equations above (r2)
/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized, pointing from body 1 to 2)
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// @param inC Value of the constraint equation (C).
/// @param inFrequency Oscillation frequency (Hz).
/// @param inDamping Damping factor (0 = no damping, 1 = critical damping).
/// </code>
/// </remarks>
public void CalculateConstraintPropertiesWithFrequencyAndDamping(
float deltaTime,
Body body1,
float3 r1PlusU,
Body body2,
float3 r2,
float3 worldSpaceAxis,
float bias,
float c,
float frequency,
float damping
) =>
Jolt.PInvoke.AxisConstraintPart_CalculateConstraintPropertiesWithFrequencyAndDamping(
this,
deltaTime,
body1,
r1PlusU,
body2,
r2,
worldSpaceAxis,
bias,
c,
frequency,
damping
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below. Set inFrequency and inDamping to zero if you don't
/// want to drive using a spring.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L195">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:195</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithStiffnessAndDamping(float inDeltaTime, const Body &amp;inBody1, Vec3Arg inR1PlusU, const Body &amp;inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, float inStiffness, float inDamping)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Calculate properties used during the functions below. Set inFrequency and inDamping to zero if you don't want to drive using a spring.
/// @param inDeltaTime Time step
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inR1PlusU See equations above (r1 + u)
/// @param inR2 See equations above (r2)
/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized, pointing from body 1 to 2)
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// @param inC Value of the constraint equation (C).
/// @param inStiffness Spring stiffness k.
/// @param inDamping Spring damping coefficient c.
/// </code>
/// </remarks>
public void CalculateConstraintPropertiesWithStiffnessAndDamping(
float deltaTime,
Body body1,
float3 r1PlusU,
Body body2,
float3 r2,
float3 worldSpaceAxis,
float bias,
float c,
float stiffness,
float damping
) =>
Jolt.PInvoke.AxisConstraintPart_CalculateConstraintPropertiesWithStiffnessAndDamping(
this,
deltaTime,
body1,
r1PlusU,
body2,
r2,
worldSpaceAxis,
bias,
c,
stiffness,
damping
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below based on inSpringSettings. Turns to a hard limit
/// when inSpringSettings has stiffness / frequency = 0
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L212">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:212</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithSettingsForLimit(float inDeltaTime, const Body &amp;inBody1, Vec3Arg inR1PlusU, const Body &amp;inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, const SpringSettings &amp;inSpringSettings)</c>
/// </para>
/// </summary>
public void CalculateConstraintPropertiesWithSettingsForLimit(
float deltaTime,
Body body1,
float3 r1PlusU,
Body body2,
float3 r2,
float3 worldSpaceAxis,
float bias,
float c,
SpringSettings springSettings
) =>
Jolt.PInvoke.AxisConstraintPart_CalculateConstraintPropertiesWithSettingsForLimit(
this,
deltaTime,
body1,
r1PlusU,
body2,
r2,
worldSpaceAxis,
bias,
c,
springSettings
);
/// <summary>
/// <para>
/// Calculate properties used during the functions below based on inSpringSettings. Assumes the spring has
/// either stiffness or damping.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L229">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:229</see>
/// <br/>
/// <c>inline void CalculateConstraintPropertiesWithSettingsForMotor(float inDeltaTime, const Body &amp;inBody1, Vec3Arg inR1PlusU, const Body &amp;inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, const SpringSettings &amp;inSpringSettings)</c>
/// </para>
/// </summary>
public void CalculateConstraintPropertiesWithSettingsForMotor(
float deltaTime,
Body body1,
float3 r1PlusU,
Body body2,
float3 r2,
float3 worldSpaceAxis,
float bias,
float c,
SpringSettings springSettings
) =>
Jolt.PInvoke.AxisConstraintPart_CalculateConstraintPropertiesWithSettingsForMotor(
this,
deltaTime,
body1,
r1PlusU,
body2,
r2,
worldSpaceAxis,
bias,
c,
springSettings
);
/// <summary>
/// <para>
/// Deactivate this constraint
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L242">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:242</see>
/// <br/>
/// <c>inline void Deactivate()</c>
/// </para>
/// </summary>
public void Deactivate() => Jolt.PInvoke.AxisConstraintPart_Deactivate(this);
/// <summary>
/// <para>
/// Check if constraint is active
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L249">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:249</see>
/// <br/>
/// <c>inline bool IsActive() const</c>
/// </para>
/// </summary>
public bool IsActive() => Jolt.PInvoke.AxisConstraintPart_IsActive(this);
/// <summary>
/// <para>
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L259">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:259</see>
/// <br/>
/// <c>inline void WarmStart(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized)
/// @param inWarmStartImpulseRatio Ratio of new step to old time step (dt_new / dt_old) for scaling the lagrange multiplier of the previous frame
/// </code>
/// </remarks>
public void WarmStart(Body body1, Body body2, float3 worldSpaceAxis, float warmStartImpulseRatio) =>
Jolt.PInvoke.AxisConstraintPart_WarmStart(this, body1, body2, worldSpaceAxis, warmStartImpulseRatio);
/// <summary>
/// <para>
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint
/// equation.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L272">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:272</see>
/// <br/>
/// <c>inline bool SolveVelocityConstraint(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized)
/// @param inMinLambda Minimum value of constraint impulse to apply (N s)
/// @param inMaxLambda Maximum value of constraint impulse to apply (N s)
/// </code>
/// </remarks>
public bool SolveVelocityConstraint(
Body body1,
Body body2,
float3 worldSpaceAxis,
float minLambda,
float maxLambda
) =>
Jolt.PInvoke.AxisConstraintPart_SolveVelocityConstraint(
this,
body1,
body2,
worldSpaceAxis,
minLambda,
maxLambda
);
/// <summary>
/// <para>
/// Return lagrange multiplier
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L310">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:310</see>
/// <br/>
/// <c>float GetTotalLambda() const</c>
/// </para>
/// </summary>
public float GetTotalLambda() => Jolt.PInvoke.AxisConstraintPart_GetTotalLambda(this);
/// <summary>
/// <para>
/// Iteratively update the position constraint. Makes sure C(...) = 0.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h#L321">Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h:321</see>
/// <br/>
/// <c>inline bool SolvePositionConstraint(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Iteratively update the position constraint. Makes sure C(...) = 0.
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inWorldSpaceAxis Axis along which the constraint acts (normalized)
/// @param inC Value of the constraint equation (C)
/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
/// </code>
/// </remarks>
public bool SolvePositionConstraint(Body body1, Body body2, float3 worldSpaceAxis, float c, float baumgarte) =>
Jolt.PInvoke.AxisConstraintPart_SolvePositionConstraint(this, body1, body2, worldSpaceAxis, c, baumgarte);
public void Dispose() => Jolt.PInvoke.AxisConstraintPart_Destroy(this);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
// <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>
/// A listener class that receives events when a body activates or deactivates. It can be registered with the
/// BodyManager (or PhysicsSystem).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyActivationListener.h#L13">Jolt/Physics/Body/BodyActivationListener.h:13</see>
/// <br/>
/// <c>class BodyActivationListener</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyActivationListener
{
/// <summary>
/// <para>
/// Called whenever a body activates, note this can be called from any thread so make sure your code is
/// thread safe. At the time of the callback the body inBodyID will be locked and no bodies can be
/// written/activated/deactivated from the callback.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyActivationListener.h#L21">Jolt/Physics/Body/BodyActivationListener.h:21</see>
/// <br/>
/// <c>virtual void OnBodyActivated(const BodyID &amp;inBodyID, uint64 inBodyUserData) = 0</c>
/// </para>
/// </summary>
public void OnBodyActivated(uint bodyID, ulong bodyUserData) =>
Jolt.PInvoke.BodyActivationListener_OnBodyActivated(this, bodyID, bodyUserData);
/// <summary>
/// <para>
/// Called whenever a body deactivates, note this can be called from any thread so make sure your code is
/// thread safe. At the time of the callback the body inBodyID will be locked and no bodies can be
/// written/activated/deactivated from the callback.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyActivationListener.h#L25">Jolt/Physics/Body/BodyActivationListener.h:25</see>
/// <br/>
/// <c>virtual void OnBodyDeactivated(const BodyID &amp;inBodyID, uint64 inBodyUserData) = 0</c>
/// </para>
/// </summary>
public void OnBodyDeactivated(uint bodyID, ulong bodyUserData) =>
Jolt.PInvoke.BodyActivationListener_OnBodyDeactivated(this, bodyID, bodyUserData);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
// <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>
/// Class function to filter out bodies for debug rendering, returns true if body should be rendered
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyFilter.h#L116">Jolt/Physics/Body/BodyFilter.h:116</see>
/// <br/>
/// <c>class BodyDrawFilter : public NonCopyable</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyDrawFilter : IDisposable
{
public static BodyDrawFilter Create() => Jolt.PInvoke.BodyDrawFilter_Create();
/// <summary>
/// <para>
/// Filter function. Returns true if inBody should be rendered
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyFilter.h#L123">Jolt/Physics/Body/BodyFilter.h:123</see>
/// <br/>
/// <c>virtual bool ShouldDraw(const Body&amp; inBody) const</c>
/// </para>
/// </summary>
public bool ShouldDraw(Body body) => Jolt.PInvoke.BodyDrawFilter_ShouldDraw(this, body);
public void Dispose() => Jolt.PInvoke.BodyDrawFilter_Destroy(this);
}
}

View file

@ -0,0 +1,56 @@
// <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>
/// Class function to filter out bodies, returns true if test should collide with body
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyFilter.h#L15">Jolt/Physics/Body/BodyFilter.h:15</see>
/// <br/>
/// <c>class BodyFilter : public NonCopyable</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyFilter : IDisposable
{
public static BodyFilter Create() => Jolt.PInvoke.BodyFilter_Create();
/// <summary>
/// <para>
/// Filter function. Returns true if we should collide with inBodyID
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyFilter.h#L22">Jolt/Physics/Body/BodyFilter.h:22</see>
/// <br/>
/// <c>virtual bool ShouldCollide(const BodyID &amp;inBodyID) const</c>
/// </para>
/// </summary>
public bool ShouldCollide(uint bodyID) => Jolt.PInvoke.BodyFilter_ShouldCollide(this, bodyID);
/// <summary>
/// <para>
/// Filter function. Returns true if we should collide with inBody (this is called after the body is locked
/// and makes it possible to filter based on body members)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyFilter.h#L28">Jolt/Physics/Body/BodyFilter.h:28</see>
/// <br/>
/// <c>virtual bool ShouldCollideLocked(const Body &amp;inBody) const</c>
/// </para>
/// </summary>
public bool ShouldCollideLocked(Body body) => Jolt.PInvoke.BodyFilter_ShouldCollideLocked(this, body);
public void Dispose() => Jolt.PInvoke.BodyFilter_Destroy(this);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,177 @@
// <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>
/// Base class interface for locking a body. Usually you will use BodyLockRead / BodyLockWrite /
/// BodyLockMultiRead / BodyLockMultiWrite instead.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLockInterface.h#L16">Jolt/Physics/Body/BodyLockInterface.h:16</see>
/// <br/>
/// <c>class BodyLockInterface : public NonCopyable</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyLockInterface
{
/// <summary>
/// <para>
/// Convert body ID to body
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLockInterface.h#L50">Jolt/Physics/Body/BodyLockInterface.h:50</see>
/// <br/>
/// <c>inline Body * TryGetBody(const BodyID &amp;inBodyID) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle is borrowed from its owner; don't Dispose it.
/// </para>
/// </remarks>
public Body TryGetBody(uint bodyID) => Jolt.PInvoke.BodyLockInterface_TryGetBody(this, bodyID);
/// <summary>
/// <para>
/// Reads the world transform of every body in bodyIDs into transforms, taking the body locks once for the
/// whole set rather than once per body - what a render loop reading back many bodies wants. An ID that no
/// longer names a body (removed, or a stale sequence number) reads back as the identity, the same as
/// BodyInterface does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetWorldTransforms(ReadOnlySpan<uint> bodyIDs, Span<float4x4> transforms)
{
fixed (float4x4* transforms_fixed = transforms)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (transforms.Length < bodyIDs.Length)
throw new ArgumentException(
"transforms must hold at least one element per body ID.",
nameof(transforms)
);
Jolt.PInvoke.BodyLockInterface_GetWorldTransforms(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
transforms_fixed,
(nuint)transforms.Length
);
}
}
/// <summary>
/// <para>
/// Reads the position and rotation of every body in bodyIDs into positions and rotations, taking the body
/// locks once for the whole set rather than once per body. An ID that no longer names a body (removed, or a
/// stale sequence number) reads back as the origin and the identity rotation, the same as BodyInterface
/// does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetPositionsAndRotations(
ReadOnlySpan<uint> bodyIDs,
Span<float3> positions,
Span<floatQuat> rotations
)
{
fixed (floatQuat* rotations_fixed = rotations)
fixed (float3* positions_fixed = positions)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (positions.Length < bodyIDs.Length)
throw new ArgumentException(
"positions must hold at least one element per body ID.",
nameof(positions)
);
if (rotations.Length < bodyIDs.Length)
throw new ArgumentException(
"rotations must hold at least one element per body ID.",
nameof(rotations)
);
Jolt.PInvoke.BodyLockInterface_GetPositionsAndRotations(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
positions_fixed,
(nuint)positions.Length,
rotations_fixed,
(nuint)rotations.Length
);
}
}
/// <summary>
/// <para>
/// Reads the linear and angular velocity of every body in bodyIDs, taking the body locks once for the whole
/// set rather than once per body. A static body reads as zero, as it does one at a time. An ID that no
/// longer names a body (removed, or a stale sequence number) reads back as zero, the same as BodyInterface
/// does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetLinearAndAngularVelocities(
ReadOnlySpan<uint> bodyIDs,
Span<float3> linearVelocities,
Span<float3> angularVelocities
)
{
fixed (float3* angularVelocities_fixed = angularVelocities)
fixed (float3* linearVelocities_fixed = linearVelocities)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (linearVelocities.Length < bodyIDs.Length)
throw new ArgumentException(
"linearVelocities must hold at least one element per body ID.",
nameof(linearVelocities)
);
if (angularVelocities.Length < bodyIDs.Length)
throw new ArgumentException(
"angularVelocities must hold at least one element per body ID.",
nameof(angularVelocities)
);
Jolt.PInvoke.BodyLockInterface_GetLinearAndAngularVelocities(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
linearVelocities_fixed,
(nuint)linearVelocities.Length,
angularVelocities_fixed,
(nuint)angularVelocities.Length
);
}
}
/// <summary>
/// <para>
/// Reads the position, rotation, velocities, user data and activation of every body in bodyIDs into states,
/// taking the body locks once for the whole set - one pass where syncing a snapshot would otherwise take a
/// pose read, a velocity read and a per-body activation query. An ID that no longer names a body reads as
/// the origin at rest with BodyStateFlags.Valid clear. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetBodyStates(ReadOnlySpan<uint> bodyIDs, Span<BodyState> states)
{
fixed (BodyState* states_fixed = states)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (states.Length < bodyIDs.Length)
throw new ArgumentException("states must hold at least one element per body ID.", nameof(states));
Jolt.PInvoke.BodyLockInterface_GetBodyStates(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
states_fixed,
(nuint)states.Length
);
}
}
}
}

View file

@ -0,0 +1,164 @@
// <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>
/// Implementation that uses the body manager to lock the correct mutex for a body
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLockInterface.h#L77">Jolt/Physics/Body/BodyLockInterface.h:77</see>
/// <br/>
/// <c>class BodyLockInterfaceLocking final : public BodyLockInterface</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyLockInterfaceLocking
{
/// <summary>
/// <para>
/// Reads the world transform of every body in bodyIDs into transforms, taking the body locks once for the
/// whole set rather than once per body - what a render loop reading back many bodies wants. An ID that no
/// longer names a body (removed, or a stale sequence number) reads back as the identity, the same as
/// BodyInterface does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetWorldTransforms(ReadOnlySpan<uint> bodyIDs, Span<float4x4> transforms)
{
fixed (float4x4* transforms_fixed = transforms)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (transforms.Length < bodyIDs.Length)
throw new ArgumentException(
"transforms must hold at least one element per body ID.",
nameof(transforms)
);
Jolt.PInvoke.BodyLockInterfaceLocking_GetWorldTransforms(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
transforms_fixed,
(nuint)transforms.Length
);
}
}
/// <summary>
/// <para>
/// Reads the position and rotation of every body in bodyIDs into positions and rotations, taking the body
/// locks once for the whole set rather than once per body. An ID that no longer names a body (removed, or a
/// stale sequence number) reads back as the origin and the identity rotation, the same as BodyInterface
/// does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetPositionsAndRotations(
ReadOnlySpan<uint> bodyIDs,
Span<float3> positions,
Span<floatQuat> rotations
)
{
fixed (floatQuat* rotations_fixed = rotations)
fixed (float3* positions_fixed = positions)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (positions.Length < bodyIDs.Length)
throw new ArgumentException(
"positions must hold at least one element per body ID.",
nameof(positions)
);
if (rotations.Length < bodyIDs.Length)
throw new ArgumentException(
"rotations must hold at least one element per body ID.",
nameof(rotations)
);
Jolt.PInvoke.BodyLockInterfaceLocking_GetPositionsAndRotations(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
positions_fixed,
(nuint)positions.Length,
rotations_fixed,
(nuint)rotations.Length
);
}
}
/// <summary>
/// <para>
/// Reads the linear and angular velocity of every body in bodyIDs, taking the body locks once for the whole
/// set rather than once per body. A static body reads as zero, as it does one at a time. An ID that no
/// longer names a body (removed, or a stale sequence number) reads back as zero, the same as BodyInterface
/// does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetLinearAndAngularVelocities(
ReadOnlySpan<uint> bodyIDs,
Span<float3> linearVelocities,
Span<float3> angularVelocities
)
{
fixed (float3* angularVelocities_fixed = angularVelocities)
fixed (float3* linearVelocities_fixed = linearVelocities)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (linearVelocities.Length < bodyIDs.Length)
throw new ArgumentException(
"linearVelocities must hold at least one element per body ID.",
nameof(linearVelocities)
);
if (angularVelocities.Length < bodyIDs.Length)
throw new ArgumentException(
"angularVelocities must hold at least one element per body ID.",
nameof(angularVelocities)
);
Jolt.PInvoke.BodyLockInterfaceLocking_GetLinearAndAngularVelocities(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
linearVelocities_fixed,
(nuint)linearVelocities.Length,
angularVelocities_fixed,
(nuint)angularVelocities.Length
);
}
}
/// <summary>
/// <para>
/// Reads the position, rotation, velocities, user data and activation of every body in bodyIDs into states,
/// taking the body locks once for the whole set - one pass where syncing a snapshot would otherwise take a
/// pose read, a velocity read and a per-body activation query. An ID that no longer names a body reads as
/// the origin at rest with BodyStateFlags.Valid clear. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetBodyStates(ReadOnlySpan<uint> bodyIDs, Span<BodyState> states)
{
fixed (BodyState* states_fixed = states)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (states.Length < bodyIDs.Length)
throw new ArgumentException("states must hold at least one element per body ID.", nameof(states));
Jolt.PInvoke.BodyLockInterfaceLocking_GetBodyStates(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
states_fixed,
(nuint)states.Length
);
}
}
public static implicit operator BodyLockInterface(BodyLockInterfaceLocking value) =>
Unsafe.BitCast<BodyLockInterfaceLocking, BodyLockInterface>(value);
/// <inheritdoc cref="BodyLockInterface.TryGetBody(uint)"/>
public Body TryGetBody(uint bodyID) => ((BodyLockInterface)this).TryGetBody(bodyID);
}
}

View file

@ -0,0 +1,164 @@
// <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>
/// Implementation that performs no locking (assumes the lock has already been taken)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLockInterface.h#L57">Jolt/Physics/Body/BodyLockInterface.h:57</see>
/// <br/>
/// <c>class BodyLockInterfaceNoLock final : public BodyLockInterface</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyLockInterfaceNoLock
{
/// <summary>
/// <para>
/// Reads the world transform of every body in bodyIDs into transforms, taking the body locks once for the
/// whole set rather than once per body - what a render loop reading back many bodies wants. An ID that no
/// longer names a body (removed, or a stale sequence number) reads back as the identity, the same as
/// BodyInterface does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetWorldTransforms(ReadOnlySpan<uint> bodyIDs, Span<float4x4> transforms)
{
fixed (float4x4* transforms_fixed = transforms)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (transforms.Length < bodyIDs.Length)
throw new ArgumentException(
"transforms must hold at least one element per body ID.",
nameof(transforms)
);
Jolt.PInvoke.BodyLockInterfaceNoLock_GetWorldTransforms(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
transforms_fixed,
(nuint)transforms.Length
);
}
}
/// <summary>
/// <para>
/// Reads the position and rotation of every body in bodyIDs into positions and rotations, taking the body
/// locks once for the whole set rather than once per body. An ID that no longer names a body (removed, or a
/// stale sequence number) reads back as the origin and the identity rotation, the same as BodyInterface
/// does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetPositionsAndRotations(
ReadOnlySpan<uint> bodyIDs,
Span<float3> positions,
Span<floatQuat> rotations
)
{
fixed (floatQuat* rotations_fixed = rotations)
fixed (float3* positions_fixed = positions)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (positions.Length < bodyIDs.Length)
throw new ArgumentException(
"positions must hold at least one element per body ID.",
nameof(positions)
);
if (rotations.Length < bodyIDs.Length)
throw new ArgumentException(
"rotations must hold at least one element per body ID.",
nameof(rotations)
);
Jolt.PInvoke.BodyLockInterfaceNoLock_GetPositionsAndRotations(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
positions_fixed,
(nuint)positions.Length,
rotations_fixed,
(nuint)rotations.Length
);
}
}
/// <summary>
/// <para>
/// Reads the linear and angular velocity of every body in bodyIDs, taking the body locks once for the whole
/// set rather than once per body. A static body reads as zero, as it does one at a time. An ID that no
/// longer names a body (removed, or a stale sequence number) reads back as zero, the same as BodyInterface
/// does. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetLinearAndAngularVelocities(
ReadOnlySpan<uint> bodyIDs,
Span<float3> linearVelocities,
Span<float3> angularVelocities
)
{
fixed (float3* angularVelocities_fixed = angularVelocities)
fixed (float3* linearVelocities_fixed = linearVelocities)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (linearVelocities.Length < bodyIDs.Length)
throw new ArgumentException(
"linearVelocities must hold at least one element per body ID.",
nameof(linearVelocities)
);
if (angularVelocities.Length < bodyIDs.Length)
throw new ArgumentException(
"angularVelocities must hold at least one element per body ID.",
nameof(angularVelocities)
);
Jolt.PInvoke.BodyLockInterfaceNoLock_GetLinearAndAngularVelocities(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
linearVelocities_fixed,
(nuint)linearVelocities.Length,
angularVelocities_fixed,
(nuint)angularVelocities.Length
);
}
}
/// <summary>
/// <para>
/// Reads the position, rotation, velocities, user data and activation of every body in bodyIDs into states,
/// taking the body locks once for the whole set - one pass where syncing a snapshot would otherwise take a
/// pose read, a velocity read and a per-body activation query. An ID that no longer names a body reads as
/// the origin at rest with BodyStateFlags.Valid clear. Only as many elements as there are IDs are written.
/// </para>
/// </summary>
public unsafe void GetBodyStates(ReadOnlySpan<uint> bodyIDs, Span<BodyState> states)
{
fixed (BodyState* states_fixed = states)
fixed (uint* bodyIDs_fixed = bodyIDs)
{
if (states.Length < bodyIDs.Length)
throw new ArgumentException("states must hold at least one element per body ID.", nameof(states));
Jolt.PInvoke.BodyLockInterfaceNoLock_GetBodyStates(
this,
bodyIDs_fixed,
(nuint)bodyIDs.Length,
states_fixed,
(nuint)states.Length
);
}
}
public static implicit operator BodyLockInterface(BodyLockInterfaceNoLock value) =>
Unsafe.BitCast<BodyLockInterfaceNoLock, BodyLockInterface>(value);
/// <inheritdoc cref="BodyLockInterface.TryGetBody(uint)"/>
public Body TryGetBody(uint bodyID) => ((BodyLockInterface)this).TryGetBody(bodyID);
}
}

View file

@ -0,0 +1,52 @@
// <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>
/// A multi body lock takes a number of body IDs and locks the underlying bodies so that other threads cannot
/// access its members
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLockMulti.h#L109">Jolt/Physics/Body/BodyLockMulti.h:109</see>
/// <br/>
/// <c>class BodyLockMultiRead : public BodyLockMultiBase&lt;false, const Body&gt;</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// A multi body lock takes a number of body IDs and locks the underlying bodies so that other threads cannot access its members
///
/// The common usage pattern is:
///
/// BodyLockInterface lock_interface = physics_system.GetBodyLockInterface(); // Or non-locking interface if the lock is already taken
/// const BodyID *body_id = ...; // Obtain IDs to bodies
/// int num_body_ids = ...;
///
/// // Scoped lock
/// {
/// BodyLockMultiRead lock(lock_interface, body_ids, num_body_ids);
/// for (int i = 0; i &lt; num_body_ids; ++i)
/// {
/// const Body *body = lock.GetBody(i);
/// if (body != nullptr)
/// {
/// const Body &amp;body = lock.Body();
///
/// // Do something with body
/// ...
/// }
/// }
/// }
/// </code>
/// </remarks>
[InteropHandle]
public readonly partial struct BodyLockMultiRead { }
}

View file

@ -0,0 +1,24 @@
// <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>
/// Specialization that locks multiple bodies for writing to. @see BodyLockMultiRead for usage patterns.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLockMulti.h#L115">Jolt/Physics/Body/BodyLockMulti.h:115</see>
/// <br/>
/// <c>class BodyLockMultiWrite : public BodyLockMultiBase&lt;true, Body&gt;</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyLockMultiWrite { }
}

View file

@ -0,0 +1,90 @@
// <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>
/// A body lock takes a body ID and locks the underlying body so that other threads cannot access its members
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLock.h#L100">Jolt/Physics/Body/BodyLock.h:100</see>
/// <br/>
/// <c>class BodyLockRead : public BodyLockBase&lt;false, const Body&gt;</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// A body lock takes a body ID and locks the underlying body so that other threads cannot access its members
///
/// The common usage pattern is:
///
/// BodyLockInterface lock_interface = physics_system.GetBodyLockInterface(); // Or non-locking interface if the lock is already taken
/// BodyID body_id = ...; // Obtain ID to body
///
/// // Scoped lock
/// {
/// BodyLockRead lock(lock_interface, body_id);
/// if (lock.Succeeded()) // body_id may no longer be valid
/// {
/// const Body &amp;body = lock.GetBody();
///
/// // Do something with body
/// ...
/// }
/// }
/// </code>
/// </remarks>
[InteropHandle]
public readonly partial struct BodyLockRead : IDisposable
{
/// <summary>
/// <para>
/// Takes the read lock on one body, held until Dispose (or ReleaseLock). An ID that no longer names a body
/// still returns a lock, whose Succeeded() is false. Through PhysicsSystem.GetBodyLockInterface() this
/// really locks; through GetBodyLockInterfaceNoLock() it doesn't, for code that already runs where no other
/// thread can touch the body.
/// </para>
/// </summary>
public static BodyLockRead Create(BodyLockInterface lockInterface, uint bodyID) =>
Jolt.PInvoke.BodyLockRead_Create(lockInterface, bodyID);
/// <summary>
/// <para>
/// Whether the ID named a body, so GetBody() has one.
/// </para>
/// </summary>
public bool Succeeded() => Jolt.PInvoke.BodyLockRead_Succeeded(this);
/// <summary>
/// <para>
/// Whether the ID named a body that is also in the broad phase (added to the physics system).
/// </para>
/// </summary>
public bool SucceededAndIsInBroadPhase() => Jolt.PInvoke.BodyLockRead_SucceededAndIsInBroadPhase(this);
/// <summary>
/// <para>
/// The locked body, or a null handle when Succeeded() is false (where Jolt itself would assert). It is
/// borrowed and only safe to use while the lock is held. A read lock means read only: don't call anything
/// that changes the body.
/// </para>
/// </summary>
public Body GetBody() => Jolt.PInvoke.BodyLockRead_GetBody(this);
/// <summary>
/// <para>
/// Releases the lock early; Dispose is still needed to free the lock object. GetBody() is null afterwards.
/// </para>
/// </summary>
public void ReleaseLock() => Jolt.PInvoke.BodyLockRead_ReleaseLock(this);
public void Dispose() => Jolt.PInvoke.BodyLockRead_Destroy(this);
}
}

View file

@ -0,0 +1,67 @@
// <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>
/// Specialization that locks a body for writing to. @see BodyLockRead for usage patterns.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyLock.h#L106">Jolt/Physics/Body/BodyLock.h:106</see>
/// <br/>
/// <c>class BodyLockWrite : public BodyLockBase&lt;true, Body&gt;</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BodyLockWrite : IDisposable
{
/// <summary>
/// <para>
/// Takes the write lock on one body, held until Dispose (or ReleaseLock). An ID that no longer names a body
/// still returns a lock, whose Succeeded() is false. Through PhysicsSystem.GetBodyLockInterface() this
/// really locks; through GetBodyLockInterfaceNoLock() it doesn't, for code that already runs where no other
/// thread can touch the body.
/// </para>
/// </summary>
public static BodyLockWrite Create(BodyLockInterface lockInterface, uint bodyID) =>
Jolt.PInvoke.BodyLockWrite_Create(lockInterface, bodyID);
/// <summary>
/// <para>
/// Whether the ID named a body, so GetBody() has one.
/// </para>
/// </summary>
public bool Succeeded() => Jolt.PInvoke.BodyLockWrite_Succeeded(this);
/// <summary>
/// <para>
/// Whether the ID named a body that is also in the broad phase (added to the physics system).
/// </para>
/// </summary>
public bool SucceededAndIsInBroadPhase() => Jolt.PInvoke.BodyLockWrite_SucceededAndIsInBroadPhase(this);
/// <summary>
/// <para>
/// The locked body, or a null handle when Succeeded() is false (where Jolt itself would assert). It is
/// borrowed and only safe to use while the lock is held.
/// </para>
/// </summary>
public Body GetBody() => Jolt.PInvoke.BodyLockWrite_GetBody(this);
/// <summary>
/// <para>
/// Releases the lock early; Dispose is still needed to free the lock object. GetBody() is null afterwards.
/// </para>
/// </summary>
public void ReleaseLock() => Jolt.PInvoke.BodyLockWrite_ReleaseLock(this);
public void Dispose() => Jolt.PInvoke.BodyLockWrite_Destroy(this);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,383 @@
// <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>
/// A box, centered around the origin
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L33">Jolt/Physics/Collision/Shape/BoxShape.h:33</see>
/// <br/>
/// <c>class BoxShape final : public ConvexShape</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BoxShape : IDisposable
{
/// <summary>
/// <para>
/// Constructor
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L39">Jolt/Physics/Collision/Shape/BoxShape.h:39</see>
/// <br/>
/// <c>BoxShape()</c>
/// </para>
/// </summary>
public static BoxShape Create() => Jolt.PInvoke.BoxShape_Create();
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L40">Jolt/Physics/Collision/Shape/BoxShape.h:40</see>
/// <br/>
/// <c>BoxShape(const BoxShapeSettings &amp;inSettings, ShapeResult &amp;outResult)</c>
/// </para>
/// </summary>
public static BoxShape Create(BoxShapeSettings settings)
{
var _handle = Jolt.PInvoke.BoxShape_Create_2(settings);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
/// <summary>
/// <para>
/// Create a box with half edge length inHalfExtent and convex radius inConvexRadius. (internally the convex
/// radius will be subtracted from the half extent so the total box will not grow with the convex radius).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L44">Jolt/Physics/Collision/Shape/BoxShape.h:44</see>
/// <br/>
/// <c>explicit BoxShape(Vec3Arg inHalfExtent, float inConvexRadius = cDefaultConvexRadius, const PhysicsMaterial *inMaterial = nullptr)</c>
/// </para>
/// </summary>
public static BoxShape Create(
float3 halfExtent,
float convexRadius = 0.05f,
PhysicsMaterial material = default
) => Jolt.PInvoke.BoxShape_Create_3(halfExtent, convexRadius, material);
/// <summary>
/// <para>
/// Get half extent of box
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L47">Jolt/Physics/Collision/Shape/BoxShape.h:47</see>
/// <br/>
/// <c>Vec3 GetHalfExtent() const</c>
/// </para>
/// </summary>
public float3 GetHalfExtent() => Jolt.PInvoke.BoxShape_GetHalfExtent(this);
/// <inheritdoc cref="Shape.GetLocalBounds()"/>
public AABox GetLocalBounds() => ((Shape)this).GetLocalBounds();
/// <inheritdoc cref="Shape.GetInnerRadius()"/>
public float GetInnerRadius() => ((Shape)this).GetInnerRadius();
/// <inheritdoc cref="Shape.GetMassProperties()"/>
public MassProperties GetMassProperties() => ((Shape)this).GetMassProperties();
/// <inheritdoc cref="Shape.GetSurfaceNormal(uint, float3)"/>
public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) =>
((Shape)this).GetSurfaceNormal(subShapeID, localSurfacePosition);
/// <inheritdoc cref="Shape.GetSupportingFace(uint, float3, float3, in float4x4, out StaticArrayVec3_32)"/>
public void GetSupportingFace(
uint subShapeID,
float3 direction,
float3 scale,
in float4x4 centerOfMassTransform,
out StaticArrayVec3_32 vertices
) => ((Shape)this).GetSupportingFace(subShapeID, direction, scale, in centerOfMassTransform, out vertices);
/// <inheritdoc cref="Shape.Draw(DebugRenderer, in float4x4, float3, uint, bool, bool)"/>
public void Draw(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
float3 scale,
uint color,
bool useMaterialColors,
bool drawWireframe
) => ((Shape)this).Draw(renderer, in centerOfMassTransform, scale, color, useMaterialColors, drawWireframe);
/// <inheritdoc cref="Shape.CastRay(in RayCast, SubShapeIDCreator, ref RayCastResult)"/>
public bool CastRay(in RayCast ray, SubShapeIDCreator subShapeIDCreator, ref RayCastResult hit) =>
((Shape)this).CastRay(in ray, subShapeIDCreator, ref hit);
/// <inheritdoc cref="Shape.CastRay(in RayCast, RayCastSettings, SubShapeIDCreator, Span{RayCastResult}, out uint, ShapeFilter)"/>
public unsafe uint CastRay(
in RayCast ray,
RayCastSettings rayCastSettings,
SubShapeIDCreator subShapeIDCreator,
Span<RayCastResult> results,
out uint totalHits,
ShapeFilter shapeFilter = default
) => ((Shape)this).CastRay(in ray, rayCastSettings, subShapeIDCreator, results, out totalHits, shapeFilter);
/// <inheritdoc cref="Shape.CastRayClosest(in RayCast, RayCastSettings, SubShapeIDCreator, out RayCastResult, ShapeFilter)"/>
public bool CastRayClosest(
in RayCast ray,
RayCastSettings rayCastSettings,
SubShapeIDCreator subShapeIDCreator,
out RayCastResult result,
ShapeFilter shapeFilter = default
) => ((Shape)this).CastRayClosest(in ray, rayCastSettings, subShapeIDCreator, out result, shapeFilter);
/// <inheritdoc cref="Shape.CollidePoint(float3, SubShapeIDCreator, Span{CollidePointResult}, out uint, ShapeFilter)"/>
public unsafe uint CollidePoint(
float3 point,
SubShapeIDCreator subShapeIDCreator,
Span<CollidePointResult> results,
out uint totalHits,
ShapeFilter shapeFilter = default
) => ((Shape)this).CollidePoint(point, subShapeIDCreator, results, out totalHits, shapeFilter);
/// <inheritdoc cref="Shape.CollideSoftBodyVertices(in float4x4, float3, CollideSoftBodyVertexIterator, uint, int)"/>
public void CollideSoftBodyVertices(
in float4x4 centerOfMassTransform,
float3 scale,
CollideSoftBodyVertexIterator vertices,
uint numVertices,
int collidingShapeIndex
) =>
((Shape)this).CollideSoftBodyVertices(
in centerOfMassTransform,
scale,
vertices,
numVertices,
collidingShapeIndex
);
/// <inheritdoc cref="Shape.GetTrianglesStart(ref Shape.GetTrianglesContext, in AABox, float3, floatQuat, float3)"/>
public void GetTrianglesStart(
ref Shape.GetTrianglesContext context,
in AABox box,
float3 positionCOM,
floatQuat rotation,
float3 scale
) => ((Shape)this).GetTrianglesStart(ref context, in box, positionCOM, rotation, scale);
/// <inheritdoc cref="Shape.GetTrianglesNext(ref Shape.GetTrianglesContext, int, Ptr{float3}, Ptr{PhysicsMaterial})"/>
public unsafe int GetTrianglesNext(
ref Shape.GetTrianglesContext context,
int maxTrianglesRequested,
Ptr<float3> triangleVertices,
Ptr<PhysicsMaterial> materials = default
) => ((Shape)this).GetTrianglesNext(ref context, maxTrianglesRequested, triangleVertices, materials);
/// <inheritdoc cref="Shape.SaveBinaryState(StreamOut)"/>
public void SaveBinaryState(StreamOut stream) => ((Shape)this).SaveBinaryState(stream);
/// <inheritdoc cref="Shape.GetStats()"/>
public Shape.Stats GetStats() => ((Shape)this).GetStats();
/// <inheritdoc cref="Shape.GetVolume()"/>
public float GetVolume() => ((Shape)this).GetVolume();
/// <summary>
/// <para>
/// Get the convex radius of this box
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L98">Jolt/Physics/Collision/Shape/BoxShape.h:98</see>
/// <br/>
/// <c>float GetConvexRadius() const</c>
/// </para>
/// </summary>
public float GetConvexRadius() => Jolt.PInvoke.BoxShape_GetConvexRadius(this);
/// <summary>
/// <para>
/// Register shape functions with the registry
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L101">Jolt/Physics/Collision/Shape/BoxShape.h:101</see>
/// <br/>
/// <c>static void sRegister()</c>
/// </para>
/// </summary>
public static void Register() => Jolt.PInvoke.BoxShape_Register();
public void AddRef() => ((Shape)this).AddRef();
public void Release() => ((Shape)this).Release();
public uint GetRefCount() => ((Shape)this).GetRefCount();
public static implicit operator ConvexShape(BoxShape value) => Unsafe.BitCast<BoxShape, ConvexShape>(value);
public static implicit operator Shape(BoxShape value) => Unsafe.BitCast<BoxShape, Shape>(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
/// <inheritdoc cref="ConvexShape.GetMaterial()"/>
public PhysicsMaterial GetMaterial() => ((ConvexShape)this).GetMaterial();
/// <inheritdoc cref="ConvexShape.SetMaterial(PhysicsMaterial)"/>
public void SetMaterial(PhysicsMaterial material) => ((ConvexShape)this).SetMaterial(material);
/// <inheritdoc cref="ConvexShape.SetDensity(float)"/>
public void SetDensity(float density) => ((ConvexShape)this).SetDensity(density);
/// <inheritdoc cref="ConvexShape.GetDensity()"/>
public float GetDensity() => ((ConvexShape)this).GetDensity();
/// <inheritdoc cref="Shape.GetShapeType()"/>
public ShapeType GetShapeType() => ((Shape)this).GetShapeType();
/// <inheritdoc cref="Shape.GetSubType()"/>
public ShapeSubType GetSubType() => ((Shape)this).GetSubType();
/// <inheritdoc cref="Shape.GetUserData()"/>
public ulong GetUserData() => ((Shape)this).GetUserData();
/// <inheritdoc cref="Shape.SetUserData(ulong)"/>
public void SetUserData(ulong userData) => ((Shape)this).SetUserData(userData);
/// <inheritdoc cref="Shape.MustBeStatic()"/>
public bool MustBeStatic() => ((Shape)this).MustBeStatic();
/// <inheritdoc cref="Shape.GetCenterOfMass()"/>
public float3 GetCenterOfMass() => ((Shape)this).GetCenterOfMass();
/// <inheritdoc cref="Shape.GetSubShapeIDBitsRecursive()"/>
public uint GetSubShapeIDBitsRecursive() => ((Shape)this).GetSubShapeIDBitsRecursive();
/// <inheritdoc cref="Shape.GetWorldSpaceBounds(in float4x4, float3)"/>
public AABox GetWorldSpaceBounds(in float4x4 centerOfMassTransform, float3 scale) =>
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
/// <inheritdoc cref="Shape.GetWorldSpaceBounds(in double4x4, float3)"/>
public AABox GetWorldSpaceBounds(in double4x4 centerOfMassTransform, float3 scale) =>
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
/// <inheritdoc cref="Shape.GetLeafShape(uint, out uint)"/>
public Shape GetLeafShape(uint subShapeID, out uint remainder) =>
((Shape)this).GetLeafShape(subShapeID, out remainder);
/// <inheritdoc cref="Shape.GetMaterial(uint)"/>
public PhysicsMaterial GetMaterial(uint subShapeID) => ((Shape)this).GetMaterial(subShapeID);
/// <inheritdoc cref="Shape.GetSubShapeUserData(uint)"/>
public ulong GetSubShapeUserData(uint subShapeID) => ((Shape)this).GetSubShapeUserData(subShapeID);
/// <inheritdoc cref="Shape.GetSubShapeTransformedShape(uint, float3, floatQuat, float3, out uint)"/>
public TransformedShape GetSubShapeTransformedShape(
uint subShapeID,
float3 positionCOM,
floatQuat rotation,
float3 scale,
out uint remainder
) => ((Shape)this).GetSubShapeTransformedShape(subShapeID, positionCOM, rotation, scale, out remainder);
/// <inheritdoc cref="Shape.GetSubmergedVolume(in float4x4, float3, in Plane, out float, out float, out float3, float3)"/>
public void GetSubmergedVolume(
in float4x4 centerOfMassTransform,
float3 scale,
in Plane surface,
out float totalVolume,
out float submergedVolume,
out float3 centerOfBuoyancy,
float3 baseOffset
) =>
((Shape)this).GetSubmergedVolume(
in centerOfMassTransform,
scale,
in surface,
out totalVolume,
out submergedVolume,
out centerOfBuoyancy,
baseOffset
);
/// <inheritdoc cref="Shape.DrawGetSupportFunction(DebugRenderer, in float4x4, float3, uint, bool)"/>
public void DrawGetSupportFunction(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
float3 scale,
uint color,
bool drawSupportDirection
) =>
((Shape)this).DrawGetSupportFunction(
renderer,
in centerOfMassTransform,
scale,
color,
drawSupportDirection
);
/// <inheritdoc cref="Shape.DrawGetSupportingFace(DebugRenderer, in float4x4, float3)"/>
public void DrawGetSupportingFace(DebugRenderer renderer, in float4x4 centerOfMassTransform, float3 scale) =>
((Shape)this).DrawGetSupportingFace(renderer, in centerOfMassTransform, scale);
/// <inheritdoc cref="Shape.CollectTransformedShapes(in AABox, float3, floatQuat, float3, SubShapeIDCreator, ShapeFilter)"/>
public NativeHandleArray<TransformedShape> CollectTransformedShapes(
in AABox box,
float3 positionCOM,
floatQuat rotation,
float3 scale,
SubShapeIDCreator subShapeIDCreator,
ShapeFilter shapeFilter
) =>
((Shape)this).CollectTransformedShapes(
in box,
positionCOM,
rotation,
scale,
subShapeIDCreator,
shapeFilter
);
/// <inheritdoc cref="Shape.TransformShape(in float4x4)"/>
public NativeHandleArray<TransformedShape> TransformShape(in float4x4 centerOfMassTransform) =>
((Shape)this).TransformShape(in centerOfMassTransform);
/// <inheritdoc cref="Shape.ScaleShape(float3)"/>
public Shape ScaleShape(float3 scale) => ((Shape)this).ScaleShape(scale);
/// <inheritdoc cref="Shape.SaveMaterialState()"/>
public NativeArray<PhysicsMaterial> SaveMaterialState() => ((Shape)this).SaveMaterialState();
/// <inheritdoc cref="Shape.RestoreMaterialState(ReadOnlySpan{PhysicsMaterial})"/>
public unsafe void RestoreMaterialState(ReadOnlySpan<PhysicsMaterial> materials) =>
((Shape)this).RestoreMaterialState(materials);
/// <inheritdoc cref="Shape.SaveSubShapeState()"/>
public NativeArray<Shape> SaveSubShapeState() => ((Shape)this).SaveSubShapeState();
/// <inheritdoc cref="Shape.RestoreSubShapeState(ReadOnlySpan{Shape})"/>
public unsafe void RestoreSubShapeState(ReadOnlySpan<Shape> subShapes) =>
((Shape)this).RestoreSubShapeState(subShapes);
/// <inheritdoc cref="Shape.SaveWithChildren(StreamOut, ShapeToIDMap, MaterialToIDMap)"/>
public void SaveWithChildren(StreamOut stream, ShapeToIDMap shapeMap, MaterialToIDMap materialMap) =>
((Shape)this).SaveWithChildren(stream, shapeMap, materialMap);
/// <inheritdoc cref="Shape.IsValidScale(float3)"/>
public bool IsValidScale(float3 scale) => ((Shape)this).IsValidScale(scale);
/// <inheritdoc cref="Shape.MakeScaleValid(float3)"/>
public float3 MakeScaleValid(float3 scale) => ((Shape)this).MakeScaleValid(scale);
}
}

View file

@ -0,0 +1,151 @@
// <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>
/// Class that constructs a BoxShape
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L13">Jolt/Physics/Collision/Shape/BoxShape.h:13</see>
/// <br/>
/// <c>class BoxShapeSettings final : public ConvexShapeSettings</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BoxShapeSettings : IDisposable
{
/// <summary>
/// <para>
/// Default constructor for deserialization
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L19">Jolt/Physics/Collision/Shape/BoxShape.h:19</see>
/// <br/>
/// <c>BoxShapeSettings() = default</c>
/// </para>
/// </summary>
public static BoxShapeSettings Create() => Jolt.PInvoke.BoxShapeSettings_Create();
/// <summary>
/// <para>
/// Create a box with half edge length inHalfExtent and convex radius inConvexRadius. (internally the convex
/// radius will be subtracted from the half extent so the total box will not grow with the convex radius).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L23">Jolt/Physics/Collision/Shape/BoxShape.h:23</see>
/// <br/>
/// <c>explicit BoxShapeSettings(Vec3Arg inHalfExtent, float inConvexRadius = cDefaultConvexRadius, const PhysicsMaterial *inMaterial = nullptr)</c>
/// </para>
/// </summary>
public static BoxShapeSettings Create(
float3 halfExtent,
float convexRadius = 0.05f,
PhysicsMaterial material = default
) => Jolt.PInvoke.BoxShapeSettings_Create_2(halfExtent, convexRadius, material);
/// <inheritdoc cref="ShapeSettings.GetRTTI()"/>
public RTTI GetRTTI() => ((ShapeSettings)this).GetRTTI();
/// <inheritdoc cref="ShapeSettings.CastTo(RTTI)"/>
public unsafe Ptr CastTo(RTTI rtti) => ((ShapeSettings)this).CastTo(rtti);
/// <inheritdoc cref="ShapeSettings.CreateShape()"/>
public Shape CreateShape() => ((ShapeSettings)this).CreateShape();
/// <summary>
/// <para>
/// Half the size of the box (including convex radius)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L28">Jolt/Physics/Collision/Shape/BoxShape.h:28</see>
/// <br/>
/// <c>Vec3 mHalfExtent = Vec3::sZero()</c>
/// </para>
/// </summary>
public float3 GetHalfExtent() => Jolt.PInvoke.BoxShapeSettings_GetHalfExtent(this);
/// <summary>
/// <para>
/// Half the size of the box (including convex radius)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L28">Jolt/Physics/Collision/Shape/BoxShape.h:28</see>
/// <br/>
/// <c>Vec3 mHalfExtent = Vec3::sZero()</c>
/// </para>
/// </summary>
public void SetHalfExtent(float3 value) => Jolt.PInvoke.BoxShapeSettings_SetHalfExtent(this, value);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L29">Jolt/Physics/Collision/Shape/BoxShape.h:29</see>
/// <br/>
/// <c>float mConvexRadius = 0.0f</c>
/// </para>
/// </summary>
public float GetConvexRadius() => Jolt.PInvoke.BoxShapeSettings_GetConvexRadius(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/BoxShape.h#L29">Jolt/Physics/Collision/Shape/BoxShape.h:29</see>
/// <br/>
/// <c>float mConvexRadius = 0.0f</c>
/// </para>
/// </summary>
public void SetConvexRadius(float value) => Jolt.PInvoke.BoxShapeSettings_SetConvexRadius(this, value);
public void AddRef() => ((ShapeSettings)this).AddRef();
public void Release() => ((ShapeSettings)this).Release();
public uint GetRefCount() => ((ShapeSettings)this).GetRefCount();
public static implicit operator ConvexShapeSettings(BoxShapeSettings value) =>
Unsafe.BitCast<BoxShapeSettings, ConvexShapeSettings>(value);
public static implicit operator ShapeSettings(BoxShapeSettings value) =>
Unsafe.BitCast<BoxShapeSettings, ShapeSettings>(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
/// <inheritdoc cref="ConvexShapeSettings.SetDensity(float)"/>
public void SetDensity(float density) => ((ConvexShapeSettings)this).SetDensity(density);
/// <inheritdoc cref="ConvexShapeSettings.GetMaterial()"/>
public PhysicsMaterial GetMaterial() => ((ConvexShapeSettings)this).GetMaterial();
/// <inheritdoc cref="ConvexShapeSettings.SetMaterial(PhysicsMaterial)"/>
public void SetMaterial(PhysicsMaterial value) => ((ConvexShapeSettings)this).SetMaterial(value);
/// <inheritdoc cref="ConvexShapeSettings.GetDensity()"/>
public float GetDensity() => ((ConvexShapeSettings)this).GetDensity();
/// <inheritdoc cref="ShapeSettings.ClearCachedResult()"/>
public void ClearCachedResult() => ((ShapeSettings)this).ClearCachedResult();
/// <inheritdoc cref="ShapeSettings.GetUserData()"/>
public ulong GetUserData() => ((ShapeSettings)this).GetUserData();
/// <inheritdoc cref="ShapeSettings.SetUserData(ulong)"/>
public void SetUserData(ulong value) => ((ShapeSettings)this).SetUserData(value);
}
}

View file

@ -0,0 +1,460 @@
// <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>
/// Used to do coarse collision detection operations to quickly prune out bodies that will not collide.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L25">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:25</see>
/// <br/>
/// <c>class BroadPhase : public BroadPhaseQuery</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct BroadPhase
{
/// <summary>
/// <para>
/// Context used during broadphase update
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L44">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:44</see>
/// <br/>
/// <c>struct UpdateState { void *mData[4]; }</c>
/// </para>
/// </summary>
[StructLayout(LayoutKind.Explicit, Size = 32)]
public partial struct UpdateState
{
/// <summary>
/// <para>
/// Context used during broadphase update
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L44">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:44</see>
/// <br/>
/// <c>void *mData[4]</c>
/// </para>
/// </summary>
[FieldOffset(0)]
public nint_4 Data;
}
/// <summary>
/// <para>
/// Initialize the broadphase.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L32">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:32</see>
/// <br/>
/// <c>virtual void Init(BodyManager *inBodyManager, const BroadPhaseLayerInterface &amp;inLayerInterface)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Initialize the broadphase.
/// @param inBodyManager The body manager singleton
/// @param inLayerInterface Interface that maps object layers to broadphase layers.
/// Note that the broadphase takes a pointer to the data inside inObjectToBroadPhaseLayer so this object should remain static.
/// </code>
/// </remarks>
public void Init(BodyManager bodyManager, BroadPhaseLayerInterface layerInterface) =>
Jolt.PInvoke.BroadPhase_Init(this, bodyManager, layerInterface);
/// <summary>
/// <para>
/// Should be called after many objects have been inserted to make the broadphase more efficient, usually
/// done on startup only
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L35">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:35</see>
/// <br/>
/// <c>virtual void Optimize()</c>
/// </para>
/// </summary>
public void Optimize() => Jolt.PInvoke.BroadPhase_Optimize(this);
/// <summary>
/// <para>
/// Must be called just before updating the broadphase when none of the body mutexes are locked
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L38">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:38</see>
/// <br/>
/// <c>virtual void FrameSync()</c>
/// </para>
/// </summary>
public void FrameSync() => Jolt.PInvoke.BroadPhase_FrameSync(this);
/// <summary>
/// <para>
/// Must be called before UpdatePrepare to prevent modifications from being made to the tree
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L41">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:41</see>
/// <br/>
/// <c>virtual void LockModifications()</c>
/// </para>
/// </summary>
public void LockModifications() => Jolt.PInvoke.BroadPhase_LockModifications(this);
/// <summary>
/// <para>
/// Must be called after UpdateFinalize to allow modifications to the broadphase
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L54">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:54</see>
/// <br/>
/// <c>virtual void UnlockModifications()</c>
/// </para>
/// </summary>
public void UnlockModifications() => Jolt.PInvoke.BroadPhase_UnlockModifications(this);
/// <summary>
/// <para>
/// Remove inNumber bodies in ioBodies from the broadphase. ioBodies may be shuffled around by this
/// function.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L75">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:75</see>
/// <br/>
/// <c>virtual void RemoveBodies(BodyID *ioBodies, int inNumber) = 0</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 RemoveBodies(Span<uint> bodies)
{
fixed (uint* bodies_fixed = bodies)
{
Jolt.PInvoke.BroadPhase_RemoveBodies(this, bodies_fixed, (int)bodies.Length);
}
}
/// <summary>
/// <para>
/// Call whenever the aabb of a body changes (can change order of ioBodies array) inTakeLock should be false
/// if we're between LockModifications/UnlockModifications, in which case care needs to be taken to not call
/// this between UpdatePrepare/UpdateFinalize
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L79">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:79</see>
/// <br/>
/// <c>virtual void NotifyBodiesAABBChanged(BodyID *ioBodies, int inNumber, bool inTakeLock = true) = 0</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 = true)
{
fixed (uint* bodies_fixed = bodies)
{
Jolt.PInvoke.BroadPhase_NotifyBodiesAABBChanged(this, bodies_fixed, (int)bodies.Length, takeLock);
}
}
/// <summary>
/// <para>
/// Call whenever the layer (and optionally the aabb as well) of a body changes (can change order of
/// ioBodies array)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L82">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:82</see>
/// <br/>
/// <c>virtual void NotifyBodiesLayerChanged(BodyID *ioBodies, int inNumber) = 0</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 NotifyBodiesLayerChanged(Span<uint> bodies)
{
fixed (uint* bodies_fixed = bodies)
{
Jolt.PInvoke.BroadPhase_NotifyBodiesLayerChanged(this, bodies_fixed, (int)bodies.Length);
}
}
/// <summary>
/// <para>
/// Find all colliding pairs between dynamic bodies Note that this function is very specifically tailored
/// for the PhysicsSystem::Update function, hence it is not part of the BroadPhaseQuery interface. One of
/// the assumptions it can make is that no locking is needed during the query as it will only be called
/// during a very particular part of the update.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L93">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:93</see>
/// <br/>
/// <c>virtual void FindCollidingPairs(BodyID *ioActiveBodies, int inNumActiveBodies, float inSpeculativeContactDistance, const ObjectVsBroadPhaseLayerFilter &amp;inObjectVsBroadPhaseLayerFilter, const ObjectLayerPairFilter &amp;inObjectLayerPairFilter, BodyPairCollector &amp;ioPairCollector) const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Find all colliding pairs between dynamic bodies
/// Note that this function is very specifically tailored for the PhysicsSystem::Update function, hence it is not part of the BroadPhaseQuery interface.
/// One of the assumptions it can make is that no locking is needed during the query as it will only be called during a very particular part of the update.
/// @param ioActiveBodies is a list of bodies for which we need to find colliding pairs (this function can change the order of the ioActiveBodies array). This can be a subset of the set of active bodies in the system.
/// @param inNumActiveBodies is the size of the ioActiveBodies array.
/// @param inSpeculativeContactDistance Distance at which speculative contact points will be created.
/// @param inObjectVsBroadPhaseLayerFilter is the filter that determines if an object can collide with a broadphase layer.
/// @param inObjectLayerPairFilter is the filter that determines if two objects can collide.
/// @param ioPairCollector receives callbacks for every body pair found.
/// </code>
/// <para>
/// Collects every hit into findcollidingpairsresults, 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>
/// activeBodies 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 uint FindCollidingPairs(
Span<uint> activeBodies,
float speculativeContactDistance,
ObjectVsBroadPhaseLayerFilter objectVsBroadPhaseLayerFilter,
ObjectLayerPairFilter objectLayerPairFilter,
Span<BodyPair> results,
out uint totalHits
)
{
fixed (uint* activeBodies_fixed = activeBodies)
fixed (BodyPair* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhase_FindCollidingPairs(
this,
activeBodies_fixed,
(int)activeBodies.Length,
speculativeContactDistance,
objectVsBroadPhaseLayerFilter,
objectLayerPairFilter,
results_fixed,
(uint)results.Length
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Same as BroadPhaseQuery::CastAABox but can be implemented in a way to take no broad phase locks.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L96">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:96</see>
/// <br/>
/// <c>virtual void CastAABoxNoLock(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 castaaboxnolockresults, 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 CastAABoxNoLock(
in AABoxCast box,
Span<BroadPhaseCastResult> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter,
ObjectLayerFilter objectLayerFilter
)
{
fixed (BroadPhaseCastResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhase_CastAABoxNoLock(
this,
in box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Same as BroadPhaseQuery::CastAABox but can be implemented in a way to take no broad phase locks.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/BroadPhase/BroadPhase.h#L96">Jolt/Physics/Collision/BroadPhase/BroadPhase.h:96</see>
/// <br/>
/// <c>virtual void CastAABoxNoLock(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>
/// <para>
/// Pass default for broadPhaseLayerFilter to filter nothing out.
/// </para>
/// <para>
/// Pass default for objectLayerFilter to filter nothing out.
/// </para>
/// </remarks>
public bool CastAABoxNoLockClosest(
in AABoxCast box,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter,
ObjectLayerFilter objectLayerFilter
) =>
Jolt.PInvoke.BroadPhase_CastAABoxNoLockClosest(
this,
in box,
out result,
broadPhaseLayerFilter,
objectLayerFilter
) != 0;
public static implicit operator BroadPhaseQuery(BroadPhase value) =>
Unsafe.BitCast<BroadPhase, BroadPhaseQuery>(value);
/// <inheritdoc cref="BroadPhaseQuery.CastRay(in RayCast, Span{BroadPhaseCastResult}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public unsafe uint CastRay(
in RayCast ray,
Span<BroadPhaseCastResult> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) => ((BroadPhaseQuery)this).CastRay(in ray, results, out totalHits, broadPhaseLayerFilter, objectLayerFilter);
/// <inheritdoc cref="BroadPhaseQuery.CastRayClosest(in RayCast, out BroadPhaseCastResult, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public bool CastRayClosest(
in RayCast ray,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) => ((BroadPhaseQuery)this).CastRayClosest(in ray, out result, broadPhaseLayerFilter, objectLayerFilter);
/// <inheritdoc cref="BroadPhaseQuery.CollideAABox(in AABox, Span{uint}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public unsafe uint CollideAABox(
in AABox box,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
((BroadPhaseQuery)this).CollideAABox(
in box,
results,
out totalHits,
broadPhaseLayerFilter,
objectLayerFilter
);
/// <inheritdoc cref="BroadPhaseQuery.CollideSphere(float3, float, Span{uint}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public unsafe uint CollideSphere(
float3 center,
float radius,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
((BroadPhaseQuery)this).CollideSphere(
center,
radius,
results,
out totalHits,
broadPhaseLayerFilter,
objectLayerFilter
);
/// <inheritdoc cref="BroadPhaseQuery.CollidePoint(float3, Span{uint}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public unsafe uint CollidePoint(
float3 point,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
((BroadPhaseQuery)this).CollidePoint(
point,
results,
out totalHits,
broadPhaseLayerFilter,
objectLayerFilter
);
/// <inheritdoc cref="BroadPhaseQuery.CollideOrientedBox(OrientedBox, Span{uint}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public unsafe uint CollideOrientedBox(
OrientedBox box,
Span<uint> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
((BroadPhaseQuery)this).CollideOrientedBox(
box,
results,
out totalHits,
broadPhaseLayerFilter,
objectLayerFilter
);
/// <inheritdoc cref="BroadPhaseQuery.CastAABox(in AABoxCast, Span{BroadPhaseCastResult}, out uint, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public unsafe uint CastAABox(
in AABoxCast box,
Span<BroadPhaseCastResult> results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
((BroadPhaseQuery)this).CastAABox(in box, results, out totalHits, broadPhaseLayerFilter, objectLayerFilter);
/// <inheritdoc cref="BroadPhaseQuery.CastAABoxClosest(in AABoxCast, out BroadPhaseCastResult, BroadPhaseLayerFilter, ObjectLayerFilter)"/>
public bool CastAABoxClosest(
in AABoxCast box,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) => ((BroadPhaseQuery)this).CastAABoxClosest(in box, out result, broadPhaseLayerFilter, objectLayerFilter);
/// <inheritdoc cref="BroadPhaseQuery.GetBounds()"/>
public AABox GetBounds() => ((BroadPhaseQuery)this).GetBounds();
}
}

Some files were not shown because too many files have changed in this diff Show more