mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
187 lines
8.1 KiB
C#
187 lines
8.1 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>
|
|
/// Implementation of the StateRecorder class that uses a stringstream as underlying store and that implements
|
|
/// checking if the state doesn't change upon reading
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/StateRecorderImpl.h#L12">Jolt/Physics/StateRecorderImpl.h:12</see>
|
|
/// <br/>
|
|
/// <c>class StateRecorderImpl final : public StateRecorder</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct StateRecorderImpl : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Constructor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/StateRecorderImpl.h#L16">Jolt/Physics/StateRecorderImpl.h:16</see>
|
|
/// <br/>
|
|
/// <c>StateRecorderImpl() = default</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static StateRecorderImpl Create() => Jolt.PInvoke.StateRecorderImpl_Create();
|
|
|
|
/// <inheritdoc cref="StreamOut.WriteBytes(Ptr, ByteSize)"/>
|
|
public unsafe void WriteBytes(Ptr data, ByteSize numBytes) => ((StreamOut)this).WriteBytes(data, numBytes);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Rewind the stream for reading
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/StateRecorderImpl.h#L23">Jolt/Physics/StateRecorderImpl.h:23</see>
|
|
/// <br/>
|
|
/// <c>void Rewind()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Resets only the read position; it does not discard previously written data. To reuse a recorder for a
|
|
/// fresh save, call Clear() before writing to it, not Rewind().
|
|
/// </para>
|
|
/// </remarks>
|
|
public void Rewind() => Jolt.PInvoke.StateRecorderImpl_Rewind(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Clear the stream for reuse
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/StateRecorderImpl.h#L26">Jolt/Physics/StateRecorderImpl.h:26</see>
|
|
/// <br/>
|
|
/// <c>void Clear()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Resets both the read and write positions, discarding any previously recorded state. The sequence for
|
|
/// reusing a recorder is Clear(), then write the new state, then Rewind(), then RestoreState.
|
|
/// </para>
|
|
/// </remarks>
|
|
public void Clear() => Jolt.PInvoke.StateRecorderImpl_Clear(this);
|
|
|
|
/// <inheritdoc cref="StreamIn.ReadBytes(Ptr, ByteSize)"/>
|
|
public unsafe void ReadBytes(Ptr data, ByteSize numBytes) => ((StreamIn)this).ReadBytes(data, numBytes);
|
|
|
|
/// <inheritdoc cref="StreamIn.IsEOF()"/>
|
|
public bool IsEOF() => ((StreamIn)this).IsEOF();
|
|
|
|
/// <inheritdoc cref="StreamIn.IsFailed()"/>
|
|
public bool IsFailed() => ((StreamIn)this).IsFailed();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Compare this state with a reference state and ensure they are the same
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/StateRecorderImpl.h#L38">Jolt/Physics/StateRecorderImpl.h:38</see>
|
|
/// <br/>
|
|
/// <c>bool IsEqual(StateRecorderImpl &inReference)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsEqual(StateRecorderImpl reference) => Jolt.PInvoke.StateRecorderImpl_IsEqual(this, reference);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get size of the binary data in bytes
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/StateRecorderImpl.h#L44">Jolt/Physics/StateRecorderImpl.h:44</see>
|
|
/// <br/>
|
|
/// <c>size_t GetDataSize()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public nuint GetDataSize() => Jolt.PInvoke.StateRecorderImpl_GetDataSize(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Copies the recorded state into buffer and returns the total size of the state. Nothing is copied 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. The recorder is left exactly as it was found - the read
|
|
/// position doesn't move - so this is safe to call part-way through a restore.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe ByteSize GetData(Span<byte> buffer)
|
|
{
|
|
fixed (byte* buffer_fixed = buffer)
|
|
{
|
|
return (ByteSize)Jolt.PInvoke.StateRecorderImpl_GetDataBytes(this, buffer_fixed, (nuint)buffer.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Writes a block of bytes into the stream (this is the load side of GetData). It appends at the current
|
|
/// put position, so call Clear() first if the recorder already holds a previous save, then Rewind() before
|
|
/// reading the new state back with RestoreState.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void WriteBytes(ReadOnlySpan<byte> data)
|
|
{
|
|
fixed (byte* data_fixed = data)
|
|
{
|
|
Jolt.PInvoke.StateRecorderImpl_WriteByteSpan(this, data_fixed, (nuint)data.Length);
|
|
}
|
|
}
|
|
|
|
public static implicit operator StateRecorder(StateRecorderImpl value) =>
|
|
Unsafe.BitCast<StateRecorderImpl, StateRecorder>(value);
|
|
|
|
public static implicit operator StreamIn(StateRecorderImpl value) =>
|
|
Unsafe.BitCast<StateRecorderImpl, StreamIn>(value);
|
|
|
|
public static implicit operator StreamOut(StateRecorderImpl value) =>
|
|
Jolt.PInvoke.StateRecorderImpl_AsStreamOut(value);
|
|
|
|
public void Dispose() => Jolt.PInvoke.StateRecorderImpl_Destroy(this);
|
|
|
|
/// <inheritdoc cref="StateRecorder.SetValidating(bool)"/>
|
|
public void SetValidating(bool validating) => ((StateRecorder)this).SetValidating(validating);
|
|
|
|
/// <inheritdoc cref="StateRecorder.IsValidating()"/>
|
|
public bool IsValidating() => ((StateRecorder)this).IsValidating();
|
|
|
|
/// <inheritdoc cref="StateRecorder.SetIsLastPart(bool)"/>
|
|
public void SetIsLastPart(bool isLastPart) => ((StateRecorder)this).SetIsLastPart(isLastPart);
|
|
|
|
/// <inheritdoc cref="StateRecorder.IsLastPart()"/>
|
|
public bool IsLastPart() => ((StateRecorder)this).IsLastPart();
|
|
|
|
/// <inheritdoc cref="StreamIn.Read(out float3)"/>
|
|
public void Read(out float3 vec) => ((StreamIn)this).Read(out vec);
|
|
|
|
/// <inheritdoc cref="StreamIn.Read(out double3)"/>
|
|
public void Read(out double3 vec) => ((StreamIn)this).Read(out vec);
|
|
|
|
/// <inheritdoc cref="StreamIn.Read(out double4x4)"/>
|
|
public void Read(out double4x4 vec) => ((StreamIn)this).Read(out vec);
|
|
|
|
/// <inheritdoc cref="StreamOut.Write(float3)"/>
|
|
public void Write(float3 vec) => ((StreamOut)this).Write(vec);
|
|
|
|
/// <inheritdoc cref="StreamOut.Write(double3)"/>
|
|
public void Write(double3 vec) => ((StreamOut)this).Write(vec);
|
|
|
|
/// <inheritdoc cref="StreamOut.Write(in double4x4)"/>
|
|
public void Write(in double4x4 vec) => ((StreamOut)this).Write(in vec);
|
|
}
|
|
}
|