//
// 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 constructs a ConvexHullShape
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:17
///
/// class ConvexHullShapeSettings final : public ConvexShapeSettings
///
///
[InteropHandle]
public readonly partial struct ConvexHullShapeSettings : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:28
///
/// explicit ConvexHullShapeSettings(const Array<Vec3> &inPoints, float inConvexRadius = cDefaultConvexRadius, const PhysicsMaterial *inMaterial = nullptr)
///
///
///
///
/// points is copied into a native container for the call; the span is only read.
///
///
public static unsafe ConvexHullShapeSettings Create(
ReadOnlySpan points,
float convexRadius = 0.05f,
PhysicsMaterial material = default
)
{
fixed (float3* points_fixed = points)
{
return Jolt.PInvoke.ConvexHullShapeSettings_Create(
points_fixed,
(nuint)points.Length,
convexRadius,
material
);
}
}
///
///
/// Default constructor for deserialization
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:23
///
/// ConvexHullShapeSettings() = default
///
///
public static ConvexHullShapeSettings Create() => Jolt.PInvoke.ConvexHullShapeSettings_Create_2();
///
public RTTI GetRTTI() => ((ShapeSettings)this).GetRTTI();
///
public unsafe Ptr CastTo(RTTI rtti) => ((ShapeSettings)this).CastTo(rtti);
///
public Shape CreateShape() => ((ShapeSettings)this).CreateShape();
///
///
/// Points to create the hull from. Note that these points don't need to be the vertices of the convex hull,
/// they can contain interior points or points on faces/edges.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:33
///
/// Array<Vec3> mPoints
///
///
///
///
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it.
///
///
public NativeArray GetPoints() =>
new NativeArray(Jolt.PInvoke.ConvexHullShapeSettings_GetPoints(this));
///
///
/// Points to create the hull from. Note that these points don't need to be the vertices of the convex hull,
/// they can contain interior points or points on faces/edges.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:33
///
/// Array<Vec3> mPoints
///
///
public unsafe void SetPoints(ReadOnlySpan value)
{
fixed (float3* value_fixed = value)
{
Jolt.PInvoke.ConvexHullShapeSettings_SetPoints(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// Convex radius as supplied by the constructor. Note that during hull creation the convex radius can be
/// made smaller if the value is too big for the hull.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:34
///
/// float mMaxConvexRadius = 0.0f
///
///
public float GetMaxConvexRadius() => Jolt.PInvoke.ConvexHullShapeSettings_GetMaxConvexRadius(this);
///
///
/// Convex radius as supplied by the constructor. Note that during hull creation the convex radius can be
/// made smaller if the value is too big for the hull.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:34
///
/// float mMaxConvexRadius = 0.0f
///
///
public void SetMaxConvexRadius(float value) =>
Jolt.PInvoke.ConvexHullShapeSettings_SetMaxConvexRadius(this, value);
///
///
/// Maximum distance between the shrunk hull + convex radius and the actual hull.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:35
///
/// float mMaxErrorConvexRadius = 0.05f
///
///
public float GetMaxErrorConvexRadius() => Jolt.PInvoke.ConvexHullShapeSettings_GetMaxErrorConvexRadius(this);
///
///
/// Maximum distance between the shrunk hull + convex radius and the actual hull.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:35
///
/// float mMaxErrorConvexRadius = 0.05f
///
///
public void SetMaxErrorConvexRadius(float value) =>
Jolt.PInvoke.ConvexHullShapeSettings_SetMaxErrorConvexRadius(this, value);
///
///
/// Points are allowed this far outside of the hull (increasing this yields a hull with less vertices). Note
/// that the actual used value can be larger if the points of the hull are far apart.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:36
///
/// float mHullTolerance = 1.0e-3f
///
///
public float GetHullTolerance() => Jolt.PInvoke.ConvexHullShapeSettings_GetHullTolerance(this);
///
///
/// Points are allowed this far outside of the hull (increasing this yields a hull with less vertices). Note
/// that the actual used value can be larger if the points of the hull are far apart.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/ConvexHullShape.h:36
///
/// float mHullTolerance = 1.0e-3f
///
///
public void SetHullTolerance(float value) => Jolt.PInvoke.ConvexHullShapeSettings_SetHullTolerance(this, value);
public void AddRef() => ((ShapeSettings)this).AddRef();
public void Release() => ((ShapeSettings)this).Release();
public uint GetRefCount() => ((ShapeSettings)this).GetRefCount();
public static implicit operator ConvexShapeSettings(ConvexHullShapeSettings value) =>
Unsafe.BitCast(value);
public static implicit operator ShapeSettings(ConvexHullShapeSettings value) =>
Unsafe.BitCast(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
///
public void SetDensity(float density) => ((ConvexShapeSettings)this).SetDensity(density);
///
public PhysicsMaterial GetMaterial() => ((ConvexShapeSettings)this).GetMaterial();
///
public void SetMaterial(PhysicsMaterial value) => ((ConvexShapeSettings)this).SetMaterial(value);
///
public float GetDensity() => ((ConvexShapeSettings)this).GetDensity();
///
public void ClearCachedResult() => ((ShapeSettings)this).ClearCachedResult();
///
public ulong GetUserData() => ((ShapeSettings)this).GetUserData();
///
public void SetUserData(ulong value) => ((ShapeSettings)this).SetUserData(value);
}
}