mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
67 lines
2.7 KiB
C#
67 lines
2.7 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>
|
|
/// 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<true, Body></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);
|
|
}
|
|
}
|