mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
242 lines
11 KiB
C#
242 lines
11 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>
|
|
/// Resource for a skinned animation
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L18">Jolt/Skeleton/SkeletalAnimation.h:18</see>
|
|
/// <br/>
|
|
/// <c>class SkeletalAnimation : public RefTarget<SkeletalAnimation></c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct SkeletalAnimation : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Contains the current state of a joint, a local space transformation relative to its parent joint
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L24">Jolt/Skeleton/SkeletalAnimation.h:24</see>
|
|
/// <br/>
|
|
/// <c>class JointState</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
|
public partial struct JointState
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Local space rotation of the joint
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L35">Jolt/Skeleton/SkeletalAnimation.h:35</see>
|
|
/// <br/>
|
|
/// <c>Quat mRotation = Quat::sIdentity()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(0)]
|
|
public floatQuat Rotation;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Local space translation of the joint
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L36">Jolt/Skeleton/SkeletalAnimation.h:36</see>
|
|
/// <br/>
|
|
/// <c>Vec3 mTranslation = Vec3::sZero()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(16)]
|
|
public float3 Translation;
|
|
}
|
|
|
|
public static SkeletalAnimation Create() => Jolt.PInvoke.SkeletalAnimation_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the length (in seconds) of this animation
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L63">Jolt/Skeleton/SkeletalAnimation.h:63</see>
|
|
/// <br/>
|
|
/// <c>float GetDuration() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetDuration() => Jolt.PInvoke.SkeletalAnimation_GetDuration(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Scale the size of all joints by inScale
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L66">Jolt/Skeleton/SkeletalAnimation.h:66</see>
|
|
/// <br/>
|
|
/// <c>void ScaleJoints(float inScale)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void ScaleJoints(float scale) => Jolt.PInvoke.SkeletalAnimation_ScaleJoints(this, scale);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// If the animation is looping or not. If an animation is looping, the animation will continue playing
|
|
/// after completion
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L69">Jolt/Skeleton/SkeletalAnimation.h:69</see>
|
|
/// <br/>
|
|
/// <c>void SetIsLooping(bool inIsLooping)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetIsLooping(bool isLooping) => Jolt.PInvoke.SkeletalAnimation_SetIsLooping(this, isLooping);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L70">Jolt/Skeleton/SkeletalAnimation.h:70</see>
|
|
/// <br/>
|
|
/// <c>bool IsLooping() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsLooping() => Jolt.PInvoke.SkeletalAnimation_IsLooping(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the (interpolated) joint transforms at time inTime
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L73">Jolt/Skeleton/SkeletalAnimation.h:73</see>
|
|
/// <br/>
|
|
/// <c>void Sample(float inTime, SkeletonPose &ioPose) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Sample(float time, SkeletonPose pose) => Jolt.PInvoke.SkeletalAnimation_Sample(this, time, pose);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Saves the state of this animation in binary form to inStream.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L80">Jolt/Skeleton/SkeletalAnimation.h:80</see>
|
|
/// <br/>
|
|
/// <c>void SaveBinaryState(StreamOut &inStream) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.SkeletalAnimation_SaveBinaryState(this, stream);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Restore a saved ragdoll from inStream
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/SkeletalAnimation.h#L85">Jolt/Skeleton/SkeletalAnimation.h:85</see>
|
|
/// <br/>
|
|
/// <c>static AnimationResult sRestoreFromBinaryState(StreamIn &inStream)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Throws JoltException with Jolt's error message when the operation fails.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static SkeletalAnimation RestoreFromBinaryState(StreamIn stream)
|
|
{
|
|
var _handle = Jolt.PInvoke.SkeletalAnimation_RestoreFromBinaryState(stream);
|
|
if (_handle.IsNull())
|
|
throw JoltException.FromLastError();
|
|
return _handle;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Serialises this object (and everything it references) into buffer as a Jolt object stream, and returns
|
|
/// the total size of that stream. Nothing is written past the end of the buffer, so a return value larger
|
|
/// than buffer.Length means the buffer was too small and the call should be retried with one that size -
|
|
/// passing an empty span is how you ask for the size. Each call serialises the object's current state
|
|
/// independently and retains nothing after it returns. If the object grows between the size query and the
|
|
/// fill, use the fill's returned size to retry with a larger buffer. Text streams are human-readable and
|
|
/// portable; binary ones are smaller. Read one back with SkeletalAnimation.RestoreFromObjectStream. Throws
|
|
/// JoltException with Jolt's error message when the object can't be written, and
|
|
/// ArgumentOutOfRangeException when streamType is neither Text nor Binary.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe ByteSize SaveObjectStream(Span<byte> buffer, ObjectStreamType streamType = ObjectStreamType.Text)
|
|
{
|
|
fixed (byte* buffer_fixed = buffer)
|
|
{
|
|
if (streamType is not (ObjectStreamType.Text or ObjectStreamType.Binary))
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(streamType),
|
|
streamType,
|
|
"Not an object stream format."
|
|
);
|
|
var _size = Jolt.PInvoke.SkeletalAnimation_SaveObjectStream(
|
|
this,
|
|
buffer_fixed,
|
|
(nuint)buffer.Length,
|
|
streamType
|
|
);
|
|
if (_size == 0)
|
|
throw JoltException.FromLastError();
|
|
return (ByteSize)_size;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Reads back an object stream written by SaveObjectStream (or by Jolt's own tools - the .tof and .bof
|
|
/// asset files), in either the text or the binary format: the stream's header says which. The factory has
|
|
/// to be up and RegisterTypes() called first, since class names are resolved through it. A stream that
|
|
/// isn't an object stream, is a different version, or holds a different type throws JoltException with
|
|
/// Jolt's error message. Truncation is NOT reliably caught: Jolt's reader treats running out of data as a
|
|
/// normal end of stream, so a stream cut off after the main object was read comes back as an object whose
|
|
/// unresolved references were silently set to null - code reading untrusted input has to validate what it
|
|
/// got. The returned handle is yours - it carries its own reference, so Dispose it once when you are done
|
|
/// with it.
|
|
/// </para>
|
|
/// </summary>
|
|
public static unsafe SkeletalAnimation RestoreFromObjectStream(ReadOnlySpan<byte> data)
|
|
{
|
|
fixed (byte* data_fixed = data)
|
|
{
|
|
var _handle = Jolt.PInvoke.SkeletalAnimation_RestoreFromObjectStream(data_fixed, (nuint)data.Length);
|
|
if (_handle.IsNull())
|
|
throw JoltException.FromLastError();
|
|
return _handle;
|
|
}
|
|
}
|
|
|
|
public void AddRef() => Jolt.PInvoke.SkeletalAnimation_AddRef(this);
|
|
|
|
public void Release() => Jolt.PInvoke.SkeletalAnimation_Release(this);
|
|
|
|
public uint GetRefCount() => Jolt.PInvoke.SkeletalAnimation_GetRefCount(this);
|
|
|
|
public void Dispose()
|
|
{
|
|
if (IsNull())
|
|
return;
|
|
Release();
|
|
}
|
|
}
|
|
}
|