//
// 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
{
///
///
/// A constraint manager manages all constraints of the same type
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:27
///
/// class ConstraintManager : public NonCopyable
///
///
///
///
/// A constraint manager manages all constraints of the same type
///
/// WARNING: This class is an internal part of PhysicsSystem, it has no functions that can be called by users of the library.
/// Its functionality is exposed through PhysicsSystem and BodyInterface.
///
///
[InteropHandle]
public readonly partial struct ConstraintManager
{
///
///
/// Add a new constraint. This is thread safe.
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:38
///
/// void Add(Constraint **inConstraints, int inNumber)
///
///
///
///
/// constraints is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public unsafe void Add(Ptr constraints, int number) =>
Jolt.PInvoke.ConstraintManager_Add(this, constraints, number);
///
///
/// Remove a constraint. This is thread safe.
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:41
///
/// void Remove(Constraint **inConstraint, int inNumber)
///
///
///
///
/// constraint is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public unsafe void Remove(Ptr constraint, int number) =>
Jolt.PInvoke.ConstraintManager_Remove(this, constraint, number);
///
///
/// Get a list of all constraints
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:44
///
/// Constraints GetConstraints() const
///
///
///
///
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
/// themselves.
///
///
public NativeArray GetConstraints() =>
new NativeArray(Jolt.PInvoke.ConstraintManager_GetConstraints(this));
///
///
/// Get total number of constraints
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:47
///
/// inline uint32 GetNumConstraints() const
///
///
public uint GetNumConstraints() => Jolt.PInvoke.ConstraintManager_GetNumConstraints(this);
///
///
/// Determine the active constraints of a subset of the constraints
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:50
///
/// void GetActiveConstraints(uint32 inStartConstraintIdx, uint32 inEndConstraintIdx, Constraint **outActiveConstraints, uint32 &outNumActiveConstraints) const
///
///
///
///
/// activeConstraints is a buffer of Constraint handles you allocate and size; the handles the call writes
/// into it are borrowed from their owner - don't Dispose them.
///
///
public unsafe void GetActiveConstraints(
uint startConstraintIdx,
uint endConstraintIdx,
Ptr activeConstraints,
out uint numActiveConstraints
) =>
Jolt.PInvoke.ConstraintManager_GetActiveConstraints(
this,
startConstraintIdx,
endConstraintIdx,
activeConstraints,
out numActiveConstraints
);
///
///
/// Link bodies to form islands
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:53
///
/// static void sBuildIslands(Constraint **inActiveConstraints, uint32 inNumActiveConstraints, IslandBuilder &ioBuilder, BodyManager &inBodyManager)
///
///
///
///
/// activeConstraints is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public static unsafe void BuildIslands(
Ptr activeConstraints,
uint numActiveConstraints,
IslandBuilder builder,
BodyManager bodyManager
) => Jolt.PInvoke.ConstraintManager_BuildIslands(activeConstraints, numActiveConstraints, builder, bodyManager);
///
///
/// In order to have a deterministic simulation, we need to sort the constraints of an island before solving
/// them
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:56
///
/// static void sSortConstraints(Constraint **inActiveConstraints, uint32 *inConstraintIdxBegin, uint32 *inConstraintIdxEnd)
///
///
///
///
/// activeConstraints is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public static unsafe void SortConstraints(
Ptr activeConstraints,
Ptr constraintIdxBegin,
Ptr constraintIdxEnd
) => Jolt.PInvoke.ConstraintManager_SortConstraints(activeConstraints, constraintIdxBegin, constraintIdxEnd);
///
///
/// Prior to solving the velocity constraints, you must call SetupVelocityConstraints once to precalculate
/// values that are independent of velocity
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:59
///
/// static void sSetupVelocityConstraints(Constraint **inActiveConstraints, uint32 inNumActiveConstraints, float inDeltaTime)
///
///
///
///
/// activeConstraints is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public static unsafe void SetupVelocityConstraints(
Ptr activeConstraints,
uint numActiveConstraints,
float deltaTime
) =>
Jolt.PInvoke.ConstraintManager_SetupVelocityConstraints(activeConstraints, numActiveConstraints, deltaTime);
///
///
/// This function is called multiple times to iteratively come to a solution that meets all velocity
/// constraints
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:66
///
/// static bool sSolveVelocityConstraints(Constraint **inActiveConstraints, const uint32 *inConstraintIdxBegin, const uint32 *inConstraintIdxEnd, float inDeltaTime)
///
///
///
///
/// activeConstraints is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public static unsafe bool SolveVelocityConstraints(
Ptr activeConstraints,
Ptr constraintIdxBegin,
Ptr constraintIdxEnd,
float deltaTime
) =>
Jolt.PInvoke.ConstraintManager_SolveVelocityConstraints(
activeConstraints,
constraintIdxBegin,
constraintIdxEnd,
deltaTime
);
///
///
/// This function is called multiple times to iteratively come to a solution that meets all position
/// constraints
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:69
///
/// static bool sSolvePositionConstraints(Constraint **inActiveConstraints, const uint32 *inConstraintIdxBegin, const uint32 *inConstraintIdxEnd, float inDeltaTime, float inBaumgarte)
///
///
///
///
/// activeConstraints is a buffer of Constraint handles you allocate and size, read by the call.
///
///
public static unsafe bool SolvePositionConstraints(
Ptr activeConstraints,
Ptr constraintIdxBegin,
Ptr constraintIdxEnd,
float deltaTime,
float baumgarte
) =>
Jolt.PInvoke.ConstraintManager_SolvePositionConstraints(
activeConstraints,
constraintIdxBegin,
constraintIdxEnd,
deltaTime,
baumgarte
);
///
///
/// Draw all constraints
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:73
///
/// void DrawConstraints(DebugRenderer *inRenderer) const
///
///
public void DrawConstraints(DebugRenderer renderer) =>
Jolt.PInvoke.ConstraintManager_DrawConstraints(this, renderer);
///
///
/// Draw all constraint limits
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:76
///
/// void DrawConstraintLimits(DebugRenderer *inRenderer) const
///
///
public void DrawConstraintLimits(DebugRenderer renderer) =>
Jolt.PInvoke.ConstraintManager_DrawConstraintLimits(this, renderer);
///
///
/// Draw all constraint reference frames
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:79
///
/// void DrawConstraintReferenceFrame(DebugRenderer *inRenderer) const
///
///
public void DrawConstraintReferenceFrame(DebugRenderer renderer) =>
Jolt.PInvoke.ConstraintManager_DrawConstraintReferenceFrame(this, renderer);
///
///
/// Lock all constraints. This should only be done during PhysicsSystem::Update().
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:89
///
/// void LockAllConstraints()
///
///
public void LockAllConstraints() => Jolt.PInvoke.ConstraintManager_LockAllConstraints(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintManager.h:90
///
/// void UnlockAllConstraints()
///
///
public void UnlockAllConstraints() => Jolt.PInvoke.ConstraintManager_UnlockAllConstraints(this);
}
}