//
// 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/MutableCompoundShape.h:32
///
/// class MutableCompoundShape final : public CompoundShape
///
///
///
///
/// A compound shape, sub shapes can be rotated and translated.
/// This shape is optimized for adding / removing and changing the rotation / translation of sub shapes but is less efficient in querying.
/// Shifts all child objects so that they're centered around the center of mass (which needs to be kept up to date by calling AdjustCenterOfMass).
///
/// Note: If you're using MutableCompoundShape and are querying data while modifying the shape you'll have a race condition.
/// In this case it is best to create a new MutableCompoundShape using the Clone function. You replace the shape on a body using BodyInterface::SetShape.
/// If a query is still working on the old shape, it will have taken a reference and keep the old shape alive until the query finishes.
///
/// When you modify a MutableCompoundShape, beware that the SubShapeIDs of all other shapes can change. So be careful when storing SubShapeIDs.
///
///
[InteropHandle]
public readonly partial struct MutableCompoundShape : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:163
///
/// struct Bounds
///
///
[StructLayout(LayoutKind.Explicit, Size = 96)]
public struct Bounds
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:165
///
/// Vec4 mMinX
///
///
[FieldOffset(0)]
public float4 mMinX;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:166
///
/// Vec4 mMinY
///
///
[FieldOffset(16)]
public float4 mMinY;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:167
///
/// Vec4 mMinZ
///
///
[FieldOffset(32)]
public float4 mMinZ;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:168
///
/// Vec4 mMaxX
///
///
[FieldOffset(48)]
public float4 mMaxX;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:169
///
/// Vec4 mMaxY
///
///
[FieldOffset(64)]
public float4 mMaxY;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:170
///
/// Vec4 mMaxZ
///
///
[FieldOffset(80)]
public float4 mMaxZ;
}
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:38
///
/// MutableCompoundShape()
///
///
///
///
/// Constructor
///
///
public static MutableCompoundShape Create() => Jolt.PInvoke.MutableCompoundShape_Create();
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:42
///
/// Ref<MutableCompoundShape> Clone() const
///
///
///
///
/// Clone this shape. Can be used to avoid race conditions. See the documentation of this class for more
/// information.
///
///
public MutableCompoundShape Clone() => Jolt.PInvoke.MutableCompoundShape_Clone(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:55
///
/// virtual int GetIntersectingSubShapes(const AABox &inBox, uint *outSubShapeIndices, int inMaxSubShapeIndices) const override
///
///
///
///
/// See: CompoundShape::GetIntersectingSubShapes
///
///
public unsafe int GetIntersectingSubShapes(AABox box, Ptr subShapeIndices, int maxSubShapeIndices) => Jolt.PInvoke.MutableCompoundShape_GetIntersectingSubShapes(this, box, subShapeIndices, maxSubShapeIndices);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:58
///
/// virtual int GetIntersectingSubShapes(const OrientedBox &inBox, uint *outSubShapeIndices, int inMaxSubShapeIndices) const override
///
///
///
///
/// See: CompoundShape::GetIntersectingSubShapes
///
///
public unsafe int GetIntersectingSubShapes(OrientedBox box, Ptr subShapeIndices, int maxSubShapeIndices) => Jolt.PInvoke.MutableCompoundShape_GetIntersectingSubShapes_2(this, box, subShapeIndices, maxSubShapeIndices);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:61
///
/// virtual void SaveBinaryState(StreamOut &inStream) const override
///
///
///
///
/// See Shape
///
///
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.MutableCompoundShape_SaveBinaryState(this, stream);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:77
///
/// uint AddShape(Vec3Arg inPosition, QuatArg inRotation, const Shape *inShape, uint32 inUserData = 0, uint inIndex = UINT_MAX)
///
///
///
///
/// Adding a new shape.
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
/// @param inPosition The position of the new shape
/// @param inRotation The orientation of the new shape
/// @param inShape The shape to add
/// @param inUserData User data that will be stored with the shape and can be retrieved using GetCompoundUserData
/// @param inIndex Index where to insert the shape, UINT_MAX to add to the end
/// @return The index of the newly added shape
///
///
public uint AddShape(float3 position, floatQuat rotation, Shape shape, uint userData, uint index) => Jolt.PInvoke.MutableCompoundShape_AddShape(this, position, rotation, shape, userData, index);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:81
///
/// void RemoveShape(uint inIndex)
///
///
///
///
/// Remove a shape by index.
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
///
///
public void RemoveShape(uint index) => Jolt.PInvoke.MutableCompoundShape_RemoveShape(this, index);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:85
///
/// void ModifyShape(uint inIndex, Vec3Arg inPosition, QuatArg inRotation)
///
///
///
///
/// Modify the position / orientation of a shape.
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
///
///
public void ModifyShape(uint index, float3 position, floatQuat rotation) => Jolt.PInvoke.MutableCompoundShape_ModifyShape(this, index, position, rotation);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:89
///
/// void ModifyShape(uint inIndex, Vec3Arg inPosition, QuatArg inRotation, const Shape *inShape)
///
///
///
///
/// Modify the position / orientation and shape at the same time.
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
///
///
public void ModifyShape(uint index, float3 position, floatQuat rotation, Shape shape) => Jolt.PInvoke.MutableCompoundShape_ModifyShape_2(this, index, position, rotation, shape);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:105
///
/// void AdjustCenterOfMass()
///
///
///
///
/// Recalculate the center of mass and shift all objects so they're centered around it
/// (this needs to be done of dynamic bodies and if the center of mass changes significantly due to adding / removing / repositioning sub shapes or else the simulation will look unnatural)
/// Note that after adjusting the center of mass of an object you need to call BodyInterface::NotifyShapeChanged and Constraint::NotifyShapeChanged on the relevant bodies / constraints.
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
///
///
public void AdjustCenterOfMass() => Jolt.PInvoke.MutableCompoundShape_AdjustCenterOfMass(this);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/MutableCompoundShape.h:110
///
/// static void sRegister()
///
///
///
///
/// Register shape functions with the registry
///
///
public static void sRegister() => Jolt.PInvoke.MutableCompoundShape_sRegister();
public void AddRef() => Jolt.PInvoke.MutableCompoundShape_AddRef(this);
public void Release() => Jolt.PInvoke.MutableCompoundShape_Release(this);
public uint GetRefCount() => Jolt.PInvoke.MutableCompoundShape_GetRefCount(this);
public static implicit operator CompoundShape(MutableCompoundShape value) => Jolt.PInvoke.MutableCompoundShape_AsCompoundShape(value);
public static implicit operator Shape(MutableCompoundShape value) => Jolt.PInvoke.MutableCompoundShape_AsShape(value);
public void Dispose()
{
if (IsNull()) return;
Release();
}
}
}