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

315 lines
13 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>
/// Instance of a skeleton, contains the pose the current skeleton is in
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L17">Jolt/Skeleton/SkeletonPose.h:17</see>
/// <br/>
/// <c>class SkeletonPose</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct SkeletonPose : IDisposable
{
/// <summary>
/// <para>
/// Draw settings
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L64">Jolt/Skeleton/SkeletonPose.h:64</see>
/// <br/>
/// <c>struct DrawSettings</c>
/// </para>
/// </summary>
[StructLayout(LayoutKind.Explicit, Size = 3)]
public partial struct DrawSettings
{
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L66">Jolt/Skeleton/SkeletonPose.h:66</see>
/// <br/>
/// <c>bool mDrawJoints = true</c>
/// </para>
/// </summary>
[FieldOffset(0)]
public Brutal.Bool8 DrawJoints;
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L67">Jolt/Skeleton/SkeletonPose.h:67</see>
/// <br/>
/// <c>bool mDrawJointOrientations = true</c>
/// </para>
/// </summary>
[FieldOffset(1)]
public Brutal.Bool8 DrawJointOrientations;
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L68">Jolt/Skeleton/SkeletonPose.h:68</see>
/// <br/>
/// <c>bool mDrawJointNames = false</c>
/// </para>
/// </summary>
[FieldOffset(2)]
public Brutal.Bool8 DrawJointNames;
}
public static SkeletonPose Create() => Jolt.PInvoke.SkeletonPose_Create();
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L28">Jolt/Skeleton/SkeletonPose.h:28</see>
/// <br/>
/// <c>void SetSkeleton(const Skeleton *inSkeleton)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// @name Skeleton
/// @{
/// </code>
/// </remarks>
public void SetSkeleton(Skeleton skeleton) => Jolt.PInvoke.SkeletonPose_SetSkeleton(this, skeleton);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L29">Jolt/Skeleton/SkeletonPose.h:29</see>
/// <br/>
/// <c>const Skeleton * GetSkeleton() const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle carries its own reference; Dispose it once when you're done.
/// </para>
/// </remarks>
public Skeleton GetSkeleton() => Jolt.PInvoke.SkeletonPose_GetSkeleton(this);
/// <summary>
/// <para>
/// Extra offset applied to the root (and therefore also to all of its children)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L33">Jolt/Skeleton/SkeletonPose.h:33</see>
/// <br/>
/// <c>void SetRootOffset(RVec3Arg inOffset)</c>
/// </para>
/// </summary>
public void SetRootOffset(float3 offset) => Jolt.PInvoke.SkeletonPose_SetRootOffset(this, offset);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L34">Jolt/Skeleton/SkeletonPose.h:34</see>
/// <br/>
/// <c>RVec3 GetRootOffset() const</c>
/// </para>
/// </summary>
public float3 GetRootOffset() => Jolt.PInvoke.SkeletonPose_GetRootOffset(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L38">Jolt/Skeleton/SkeletonPose.h:38</see>
/// <br/>
/// <c>uint GetJointCount() const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// @name Properties of the joints
/// @{
/// </code>
/// </remarks>
public uint GetJointCount() => Jolt.PInvoke.SkeletonPose_GetJointCount(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L40">Jolt/Skeleton/SkeletonPose.h:40</see>
/// <br/>
/// <c>JointStateVector &amp; GetJoints()</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<SkeletalAnimation.JointState> GetJoints()
{
Jolt.PInvoke.SkeletonPose_GetJoints(this, out var _outResult);
return new ReadOnlySpan<SkeletalAnimation.JointState>(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L42">Jolt/Skeleton/SkeletonPose.h:42</see>
/// <br/>
/// <c>JointState &amp; GetJoint(int inJoint)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Writes value into the element GetJoint returns, in place. The C++ getter hands out a reference; the C#
/// GetJoint can only return a copy, so this is how an edit reaches the object.
/// </para>
/// </remarks>
public void SetJoint(int joint, in SkeletalAnimation.JointState value)
{
Jolt.PInvoke.SkeletonPose_SetJoint(this, joint, in value, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(joint),
joint,
"Expected an index below the number of joints in the pose."
);
}
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L48">Jolt/Skeleton/SkeletonPose.h:48</see>
/// <br/>
/// <c>Mat44Vector &amp; GetJointMatrices()</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
/// </para>
/// </remarks>
[return: Brutal.Attributes.Fixed]
public unsafe Span<float4x4> GetJointMatrices()
{
Jolt.PInvoke.SkeletonPose_GetJointMatrices(this, out var _outResult);
return new Span<float4x4>((void*)_outResult.Data, checked((int)_outResult.Count));
}
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L49">Jolt/Skeleton/SkeletonPose.h:49</see>
/// <br/>
/// <c>const Mat44 &amp; GetJointMatrix(int inJoint) const</c>
/// </para>
/// </summary>
public float4x4 GetJointMatrix(int joint)
{
var _result = Jolt.PInvoke.SkeletonPose_GetJointMatrix(this, joint, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(joint),
joint,
"Expected an index below the number of joint matrices."
);
return _result;
}
/// <summary>
/// <para>
/// Convert the joint states to joint matrices
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L54">Jolt/Skeleton/SkeletonPose.h:54</see>
/// <br/>
/// <c>void CalculateJointMatrices()</c>
/// </para>
/// </summary>
public void CalculateJointMatrices() => Jolt.PInvoke.SkeletonPose_CalculateJointMatrices(this);
/// <summary>
/// <para>
/// Convert joint matrices to joint states
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L57">Jolt/Skeleton/SkeletonPose.h:57</see>
/// <br/>
/// <c>void CalculateJointStates()</c>
/// </para>
/// </summary>
public void CalculateJointStates() => Jolt.PInvoke.SkeletonPose_CalculateJointStates(this);
/// <summary>
/// <para>
/// Outputs the joint matrices in local space (ensure that outMatrices has GetJointCount() elements, assumes
/// that values in GetJoints() is up to date)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L60">Jolt/Skeleton/SkeletonPose.h:60</see>
/// <br/>
/// <c>void CalculateLocalSpaceJointMatrices(Mat44 *outMatrices) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// matrices must hold exactly one element per joint in the pose - the native count is read from the object
/// itself and a span that doesn't match it throws ArgumentOutOfRangeException. The span is only used for
/// the duration of the call.
/// </para>
/// </remarks>
public unsafe void CalculateLocalSpaceJointMatrices(Span<float4x4> matrices)
{
fixed (float4x4* matrices_fixed = matrices)
{
Jolt.PInvoke.SkeletonPose_CalculateLocalSpaceJointMatrices(
this,
matrices_fixed,
(uint)matrices.Length,
out var _bufferCheck
);
if (_bufferCheck == 1)
throw new ArgumentOutOfRangeException(
nameof(matrices),
matrices.Length,
"Expected one element per joint in the pose."
);
}
}
/// <summary>
/// <para>
/// Draw current pose
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletonPose.h#L72">Jolt/Skeleton/SkeletonPose.h:72</see>
/// <br/>
/// <c>void Draw(const DrawSettings &amp;inDrawSettings, DebugRenderer *inRenderer, RMat44Arg inOffset = RMat44::sIdentity()) const</c>
/// </para>
/// </summary>
public void Draw(in SkeletonPose.DrawSettings drawSettings, DebugRenderer renderer, in float4x4 offset) =>
Jolt.PInvoke.SkeletonPose_Draw(this, in drawSettings, renderer, in offset);
public void Dispose() => Jolt.PInvoke.SkeletonPose_Destroy(this);
}
}