mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-27 05:28:25 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
237
Brutal.Jolt/Generated/Classes/Skeleton.gen.cs
Normal file
237
Brutal.Jolt/Generated/Classes/Skeleton.gen.cs
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
// <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 that contains the joint hierarchy for a skeleton
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L17">Jolt/Skeleton/Skeleton.h:17</see>
|
||||
/// <br/>
|
||||
/// <c>class Skeleton : public RefTarget<Skeleton></c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[InteropHandle]
|
||||
public readonly partial struct Skeleton : IDisposable
|
||||
{
|
||||
public static Skeleton Create() => Jolt.PInvoke.Skeleton_Create();
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L44">Jolt/Skeleton/Skeleton.h:44</see>
|
||||
/// <br/>
|
||||
/// <c>int GetJointCount() const</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public int GetJointCount() => Jolt.PInvoke.Skeleton_GetJointCount(this);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L47">Jolt/Skeleton/Skeleton.h:47</see>
|
||||
/// <br/>
|
||||
/// <c>uint AddJoint(const string_view &inName, const string_view &inParentName = string_view())</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public unsafe uint AddJoint(RefString8 name, RefString8 parentName)
|
||||
{
|
||||
fixed (byte* parentName_fixed = parentName)
|
||||
fixed (byte* name_fixed = name)
|
||||
{
|
||||
return Jolt.PInvoke.Skeleton_AddJoint(this, name_fixed, parentName_fixed);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L48">Jolt/Skeleton/Skeleton.h:48</see>
|
||||
/// <br/>
|
||||
/// <c>uint AddJoint(const string_view &inName, int inParentIndex)</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Throws ArgumentException for parentIndex: "parentIndex must be -1 (no parent) or the index of a joint
|
||||
/// already added."
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public unsafe uint AddJoint(RefString8 name, int parentIndex)
|
||||
{
|
||||
fixed (byte* name_fixed = name)
|
||||
{
|
||||
var _result = Jolt.PInvoke.Skeleton_AddJoint_2(this, name_fixed, parentIndex, out var _bufferCheck);
|
||||
if (_bufferCheck == 1)
|
||||
throw new ArgumentException(
|
||||
"parentIndex must be -1 (no parent) or the index of a joint already added.",
|
||||
nameof(parentIndex)
|
||||
);
|
||||
return _result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Find joint by name
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L52">Jolt/Skeleton/Skeleton.h:52</see>
|
||||
/// <br/>
|
||||
/// <c>int GetJointIndex(const string_view &inName) const</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public unsafe int GetJointIndex(RefString8 name)
|
||||
{
|
||||
fixed (byte* name_fixed = name)
|
||||
{
|
||||
return Jolt.PInvoke.Skeleton_GetJointIndex(this, name_fixed);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Fill in parent joint indices based on name
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L55">Jolt/Skeleton/Skeleton.h:55</see>
|
||||
/// <br/>
|
||||
/// <c>void CalculateParentJointIndices()</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public void CalculateParentJointIndices() => Jolt.PInvoke.Skeleton_CalculateParentJointIndices(this);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Many of the algorithms that use the Skeleton class require that parent joints are in the mJoints array
|
||||
/// before their children. This function returns true if this is the case, false if not.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L59">Jolt/Skeleton/Skeleton.h:59</see>
|
||||
/// <br/>
|
||||
/// <c>bool AreJointsCorrectlyOrdered() const</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool AreJointsCorrectlyOrdered() => Jolt.PInvoke.Skeleton_AreJointsCorrectlyOrdered(this);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Saves the state of this object in binary form to inStream.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L62">Jolt/Skeleton/Skeleton.h:62</see>
|
||||
/// <br/>
|
||||
/// <c>void SaveBinaryState(StreamOut &inStream) const</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.Skeleton_SaveBinaryState(this, stream);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Restore the state of this object from inStream.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// C++:
|
||||
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Skeleton/Skeleton.h#L65">Jolt/Skeleton/Skeleton.h:65</see>
|
||||
/// <br/>
|
||||
/// <c>static SkeletonResult sRestoreFromBinaryState(StreamIn &inStream)</c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Throws JoltException with Jolt's error message when the operation fails.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static Skeleton RestoreFromBinaryState(StreamIn stream)
|
||||
{
|
||||
var _handle = Jolt.PInvoke.Skeleton_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 Skeleton.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.Skeleton_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 Skeleton RestoreFromObjectStream(ReadOnlySpan<byte> data)
|
||||
{
|
||||
fixed (byte* data_fixed = data)
|
||||
{
|
||||
var _handle = Jolt.PInvoke.Skeleton_RestoreFromObjectStream(data_fixed, (nuint)data.Length);
|
||||
if (_handle.IsNull())
|
||||
throw JoltException.FromLastError();
|
||||
return _handle;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRef() => Jolt.PInvoke.Skeleton_AddRef(this);
|
||||
|
||||
public void Release() => Jolt.PInvoke.Skeleton_Release(this);
|
||||
|
||||
public uint GetRefCount() => Jolt.PInvoke.Skeleton_GetRefCount(this);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsNull())
|
||||
return;
|
||||
Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue