//
// 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/MeshShape.h:22
///
/// class MeshShapeSettings final : public ShapeSettings
///
///
///
///
/// Class that constructs a MeshShape
///
///
[InteropHandle]
public readonly partial struct MeshShapeSettings : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:71
///
/// enum class EBuildQuality
///
///
public enum EBuildQuality : int
{
///
///
/// Favor runtime performance, takes more time to build the MeshShape but performs better
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:73
///
/// FavorRuntimePerformance
///
///
FavorRuntimePerformance,
///
///
/// Favor build speed, build the tree faster but the MeshShape will be slower
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:74
///
/// FavorBuildSpeed
///
///
FavorBuildSpeed,
}
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:28
///
/// MeshShapeSettings() = default
///
///
///
///
/// Default constructor for deserialization
///
///
public static MeshShapeSettings Create() => Jolt.PInvoke.MeshShapeSettings_Create();
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:24
///
///
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public RTTI GetRTTI() => Jolt.PInvoke.MeshShapeSettings_GetRTTI(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:24
///
///
///
///
public unsafe Ptr CastTo(RTTI rTTI) => Jolt.PInvoke.MeshShapeSettings_CastTo(this, rTTI);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:35
///
/// void Sanitize()
///
///
///
///
/// Sanitize the mesh data. Remove duplicate and degenerate triangles. This is called automatically when
/// constructing the MeshShapeSettings with a list of (indexed-) triangles.
///
///
public void Sanitize() => Jolt.PInvoke.MeshShapeSettings_Sanitize(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:38
///
/// virtual ShapeResult Create() const override
///
///
///
///
/// See: ShapeSettings
///
///
/// Throws InvalidOperationException with Jolt's error message when the operation fails.
///
///
public Shape CreateShape()
{
var _handle = Jolt.PInvoke.MeshShapeSettings_CreateShape(this);
if (_handle.IsNull()) throw new InvalidOperationException(Jolt.GetLastError());
return _handle;
}
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:56
///
/// uint mMaxTrianglesPerLeaf = 8
///
///
///
///
/// Maximum number of triangles in each leaf of the axis aligned box tree. This is a balance between memory and performance. Can be in the range [1, MeshShape::MaxTrianglesPerLeaf].
/// Sensible values are between 4 (for better performance) and 8 (for less memory usage).
///
///
public uint GetMaxTrianglesPerLeaf() => Jolt.PInvoke.MeshShapeSettings_GetMaxTrianglesPerLeaf(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:56
///
/// uint mMaxTrianglesPerLeaf = 8
///
///
///
///
/// Maximum number of triangles in each leaf of the axis aligned box tree. This is a balance between memory and performance. Can be in the range [1, MeshShape::MaxTrianglesPerLeaf].
/// Sensible values are between 4 (for better performance) and 8 (for less memory usage).
///
///
public void SetMaxTrianglesPerLeaf(uint value) => Jolt.PInvoke.MeshShapeSettings_SetMaxTrianglesPerLeaf(this, value);
///
///
/// cos(5 degrees)
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:63
///
/// float mActiveEdgeCosThresholdAngle = 0.996195f
///
///
///
///
/// Cosine of the threshold angle (if the angle between the two triangles is bigger than this, the edge is active, note that a concave edge is always inactive).
/// Setting this value too small can cause ghost collisions with edges, setting it too big can cause depenetration artifacts (objects not depenetrating quickly).
/// Valid ranges are between cos(0 degrees) and cos(90 degrees). The default value is cos(5 degrees).
/// Negative values will make all edges active and causes EActiveEdgeMode::CollideOnlyWithActive to behave as EActiveEdgeMode::CollideWithAll.
/// This speeds up the build process but will require all bodies that can interact with the mesh to use BodyCreationSettings::mEnhancedInternalEdgeRemoval = true.
///
///
public float GetActiveEdgeCosThresholdAngle() => Jolt.PInvoke.MeshShapeSettings_GetActiveEdgeCosThresholdAngle(this);
///
///
/// cos(5 degrees)
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:63
///
/// float mActiveEdgeCosThresholdAngle = 0.996195f
///
///
///
///
/// Cosine of the threshold angle (if the angle between the two triangles is bigger than this, the edge is active, note that a concave edge is always inactive).
/// Setting this value too small can cause ghost collisions with edges, setting it too big can cause depenetration artifacts (objects not depenetrating quickly).
/// Valid ranges are between cos(0 degrees) and cos(90 degrees). The default value is cos(5 degrees).
/// Negative values will make all edges active and causes EActiveEdgeMode::CollideOnlyWithActive to behave as EActiveEdgeMode::CollideWithAll.
/// This speeds up the build process but will require all bodies that can interact with the mesh to use BodyCreationSettings::mEnhancedInternalEdgeRemoval = true.
///
///
public void SetActiveEdgeCosThresholdAngle(float value) => Jolt.PInvoke.MeshShapeSettings_SetActiveEdgeCosThresholdAngle(this, value);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:69
///
/// bool mPerTriangleUserData = false
///
///
///
///
/// When true, we store the user data coming from Triangle::mUserData or IndexedTriangle::mUserData in the mesh shape.
/// This can be used to store additional data like the original index of the triangle in the mesh.
/// Can be retrieved using MeshShape::GetTriangleUserData.
/// Turning this on increases the memory used by the MeshShape by roughly 25%.
///
///
public bool GetPerTriangleUserData() => Jolt.PInvoke.MeshShapeSettings_GetPerTriangleUserData(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:69
///
/// bool mPerTriangleUserData = false
///
///
///
///
/// When true, we store the user data coming from Triangle::mUserData or IndexedTriangle::mUserData in the mesh shape.
/// This can be used to store additional data like the original index of the triangle in the mesh.
/// Can be retrieved using MeshShape::GetTriangleUserData.
/// Turning this on increases the memory used by the MeshShape by roughly 25%.
///
///
public void SetPerTriangleUserData(bool value) => Jolt.PInvoke.MeshShapeSettings_SetPerTriangleUserData(this, value);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:78
///
/// EBuildQuality mBuildQuality = EBuildQuality::FavorRuntimePerformance
///
///
///
///
/// Determines the quality of the tree building process.
///
///
public MeshShapeSettings.EBuildQuality GetBuildQuality() => Jolt.PInvoke.MeshShapeSettings_GetBuildQuality(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MeshShape.h:78
///
/// EBuildQuality mBuildQuality = EBuildQuality::FavorRuntimePerformance
///
///
///
///
/// Determines the quality of the tree building process.
///
///
public void SetBuildQuality(MeshShapeSettings.EBuildQuality value) => Jolt.PInvoke.MeshShapeSettings_SetBuildQuality(this, value);
public void AddRef() => Jolt.PInvoke.MeshShapeSettings_AddRef(this);
public void Release() => Jolt.PInvoke.MeshShapeSettings_Release(this);
public uint GetRefCount() => Jolt.PInvoke.MeshShapeSettings_GetRefCount(this);
public static implicit operator ShapeSettings(MeshShapeSettings value) => Jolt.PInvoke.MeshShapeSettings_AsShapeSettings(value);
public void Dispose()
{
if (IsNull()) return;
Release();
}
}
}