mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
211 lines
9.4 KiB
C#
211 lines
9.4 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Jolt.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using Brutal.Interop;
|
|
using Brutal.Numerics;
|
|
|
|
namespace Brutal.JoltApi
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Keeps track of connected bodies and builds islands for multithreaded velocity/position update
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L18">Jolt/Physics/IslandBuilder.h:18</see>
|
|
/// <br/>
|
|
/// <c>class IslandBuilder : public NonCopyable</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct IslandBuilder : IDisposable
|
|
{
|
|
public static IslandBuilder Create() => Jolt.PInvoke.IslandBuilder_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Initialize the island builder with the maximum amount of bodies that could be active
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L25">Jolt/Physics/IslandBuilder.h:25</see>
|
|
/// <br/>
|
|
/// <c>void Init(uint32 inMaxActiveBodies)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Init(uint maxActiveBodies) => Jolt.PInvoke.IslandBuilder_Init(this, maxActiveBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Prepare for simulation step by allocating space for the contact constraints
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L28">Jolt/Physics/IslandBuilder.h:28</see>
|
|
/// <br/>
|
|
/// <c>void PrepareContactConstraints(uint32 inMaxContactConstraints, TempAllocator *inTempAllocator)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void PrepareContactConstraints(uint maxContactConstraints, TempAllocator tempAllocator) =>
|
|
Jolt.PInvoke.IslandBuilder_PrepareContactConstraints(this, maxContactConstraints, tempAllocator);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Prepare for simulation step by allocating space for the non-contact constraints
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L31">Jolt/Physics/IslandBuilder.h:31</see>
|
|
/// <br/>
|
|
/// <c>void PrepareNonContactConstraints(uint32 inNumConstraints, TempAllocator *inTempAllocator)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void PrepareNonContactConstraints(uint numConstraints, TempAllocator tempAllocator) =>
|
|
Jolt.PInvoke.IslandBuilder_PrepareNonContactConstraints(this, numConstraints, tempAllocator);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Link two bodies by their index in the BodyManager::mActiveBodies list to form islands
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L34">Jolt/Physics/IslandBuilder.h:34</see>
|
|
/// <br/>
|
|
/// <c>void LinkBodies(uint32 inFirst, uint32 inSecond)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void LinkBodies(uint first, uint second) => Jolt.PInvoke.IslandBuilder_LinkBodies(this, first, second);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Link a constraint to a body by their index in the BodyManager::mActiveBodies
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L37">Jolt/Physics/IslandBuilder.h:37</see>
|
|
/// <br/>
|
|
/// <c>void LinkConstraint(uint32 inConstraintIndex, uint32 inIndexInActiveBodyList)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void LinkConstraint(uint constraintIndex, uint indexInActiveBodyList) =>
|
|
Jolt.PInvoke.IslandBuilder_LinkConstraint(this, constraintIndex, indexInActiveBodyList);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Link a contact to a body by their index in the BodyManager::mActiveBodies
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L40">Jolt/Physics/IslandBuilder.h:40</see>
|
|
/// <br/>
|
|
/// <c>void LinkContact(uint32 inContactIndex, uint32 inIndexInActiveBodyList)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void LinkContact(uint contactIndex, uint indexInActiveBodyList) =>
|
|
Jolt.PInvoke.IslandBuilder_LinkContact(this, contactIndex, indexInActiveBodyList);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Finalize the islands after all bodies have been Link()-ed
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L43">Jolt/Physics/IslandBuilder.h:43</see>
|
|
/// <br/>
|
|
/// <c>void Finalize(const BodyID *inActiveBodies, uint32 inNumActiveBodies, uint32 inNumContacts, TempAllocator *inTempAllocator)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// activeBodies is the buffer the native call reads, and its element count travels with it: the span is
|
|
/// only read, and it is only read for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void Complete(ReadOnlySpan<uint> activeBodies, uint numContacts, TempAllocator tempAllocator)
|
|
{
|
|
fixed (uint* activeBodies_fixed = activeBodies)
|
|
{
|
|
Jolt.PInvoke.IslandBuilder_Complete(
|
|
this,
|
|
activeBodies_fixed,
|
|
(uint)activeBodies.Length,
|
|
numContacts,
|
|
tempAllocator
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the amount of islands formed
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L46">Jolt/Physics/IslandBuilder.h:46</see>
|
|
/// <br/>
|
|
/// <c>uint32 GetNumIslands() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetNumIslands() => Jolt.PInvoke.IslandBuilder_GetNumIslands(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// The number of position iterations for each island
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L54">Jolt/Physics/IslandBuilder.h:54</see>
|
|
/// <br/>
|
|
/// <c>void SetNumPositionSteps(uint32 inIslandIndex, uint inNumPositionSteps)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetNumPositionSteps(uint islandIndex, uint numPositionSteps)
|
|
{
|
|
Jolt.PInvoke.IslandBuilder_SetNumPositionSteps(this, islandIndex, numPositionSteps, out var _inRange);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(islandIndex),
|
|
islandIndex,
|
|
"Expected an index below the number of islands."
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L55">Jolt/Physics/IslandBuilder.h:55</see>
|
|
/// <br/>
|
|
/// <c>uint GetNumPositionSteps(uint32 inIslandIndex) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetNumPositionSteps(uint islandIndex)
|
|
{
|
|
var _result = Jolt.PInvoke.IslandBuilder_GetNumPositionSteps(this, islandIndex, out var _inRange);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(islandIndex),
|
|
islandIndex,
|
|
"Expected an index below the number of islands."
|
|
);
|
|
return _result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// After you're done calling the three functions above, call this function to free associated data
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/IslandBuilder.h#L73">Jolt/Physics/IslandBuilder.h:73</see>
|
|
/// <br/>
|
|
/// <c>void ResetIslands(TempAllocator *inTempAllocator)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void ResetIslands(TempAllocator tempAllocator) =>
|
|
Jolt.PInvoke.IslandBuilder_ResetIslands(this, tempAllocator);
|
|
|
|
public void Dispose() => Jolt.PInvoke.IslandBuilder_Destroy(this);
|
|
}
|
|
}
|