//
// 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
{
///
///
/// Class that records the state of a physics system. Can be used to check if the simulation is deterministic by
/// putting the recorder in validation mode. Can be used to restore the state to an earlier point in time. Note
/// that only the state that is modified by the simulation is saved, configuration settings like body friction
/// or restitution, motion quality etc. are not saved and need to be saved by the user if desired.
///
///
/// C++:
/// Jolt/Physics/StateRecorder.h:109
///
/// class StateRecorder : public StreamIn, public StreamOut
///
///
[InteropHandle]
public readonly partial struct StateRecorder
{
///
///
/// Sets the stream in validation mode. In this case the physics system ensures that before it calls
/// ReadBytes that it will ensure that those bytes contain the current state. This makes it possible to step
/// and save the state, restore to the previous step and step again and when the recorded state is not the
/// same it can restore the expected state and any byte that changes due to a ReadBytes function can be
/// caught to find out which part of the simulation is not deterministic. Note that validation only works
/// when saving the full state of the simulation (EStateRecorderState::All, StateRecorderFilter == nullptr).
///
///
/// C++:
/// Jolt/Physics/StateRecorder.h:121
///
/// void SetValidating(bool inValidating)
///
///
public void SetValidating(bool validating) => Jolt.PInvoke.StateRecorder_SetValidating(this, validating);
///
///
/// C++:
/// Jolt/Physics/StateRecorder.h:122
///
/// bool IsValidating() const
///
///
public bool IsValidating() => Jolt.PInvoke.StateRecorder_IsValidating(this);
///
///
/// This allows splitting the state in multiple parts. While restoring, only the last part should have this
/// flag set to true. Note that you should ensure that the different parts contain information for disjoint
/// sets of bodies, constraints and contacts. E.g. if you restore the same contact twice, you get undefined
/// behavior. In order to create disjoint sets you can use the StateRecorderFilter. Note that validation is
/// not compatible with restoring a simulation state in multiple parts.
///
///
/// C++:
/// Jolt/Physics/StateRecorder.h:128
///
/// void SetIsLastPart(bool inIsLastPart)
///
///
public void SetIsLastPart(bool isLastPart) => Jolt.PInvoke.StateRecorder_SetIsLastPart(this, isLastPart);
///
///
/// C++:
/// Jolt/Physics/StateRecorder.h:129
///
/// bool IsLastPart() const
///
///
public bool IsLastPart() => Jolt.PInvoke.StateRecorder_IsLastPart(this);
public static implicit operator StreamIn(StateRecorder value) => Unsafe.BitCast(value);
public static implicit operator StreamOut(StateRecorder value) => Jolt.PInvoke.StateRecorder_AsStreamOut(value);
///
public unsafe void ReadBytes(Ptr data, ByteSize numBytes) => ((StreamIn)this).ReadBytes(data, numBytes);
///
public bool IsEOF() => ((StreamIn)this).IsEOF();
///
public bool IsFailed() => ((StreamIn)this).IsFailed();
///
public void Read(out float3 vec) => ((StreamIn)this).Read(out vec);
///
public void Read(out double3 vec) => ((StreamIn)this).Read(out vec);
///
public void Read(out double4x4 vec) => ((StreamIn)this).Read(out vec);
///
public unsafe void WriteBytes(Ptr data, ByteSize numBytes) => ((StreamOut)this).WriteBytes(data, numBytes);
///
public void Write(float3 vec) => ((StreamOut)this).Write(vec);
///
public void Write(double3 vec) => ((StreamOut)this).Write(vec);
///
public void Write(in double4x4 vec) => ((StreamOut)this).Write(in vec);
}
}