//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:146
///
/// class ShapeSettings : public SerializableObject, public RefTarget<ShapeSettings>
///
///
///
///
/// Class that can construct shapes and that is serializable using the ObjectStream system.
/// Can be used to store shape data in 'uncooked' form (i.e. in a form that is still human readable and authorable).
/// Once the shape has been created using the Create() function, the data will be moved into the Shape class
/// in a form that is optimized for collision detection. After this, the ShapeSettings object is no longer needed
/// and can be destroyed. Each shape class has a derived class of the ShapeSettings object to store shape specific
/// data.
///
///
[InteropHandle]
public readonly partial struct ShapeSettings : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:148
///
///
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public RTTI GetRTTI() => Jolt.PInvoke.ShapeSettings_GetRTTI(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:148
///
///
///
///
public unsafe Ptr CastTo(RTTI rTTI) => Jolt.PInvoke.ShapeSettings_CastTo(this, rTTI);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:154
///
/// virtual ShapeResult Create() const = 0
///
///
///
///
/// Create a shape according to the settings specified by this object.
///
///
/// Throws InvalidOperationException with Jolt's error message when the operation fails.
///
///
public Shape CreateShape()
{
var _handle = Jolt.PInvoke.ShapeSettings_CreateShape(this);
if (_handle.IsNull()) throw new InvalidOperationException(Jolt.GetLastError());
return _handle;
}
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:158
///
/// void ClearCachedResult()
///
///
///
///
/// When creating a shape, the result is cached so that calling Create() again will return the same shape.
/// If you make changes to the ShapeSettings you need to call this function to clear the cached result to allow Create() to build a new shape.
///
///
public void ClearCachedResult() => Jolt.PInvoke.ShapeSettings_ClearCachedResult(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:161
///
/// uint64 mUserData = 0
///
///
///
///
/// User data (to be used freely by the application)
///
///
public ulong GetUserData() => Jolt.PInvoke.ShapeSettings_GetUserData(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/Shape.h:161
///
/// uint64 mUserData = 0
///
///
///
///
/// User data (to be used freely by the application)
///
///
public void SetUserData(ulong value) => Jolt.PInvoke.ShapeSettings_SetUserData(this, value);
public void AddRef() => Jolt.PInvoke.ShapeSettings_AddRef(this);
public void Release() => Jolt.PInvoke.ShapeSettings_Release(this);
public uint GetRefCount() => Jolt.PInvoke.ShapeSettings_GetRefCount(this);
public void Dispose()
{
if (IsNull()) return;
Release();
}
}
}