//
// 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
{
///
///
/// Base class settings to construct a compound shape
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:17
///
/// class CompoundShapeSettings : public ShapeSettings
///
///
[InteropHandle]
public readonly partial struct CompoundShapeSettings : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:31
///
/// struct SubShapeSettings
///
///
[StructLayout(LayoutKind.Explicit, Size = 64)]
public partial struct SubShapeSettings
{
///
///
/// Sub shape (either this or mShapePtr needs to be filled up)
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:35
///
/// RefConst<ShapeSettings> mShape
///
///
[FieldOffset(0)]
public ShapeSettings Shape;
///
///
/// Sub shape (either this or mShape needs to be filled up)
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:36
///
/// RefConst<Shape> mShapePtr
///
///
[FieldOffset(8)]
public Shape ShapePtr;
///
///
/// Position of the sub shape
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:37
///
/// Vec3 mPosition
///
///
[FieldOffset(16)]
public float3 Position;
///
///
/// Rotation of the sub shape
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:38
///
/// Quat mRotation
///
///
[FieldOffset(32)]
public floatQuat Rotation;
///
///
/// User data value (can be used by the application for any purpose). Note this value can be retrieved
/// through GetSubShape(...).mUserData, not through GetSubShapeUserData(...) as that returns
/// Shape::GetUserData() of the leaf shape. Use GetSubShapeIndexFromID get a shape index from a
/// SubShapeID to pass to GetSubShape.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:43
///
/// uint32 mUserData = 0
///
///
[FieldOffset(48)]
public uint UserData;
}
///
public RTTI GetRTTI() => ((ShapeSettings)this).GetRTTI();
///
public unsafe Ptr CastTo(RTTI rtti) => ((ShapeSettings)this).CastTo(rtti);
///
///
/// Add a shape to the compound.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:26
///
/// void AddShape(Vec3Arg inPosition, QuatArg inRotation, const ShapeSettings *inShape, uint32 inUserData = 0)
///
///
public void AddShape(float3 position, floatQuat rotation, ShapeSettings shape, uint userData = 0) =>
Jolt.PInvoke.CompoundShapeSettings_AddShape(this, position, rotation, shape, userData);
///
///
/// Add a shape to the compound. Variant that uses a concrete shape, which means this object cannot be
/// serialized.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:29
///
/// void AddShape(Vec3Arg inPosition, QuatArg inRotation, const Shape *inShape, uint32 inUserData = 0)
///
///
public void AddShape(float3 position, floatQuat rotation, Shape shape, uint userData = 0) =>
Jolt.PInvoke.CompoundShapeSettings_AddShape_2(this, position, rotation, shape, userData);
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/CompoundShape.h:48
///
/// SubShapes mSubShapes
///
///
///
///
/// The span is a view of the container's own storage, not a copy, so it costs nothing to take. It's only
/// valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe ReadOnlySpan GetSubShapes()
{
Jolt.PInvoke.CompoundShapeSettings_GetSubShapes(this, out var _outResult);
return new ReadOnlySpan(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
public void AddRef() => ((ShapeSettings)this).AddRef();
public void Release() => ((ShapeSettings)this).Release();
public uint GetRefCount() => ((ShapeSettings)this).GetRefCount();
public static implicit operator ShapeSettings(CompoundShapeSettings value) =>
Unsafe.BitCast(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
///
public Shape CreateShape() => ((ShapeSettings)this).CreateShape();
///
public void ClearCachedResult() => ((ShapeSettings)this).ClearCachedResult();
///
public ulong GetUserData() => ((ShapeSettings)this).GetUserData();
///
public void SetUserData(ulong value) => ((ShapeSettings)this).SetUserData(value);
}
}