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

237 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>
/// This structure describes the surface of (part of) a shape. You should inherit from it to define additional
/// information that is interesting for the simulation. The 2 materials involved in a contact could be used to
/// decide which sound or particle effects to play.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L22">Jolt/Physics/Collision/PhysicsMaterial.h:22</see>
/// <br/>
/// <c>class PhysicsMaterial : public SerializableObject, public RefTarget&lt;PhysicsMaterial&gt;</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// This structure describes the surface of (part of) a shape. You should inherit from it to define additional
/// information that is interesting for the simulation. The 2 materials involved in a contact could be used
/// to decide which sound or particle effects to play.
///
/// If you inherit from this material, don't forget to create a suitable default material in sDefault
/// </code>
/// </remarks>
[InteropHandle]
public readonly partial struct PhysicsMaterial : IDisposable
{
/// <summary>
/// <para>
/// Constructor
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L28">Jolt/Physics/Collision/PhysicsMaterial.h:28</see>
/// <br/>
/// <c>PhysicsMaterial() = default</c>
/// </para>
/// </summary>
public static PhysicsMaterial Create() => Jolt.PInvoke.PhysicsMaterial_Create();
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L24">Jolt/Physics/Collision/PhysicsMaterial.h:24</see>
/// <br/>
/// <c></c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle is borrowed from its owner; don't Dispose it.
/// </para>
/// </remarks>
public RTTI GetRTTI() => Jolt.PInvoke.PhysicsMaterial_GetRTTI(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L24">Jolt/Physics/Collision/PhysicsMaterial.h:24</see>
/// <br/>
/// <c></c>
/// </para>
/// </summary>
public unsafe Ptr CastTo(RTTI rtti) => Jolt.PInvoke.PhysicsMaterial_CastTo(this, rtti);
/// <summary>
/// <para>
/// Properties
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L35">Jolt/Physics/Collision/PhysicsMaterial.h:35</see>
/// <br/>
/// <c>virtual const char * GetDebugName() const</c>
/// </para>
/// </summary>
public unsafe RefString8 GetDebugName() => (Ptr<byte>)Jolt.PInvoke.PhysicsMaterial_GetDebugName(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L36">Jolt/Physics/Collision/PhysicsMaterial.h:36</see>
/// <br/>
/// <c>virtual Color GetDebugColor() const</c>
/// </para>
/// </summary>
public uint GetDebugColor() => Jolt.PInvoke.PhysicsMaterial_GetDebugColor(this);
/// <summary>
/// <para>
/// Saves the contents of the material in binary form to inStream.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L39">Jolt/Physics/Collision/PhysicsMaterial.h:39</see>
/// <br/>
/// <c>virtual void SaveBinaryState(StreamOut &amp;inStream) const</c>
/// </para>
/// </summary>
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.PhysicsMaterial_SaveBinaryState(this, stream);
/// <summary>
/// <para>
/// Creates a PhysicsMaterial of the correct type and restores its contents from the binary stream inStream.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L44">Jolt/Physics/Collision/PhysicsMaterial.h:44</see>
/// <br/>
/// <c>static PhysicsMaterialResult sRestoreFromBinaryState(StreamIn &amp;inStream)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Throws JoltException with Jolt's error message when the operation fails.
/// </para>
/// </remarks>
public static PhysicsMaterial RestoreFromBinaryState(StreamIn stream)
{
var _handle = Jolt.PInvoke.PhysicsMaterial_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 PhysicsMaterial.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.PhysicsMaterial_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 PhysicsMaterial RestoreFromObjectStream(ReadOnlySpan<byte> data)
{
fixed (byte* data_fixed = data)
{
var _handle = Jolt.PInvoke.PhysicsMaterial_RestoreFromObjectStream(data_fixed, (nuint)data.Length);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
}
/// <summary>
/// <para>
/// Default material that is used when a shape has no materials defined
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L32">Jolt/Physics/Collision/PhysicsMaterial.h:32</see>
/// <br/>
/// <c>static RefConst&lt;PhysicsMaterial&gt; sDefault</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle carries its own reference; Dispose it once when you're done.
/// </para>
/// </remarks>
public static PhysicsMaterial GetDefault() => Jolt.PInvoke.PhysicsMaterial_GetDefault();
/// <summary>
/// <para>
/// Default material that is used when a shape has no materials defined
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/PhysicsMaterial.h#L32">Jolt/Physics/Collision/PhysicsMaterial.h:32</see>
/// <br/>
/// <c>static RefConst&lt;PhysicsMaterial&gt; sDefault</c>
/// </para>
/// </summary>
public static void SetDefault(PhysicsMaterial value) => Jolt.PInvoke.PhysicsMaterial_SetDefault(value);
public void AddRef() => Jolt.PInvoke.PhysicsMaterial_AddRef(this);
public void Release() => Jolt.PInvoke.PhysicsMaterial_Release(this);
public uint GetRefCount() => Jolt.PInvoke.PhysicsMaterial_GetRefCount(this);
public void Dispose()
{
if (IsNull())
return;
Release();
}
}
}