//
// 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
{
///
///
/// A compound shape, sub shapes can be rotated and translated. Sub shapes cannot be modified once the shape is
/// constructed. Shifts all child objects so that they're centered around the center of mass.
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:33
///
/// class StaticCompoundShape final : public CompoundShape
///
///
[InteropHandle]
public readonly partial struct StaticCompoundShape : IDisposable
{
///
///
/// Node structure
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:119
///
/// struct Node
///
///
[StructLayout(LayoutKind.Explicit, Size = 64)]
public partial struct Node
{
///
///
/// 4 child bounding boxes
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:124
///
/// HalfFloat mBoundsMinX[4]
///
///
[FieldOffset(0)]
public ushort_4 BoundsMinX;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:125
///
/// HalfFloat mBoundsMinY[4]
///
///
[FieldOffset(8)]
public ushort_4 BoundsMinY;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:126
///
/// HalfFloat mBoundsMinZ[4]
///
///
[FieldOffset(16)]
public ushort_4 BoundsMinZ;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:127
///
/// HalfFloat mBoundsMaxX[4]
///
///
[FieldOffset(24)]
public ushort_4 BoundsMaxX;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:128
///
/// HalfFloat mBoundsMaxY[4]
///
///
[FieldOffset(32)]
public ushort_4 BoundsMaxY;
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:129
///
/// HalfFloat mBoundsMaxZ[4]
///
///
[FieldOffset(40)]
public ushort_4 BoundsMaxZ;
///
///
/// 4 child node properties
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:130
///
/// uint32 mNodeProperties[4]
///
///
[FieldOffset(48)]
public uint_4 NodeProperties;
}
///
///
/// Constructor
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:39
///
/// StaticCompoundShape()
///
///
public static StaticCompoundShape Create() => Jolt.PInvoke.StaticCompoundShape_Create();
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:40
///
/// StaticCompoundShape(const StaticCompoundShapeSettings &inSettings, TempAllocator &inTempAllocator, ShapeResult &outResult)
///
///
public static StaticCompoundShape Create(StaticCompoundShapeSettings settings, TempAllocator tempAllocator)
{
var _handle = Jolt.PInvoke.StaticCompoundShape_Create_2(settings, tempAllocator);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
///
public bool CastRay(in RayCast ray, SubShapeIDCreator subShapeIDCreator, ref RayCastResult hit) =>
((Shape)this).CastRay(in ray, subShapeIDCreator, ref hit);
///
public unsafe uint CastRay(
in RayCast ray,
RayCastSettings rayCastSettings,
SubShapeIDCreator subShapeIDCreator,
Span results,
out uint totalHits,
ShapeFilter shapeFilter = default
) => ((Shape)this).CastRay(in ray, rayCastSettings, subShapeIDCreator, results, out totalHits, shapeFilter);
///
public bool CastRayClosest(
in RayCast ray,
RayCastSettings rayCastSettings,
SubShapeIDCreator subShapeIDCreator,
out RayCastResult result,
ShapeFilter shapeFilter = default
) => ((Shape)this).CastRayClosest(in ray, rayCastSettings, subShapeIDCreator, out result, shapeFilter);
///
public unsafe uint CollidePoint(
float3 point,
SubShapeIDCreator subShapeIDCreator,
Span results,
out uint totalHits,
ShapeFilter shapeFilter = default
) => ((Shape)this).CollidePoint(point, subShapeIDCreator, results, out totalHits, shapeFilter);
///
public NativeHandleArray CollectTransformedShapes(
in AABox box,
float3 positionCOM,
floatQuat rotation,
float3 scale,
SubShapeIDCreator subShapeIDCreator,
ShapeFilter shapeFilter
) =>
((Shape)this).CollectTransformedShapes(
in box,
positionCOM,
rotation,
scale,
subShapeIDCreator,
shapeFilter
);
///
public unsafe int GetIntersectingSubShapes(in AABox box, Span subShapeIndices) =>
((CompoundShape)this).GetIntersectingSubShapes(in box, subShapeIndices);
///
public unsafe int GetIntersectingSubShapes(OrientedBox box, Span subShapeIndices) =>
((CompoundShape)this).GetIntersectingSubShapes(box, subShapeIndices);
///
public void SaveBinaryState(StreamOut stream) => ((Shape)this).SaveBinaryState(stream);
///
public Shape.Stats GetStats() => ((Shape)this).GetStats();
///
///
/// Register shape functions with the registry
///
///
/// C++:
/// Jolt/Physics/Collision/Shape/StaticCompoundShape.h:65
///
/// static void sRegister()
///
///
public static void Register() => Jolt.PInvoke.StaticCompoundShape_Register();
public void AddRef() => ((Shape)this).AddRef();
public void Release() => ((Shape)this).Release();
public uint GetRefCount() => ((Shape)this).GetRefCount();
public static implicit operator CompoundShape(StaticCompoundShape value) =>
Unsafe.BitCast(value);
public static implicit operator Shape(StaticCompoundShape value) =>
Unsafe.BitCast(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
///
[return: Brutal.Attributes.Fixed]
public unsafe ReadOnlySpan GetSubShapes() => ((CompoundShape)this).GetSubShapes();
///
public uint GetNumSubShapes() => ((CompoundShape)this).GetNumSubShapes();
///
public CompoundShape.SubShape GetSubShape(uint idx) => ((CompoundShape)this).GetSubShape(idx);
///
public uint GetCompoundUserData(uint idx) => ((CompoundShape)this).GetCompoundUserData(idx);
///
public void SetCompoundUserData(uint idx, uint userData) =>
((CompoundShape)this).SetCompoundUserData(idx, userData);
///
public bool IsSubShapeIDValid(uint subShapeID) => ((CompoundShape)this).IsSubShapeIDValid(subShapeID);
///
public uint GetSubShapeIndexFromID(uint subShapeID, out uint remainder) =>
((CompoundShape)this).GetSubShapeIndexFromID(subShapeID, out remainder);
///
public SubShapeIDCreator GetSubShapeIDFromIndex(int idx, SubShapeIDCreator parentSubShapeID) =>
((CompoundShape)this).GetSubShapeIDFromIndex(idx, parentSubShapeID);
///
public ShapeType GetShapeType() => ((Shape)this).GetShapeType();
///
public ShapeSubType GetSubType() => ((Shape)this).GetSubType();
///
public ulong GetUserData() => ((Shape)this).GetUserData();
///
public void SetUserData(ulong userData) => ((Shape)this).SetUserData(userData);
///
public bool MustBeStatic() => ((Shape)this).MustBeStatic();
///
public float3 GetCenterOfMass() => ((Shape)this).GetCenterOfMass();
///
public AABox GetLocalBounds() => ((Shape)this).GetLocalBounds();
///
public uint GetSubShapeIDBitsRecursive() => ((Shape)this).GetSubShapeIDBitsRecursive();
///
public AABox GetWorldSpaceBounds(in float4x4 centerOfMassTransform, float3 scale) =>
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
///
public AABox GetWorldSpaceBounds(in double4x4 centerOfMassTransform, float3 scale) =>
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
///
public float GetInnerRadius() => ((Shape)this).GetInnerRadius();
///
public MassProperties GetMassProperties() => ((Shape)this).GetMassProperties();
///
public Shape GetLeafShape(uint subShapeID, out uint remainder) =>
((Shape)this).GetLeafShape(subShapeID, out remainder);
///
public PhysicsMaterial GetMaterial(uint subShapeID) => ((Shape)this).GetMaterial(subShapeID);
///
public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) =>
((Shape)this).GetSurfaceNormal(subShapeID, localSurfacePosition);
///
public void GetSupportingFace(
uint subShapeID,
float3 direction,
float3 scale,
in float4x4 centerOfMassTransform,
out StaticArrayVec3_32 vertices
) => ((Shape)this).GetSupportingFace(subShapeID, direction, scale, in centerOfMassTransform, out vertices);
///
public ulong GetSubShapeUserData(uint subShapeID) => ((Shape)this).GetSubShapeUserData(subShapeID);
///
public TransformedShape GetSubShapeTransformedShape(
uint subShapeID,
float3 positionCOM,
floatQuat rotation,
float3 scale,
out uint remainder
) => ((Shape)this).GetSubShapeTransformedShape(subShapeID, positionCOM, rotation, scale, out remainder);
///
public void GetSubmergedVolume(
in float4x4 centerOfMassTransform,
float3 scale,
in Plane surface,
out float totalVolume,
out float submergedVolume,
out float3 centerOfBuoyancy,
float3 baseOffset
) =>
((Shape)this).GetSubmergedVolume(
in centerOfMassTransform,
scale,
in surface,
out totalVolume,
out submergedVolume,
out centerOfBuoyancy,
baseOffset
);
///
public void Draw(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
float3 scale,
uint color,
bool useMaterialColors,
bool drawWireframe
) => ((Shape)this).Draw(renderer, in centerOfMassTransform, scale, color, useMaterialColors, drawWireframe);
///
public void DrawGetSupportFunction(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
float3 scale,
uint color,
bool drawSupportDirection
) =>
((Shape)this).DrawGetSupportFunction(
renderer,
in centerOfMassTransform,
scale,
color,
drawSupportDirection
);
///
public void DrawGetSupportingFace(DebugRenderer renderer, in float4x4 centerOfMassTransform, float3 scale) =>
((Shape)this).DrawGetSupportingFace(renderer, in centerOfMassTransform, scale);
///
public void CollideSoftBodyVertices(
in float4x4 centerOfMassTransform,
float3 scale,
CollideSoftBodyVertexIterator vertices,
uint numVertices,
int collidingShapeIndex
) =>
((Shape)this).CollideSoftBodyVertices(
in centerOfMassTransform,
scale,
vertices,
numVertices,
collidingShapeIndex
);
///
public NativeHandleArray TransformShape(in float4x4 centerOfMassTransform) =>
((Shape)this).TransformShape(in centerOfMassTransform);
///
public Shape ScaleShape(float3 scale) => ((Shape)this).ScaleShape(scale);
///
public void GetTrianglesStart(
ref Shape.GetTrianglesContext context,
in AABox box,
float3 positionCOM,
floatQuat rotation,
float3 scale
) => ((Shape)this).GetTrianglesStart(ref context, in box, positionCOM, rotation, scale);
///
public unsafe int GetTrianglesNext(
ref Shape.GetTrianglesContext context,
int maxTrianglesRequested,
Ptr triangleVertices,
Ptr materials = default
) => ((Shape)this).GetTrianglesNext(ref context, maxTrianglesRequested, triangleVertices, materials);
///
public NativeArray SaveMaterialState() => ((Shape)this).SaveMaterialState();
///
public unsafe void RestoreMaterialState(ReadOnlySpan materials) =>
((Shape)this).RestoreMaterialState(materials);
///
public NativeArray SaveSubShapeState() => ((Shape)this).SaveSubShapeState();
///
public unsafe void RestoreSubShapeState(ReadOnlySpan subShapes) =>
((Shape)this).RestoreSubShapeState(subShapes);
///
public void SaveWithChildren(StreamOut stream, ShapeToIDMap shapeMap, MaterialToIDMap materialMap) =>
((Shape)this).SaveWithChildren(stream, shapeMap, materialMap);
///
public float GetVolume() => ((Shape)this).GetVolume();
///
public bool IsValidScale(float3 scale) => ((Shape)this).IsValidScale(scale);
///
public float3 MakeScaleValid(float3 scale) => ((Shape)this).MakeScaleValid(scale);
}
}