mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
643 lines
29 KiB
C#
643 lines
29 KiB
C#
// <auto-generated/>
|
|
// 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
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Base class for a compound shape
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L52">Jolt/Physics/Collision/Shape/CompoundShape.h:52</see>
|
|
/// <br/>
|
|
/// <c>class CompoundShape : public Shape</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct CompoundShape : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L141">Jolt/Physics/Collision/Shape/CompoundShape.h:141</see>
|
|
/// <br/>
|
|
/// <c>struct SubShape</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[StructLayout(LayoutKind.Explicit, Size = 40)]
|
|
public partial struct SubShape
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L238">Jolt/Physics/Collision/Shape/CompoundShape.h:238</see>
|
|
/// <br/>
|
|
/// <c>RefConst<Shape> mShape</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(0)]
|
|
public Shape Shape;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Note: Position of center of mass of sub shape!
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L239">Jolt/Physics/Collision/Shape/CompoundShape.h:239</see>
|
|
/// <br/>
|
|
/// <c>Float3 mPositionCOM</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(8)]
|
|
public float3 PositionCOM;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Note: X, Y, Z of rotation quaternion - note we read 4 bytes beyond this so make sure there's
|
|
/// something there
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L240">Jolt/Physics/Collision/Shape/CompoundShape.h:240</see>
|
|
/// <br/>
|
|
/// <c>Float3 mRotation</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(20)]
|
|
public float3 Rotation;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// User data value (put here because it falls in padding bytes)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L241">Jolt/Physics/Collision/Shape/CompoundShape.h:241</see>
|
|
/// <br/>
|
|
/// <c>uint32 mUserData</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(32)]
|
|
public uint UserData;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// If mRotation is close to identity (put here because it falls in padding bytes)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L242">Jolt/Physics/Collision/Shape/CompoundShape.h:242</see>
|
|
/// <br/>
|
|
/// <c>bool mIsRotationIdentity</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(36)]
|
|
public Brutal.Bool8 IsRotationIdentity;
|
|
}
|
|
|
|
/// <inheritdoc cref="Shape.GetCenterOfMass()"/>
|
|
public float3 GetCenterOfMass() => ((Shape)this).GetCenterOfMass();
|
|
|
|
/// <inheritdoc cref="Shape.MustBeStatic()"/>
|
|
public bool MustBeStatic() => ((Shape)this).MustBeStatic();
|
|
|
|
/// <inheritdoc cref="Shape.GetLocalBounds()"/>
|
|
public AABox GetLocalBounds() => ((Shape)this).GetLocalBounds();
|
|
|
|
/// <inheritdoc cref="Shape.GetSubShapeIDBitsRecursive()"/>
|
|
public uint GetSubShapeIDBitsRecursive() => ((Shape)this).GetSubShapeIDBitsRecursive();
|
|
|
|
/// <inheritdoc cref="Shape.GetWorldSpaceBounds(in float4x4, float3)"/>
|
|
public AABox GetWorldSpaceBounds(in float4x4 centerOfMassTransform, float3 scale) =>
|
|
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
|
|
|
|
/// <inheritdoc cref="Shape.GetInnerRadius()"/>
|
|
public float GetInnerRadius() => ((Shape)this).GetInnerRadius();
|
|
|
|
/// <inheritdoc cref="Shape.GetMassProperties()"/>
|
|
public MassProperties GetMassProperties() => ((Shape)this).GetMassProperties();
|
|
|
|
/// <inheritdoc cref="Shape.GetMaterial(uint)"/>
|
|
public PhysicsMaterial GetMaterial(uint subShapeID) => ((Shape)this).GetMaterial(subShapeID);
|
|
|
|
/// <inheritdoc cref="Shape.GetLeafShape(uint, out uint)"/>
|
|
public Shape GetLeafShape(uint subShapeID, out uint remainder) =>
|
|
((Shape)this).GetLeafShape(subShapeID, out remainder);
|
|
|
|
/// <inheritdoc cref="Shape.GetSubShapeUserData(uint)"/>
|
|
public ulong GetSubShapeUserData(uint subShapeID) => ((Shape)this).GetSubShapeUserData(subShapeID);
|
|
|
|
/// <inheritdoc cref="Shape.GetSubShapeTransformedShape(uint, float3, floatQuat, float3, out uint)"/>
|
|
public TransformedShape GetSubShapeTransformedShape(
|
|
uint subShapeID,
|
|
float3 positionCOM,
|
|
floatQuat rotation,
|
|
float3 scale,
|
|
out uint remainder
|
|
) => ((Shape)this).GetSubShapeTransformedShape(subShapeID, positionCOM, rotation, scale, out remainder);
|
|
|
|
/// <inheritdoc cref="Shape.GetSurfaceNormal(uint, float3)"/>
|
|
public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) =>
|
|
((Shape)this).GetSurfaceNormal(subShapeID, localSurfacePosition);
|
|
|
|
/// <inheritdoc cref="Shape.GetSupportingFace(uint, float3, float3, in float4x4, out StaticArrayVec3_32)"/>
|
|
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);
|
|
|
|
/// <inheritdoc cref="Shape.GetSubmergedVolume(in float4x4, float3, in Plane, out float, out float, out float3, float3)"/>
|
|
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
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.Draw(DebugRenderer, in float4x4, float3, uint, bool, bool)"/>
|
|
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);
|
|
|
|
/// <inheritdoc cref="Shape.DrawGetSupportFunction(DebugRenderer, in float4x4, float3, uint, bool)"/>
|
|
public void DrawGetSupportFunction(
|
|
DebugRenderer renderer,
|
|
in float4x4 centerOfMassTransform,
|
|
float3 scale,
|
|
uint color,
|
|
bool drawSupportDirection
|
|
) =>
|
|
((Shape)this).DrawGetSupportFunction(
|
|
renderer,
|
|
in centerOfMassTransform,
|
|
scale,
|
|
color,
|
|
drawSupportDirection
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.DrawGetSupportingFace(DebugRenderer, in float4x4, float3)"/>
|
|
public void DrawGetSupportingFace(DebugRenderer renderer, in float4x4 centerOfMassTransform, float3 scale) =>
|
|
((Shape)this).DrawGetSupportingFace(renderer, in centerOfMassTransform, scale);
|
|
|
|
/// <inheritdoc cref="Shape.CollideSoftBodyVertices(in float4x4, float3, CollideSoftBodyVertexIterator, uint, int)"/>
|
|
public void CollideSoftBodyVertices(
|
|
in float4x4 centerOfMassTransform,
|
|
float3 scale,
|
|
CollideSoftBodyVertexIterator vertices,
|
|
uint numVertices,
|
|
int collidingShapeIndex
|
|
) =>
|
|
((Shape)this).CollideSoftBodyVertices(
|
|
in centerOfMassTransform,
|
|
scale,
|
|
vertices,
|
|
numVertices,
|
|
collidingShapeIndex
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.TransformShape(in float4x4)"/>
|
|
public NativeHandleArray<TransformedShape> TransformShape(in float4x4 centerOfMassTransform) =>
|
|
((Shape)this).TransformShape(in centerOfMassTransform);
|
|
|
|
/// <inheritdoc cref="Shape.GetTrianglesStart(ref Shape.GetTrianglesContext, in AABox, float3, floatQuat, float3)"/>
|
|
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);
|
|
|
|
/// <inheritdoc cref="Shape.GetTrianglesNext(ref Shape.GetTrianglesContext, int, Ptr{float3}, Ptr{PhysicsMaterial})"/>
|
|
public unsafe int GetTrianglesNext(
|
|
ref Shape.GetTrianglesContext context,
|
|
int maxTrianglesRequested,
|
|
Ptr<float3> triangleVertices,
|
|
Ptr<PhysicsMaterial> materials = default
|
|
) => ((Shape)this).GetTrianglesNext(ref context, maxTrianglesRequested, triangleVertices, materials);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get which sub shape's bounding boxes overlap with an axis aligned box
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L132">Jolt/Physics/Collision/Shape/CompoundShape.h:132</see>
|
|
/// <br/>
|
|
/// <c>virtual int GetIntersectingSubShapes(const AABox &inBox, uint *outSubShapeIndices, int inMaxSubShapeIndices) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Get which sub shape's bounding boxes overlap with an axis aligned box
|
|
/// @param inBox The axis aligned box to test against (relative to the center of mass of this shape)
|
|
/// @param outSubShapeIndices Buffer where to place the indices of the sub shapes that intersect
|
|
/// @param inMaxSubShapeIndices How many indices will fit in the buffer (normally you'd provide a buffer of GetNumSubShapes() indices)
|
|
/// @return How many indices were placed in outSubShapeIndices
|
|
/// </code>
|
|
/// <para>
|
|
/// subShapeIndices is the buffer the native call works on, and its element count travels with it: the call
|
|
/// may write through the span, and only for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe int GetIntersectingSubShapes(in AABox box, Span<uint> subShapeIndices)
|
|
{
|
|
fixed (uint* subShapeIndices_fixed = subShapeIndices)
|
|
{
|
|
return Jolt.PInvoke.CompoundShape_GetIntersectingSubShapes(
|
|
this,
|
|
in box,
|
|
subShapeIndices_fixed,
|
|
(int)subShapeIndices.Length
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get which sub shape's bounding boxes overlap with an axis aligned box
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L139">Jolt/Physics/Collision/Shape/CompoundShape.h:139</see>
|
|
/// <br/>
|
|
/// <c>virtual int GetIntersectingSubShapes(const OrientedBox &inBox, uint *outSubShapeIndices, int inMaxSubShapeIndices) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Get which sub shape's bounding boxes overlap with an axis aligned box
|
|
/// @param inBox The axis aligned box to test against (relative to the center of mass of this shape)
|
|
/// @param outSubShapeIndices Buffer where to place the indices of the sub shapes that intersect
|
|
/// @param inMaxSubShapeIndices How many indices will fit in the buffer (normally you'd provide a buffer of GetNumSubShapes() indices)
|
|
/// @return How many indices were placed in outSubShapeIndices
|
|
/// </code>
|
|
/// <para>
|
|
/// subShapeIndices is the buffer the native call works on, and its element count travels with it: the call
|
|
/// may write through the span, and only for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe int GetIntersectingSubShapes(OrientedBox box, Span<uint> subShapeIndices)
|
|
{
|
|
fixed (uint* subShapeIndices_fixed = subShapeIndices)
|
|
{
|
|
return Jolt.PInvoke.CompoundShape_GetIntersectingSubShapes_2(
|
|
this,
|
|
box,
|
|
subShapeIndices_fixed,
|
|
(int)subShapeIndices.Length
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Access to the sub shapes of this compound
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L251">Jolt/Physics/Collision/Shape/CompoundShape.h:251</see>
|
|
/// <br/>
|
|
/// <c>const SubShapes & GetSubShapes() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// 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.
|
|
/// </para>
|
|
/// </remarks>
|
|
[return: Brutal.Attributes.Fixed]
|
|
public unsafe ReadOnlySpan<CompoundShape.SubShape> GetSubShapes()
|
|
{
|
|
Jolt.PInvoke.CompoundShape_GetSubShapes(this, out var _outResult);
|
|
return new ReadOnlySpan<CompoundShape.SubShape>((void*)_outResult.Data, checked((int)_outResult.Count));
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the total number of sub shapes
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L254">Jolt/Physics/Collision/Shape/CompoundShape.h:254</see>
|
|
/// <br/>
|
|
/// <c>uint GetNumSubShapes() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetNumSubShapes() => Jolt.PInvoke.CompoundShape_GetNumSubShapes(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Access to a particular sub shape
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L257">Jolt/Physics/Collision/Shape/CompoundShape.h:257</see>
|
|
/// <br/>
|
|
/// <c>const SubShape & GetSubShape(uint inIdx) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned struct's handle fields are borrowed from the object it came from: don't Dispose them, and
|
|
/// don't read them after the owner is gone.
|
|
/// </para>
|
|
/// </remarks>
|
|
public CompoundShape.SubShape GetSubShape(uint idx)
|
|
{
|
|
Jolt.PInvoke.CompoundShape_GetSubShape(this, idx, out var _inRange, out var _outResult);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(idx),
|
|
idx,
|
|
"Expected an index below the number of sub shapes."
|
|
);
|
|
return _outResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the user data associated with a shape in this compound
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L260">Jolt/Physics/Collision/Shape/CompoundShape.h:260</see>
|
|
/// <br/>
|
|
/// <c>uint32 GetCompoundUserData(uint inIdx) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetCompoundUserData(uint idx)
|
|
{
|
|
var _result = Jolt.PInvoke.CompoundShape_GetCompoundUserData(this, idx, out var _inRange);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(idx),
|
|
idx,
|
|
"Expected an index below the number of sub shapes."
|
|
);
|
|
return _result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the user data associated with a shape in this compound
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L263">Jolt/Physics/Collision/Shape/CompoundShape.h:263</see>
|
|
/// <br/>
|
|
/// <c>void SetCompoundUserData(uint inIdx, uint32 inUserData)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetCompoundUserData(uint idx, uint userData)
|
|
{
|
|
Jolt.PInvoke.CompoundShape_SetCompoundUserData(this, idx, userData, out var _inRange);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(idx),
|
|
idx,
|
|
"Expected an index below the number of sub shapes."
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if a sub shape ID is still valid for this shape
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L268">Jolt/Physics/Collision/Shape/CompoundShape.h:268</see>
|
|
/// <br/>
|
|
/// <c>inline bool IsSubShapeIDValid(SubShapeID inSubShapeID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Check if a sub shape ID is still valid for this shape
|
|
/// @param inSubShapeID Sub shape id that indicates the leaf shape relative to this shape
|
|
/// @return True if the ID is valid, false if not
|
|
/// </code>
|
|
/// </remarks>
|
|
public bool IsSubShapeIDValid(uint subShapeID) =>
|
|
Jolt.PInvoke.CompoundShape_IsSubShapeIDValid(this, subShapeID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Convert SubShapeID to sub shape index
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L278">Jolt/Physics/Collision/Shape/CompoundShape.h:278</see>
|
|
/// <br/>
|
|
/// <c>inline uint32 GetSubShapeIndexFromID(SubShapeID inSubShapeID, SubShapeID &outRemainder) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Convert SubShapeID to sub shape index
|
|
/// @param inSubShapeID Sub shape id that indicates the leaf shape relative to this shape
|
|
/// @param outRemainder This is the sub shape ID for the sub shape of the compound after popping off the index
|
|
/// @return The index of the sub shape of this compound
|
|
/// </code>
|
|
/// </remarks>
|
|
public uint GetSubShapeIndexFromID(uint subShapeID, out uint remainder) =>
|
|
Jolt.PInvoke.CompoundShape_GetSubShapeIndexFromID(this, subShapeID, out remainder);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Convert a sub shape index to a sub shape ID
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L289">Jolt/Physics/Collision/Shape/CompoundShape.h:289</see>
|
|
/// <br/>
|
|
/// <c>inline SubShapeIDCreator GetSubShapeIDFromIndex(int inIdx, const SubShapeIDCreator &inParentSubShapeID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @brief Convert a sub shape index to a sub shape ID
|
|
/// @param inIdx Index of the sub shape of this compound
|
|
/// @param inParentSubShapeID Parent SubShapeID (describing the path to the compound shape)
|
|
/// @return A sub shape ID creator that contains the full path to the sub shape with index inIdx
|
|
/// </code>
|
|
/// <para>
|
|
/// The returned handle is an owned copy; Dispose it when you're done with it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public SubShapeIDCreator GetSubShapeIDFromIndex(int idx, SubShapeIDCreator parentSubShapeID)
|
|
{
|
|
var _result = Jolt.PInvoke.CompoundShape_GetSubShapeIDFromIndex(
|
|
this,
|
|
idx,
|
|
parentSubShapeID,
|
|
out var _inRange
|
|
);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(idx),
|
|
idx,
|
|
"Expected an index below the number of sub shapes."
|
|
);
|
|
return _result;
|
|
}
|
|
|
|
/// <inheritdoc cref="Shape.SaveBinaryState(StreamOut)"/>
|
|
public void SaveBinaryState(StreamOut stream) => ((Shape)this).SaveBinaryState(stream);
|
|
|
|
/// <inheritdoc cref="Shape.SaveSubShapeState()"/>
|
|
public NativeArray<Shape> SaveSubShapeState() => ((Shape)this).SaveSubShapeState();
|
|
|
|
/// <inheritdoc cref="Shape.RestoreSubShapeState(ReadOnlySpan{Shape})"/>
|
|
public unsafe void RestoreSubShapeState(ReadOnlySpan<Shape> subShapes) =>
|
|
((Shape)this).RestoreSubShapeState(subShapes);
|
|
|
|
/// <inheritdoc cref="Shape.GetVolume()"/>
|
|
public float GetVolume() => ((Shape)this).GetVolume();
|
|
|
|
/// <inheritdoc cref="Shape.IsValidScale(float3)"/>
|
|
public bool IsValidScale(float3 scale) => ((Shape)this).IsValidScale(scale);
|
|
|
|
/// <inheritdoc cref="Shape.MakeScaleValid(float3)"/>
|
|
public float3 MakeScaleValid(float3 scale) => ((Shape)this).MakeScaleValid(scale);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Register shape functions with the registry
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/CompoundShape.h#L312">Jolt/Physics/Collision/Shape/CompoundShape.h:312</see>
|
|
/// <br/>
|
|
/// <c>static void sRegister()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static void Register() => Jolt.PInvoke.CompoundShape_Register();
|
|
|
|
public void AddRef() => ((Shape)this).AddRef();
|
|
|
|
public void Release() => ((Shape)this).Release();
|
|
|
|
public uint GetRefCount() => ((Shape)this).GetRefCount();
|
|
|
|
public static implicit operator Shape(CompoundShape value) => Unsafe.BitCast<CompoundShape, Shape>(value);
|
|
|
|
public void Dispose()
|
|
{
|
|
if (IsNull())
|
|
return;
|
|
Release();
|
|
}
|
|
|
|
/// <inheritdoc cref="Shape.GetShapeType()"/>
|
|
public ShapeType GetShapeType() => ((Shape)this).GetShapeType();
|
|
|
|
/// <inheritdoc cref="Shape.GetSubType()"/>
|
|
public ShapeSubType GetSubType() => ((Shape)this).GetSubType();
|
|
|
|
/// <inheritdoc cref="Shape.GetUserData()"/>
|
|
public ulong GetUserData() => ((Shape)this).GetUserData();
|
|
|
|
/// <inheritdoc cref="Shape.SetUserData(ulong)"/>
|
|
public void SetUserData(ulong userData) => ((Shape)this).SetUserData(userData);
|
|
|
|
/// <inheritdoc cref="Shape.GetWorldSpaceBounds(in double4x4, float3)"/>
|
|
public AABox GetWorldSpaceBounds(in double4x4 centerOfMassTransform, float3 scale) =>
|
|
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
|
|
|
|
/// <inheritdoc cref="Shape.CastRay(in RayCast, SubShapeIDCreator, ref RayCastResult)"/>
|
|
public bool CastRay(in RayCast ray, SubShapeIDCreator subShapeIDCreator, ref RayCastResult hit) =>
|
|
((Shape)this).CastRay(in ray, subShapeIDCreator, ref hit);
|
|
|
|
/// <inheritdoc cref="Shape.CastRay(in RayCast, RayCastSettings, SubShapeIDCreator, Span{RayCastResult}, out uint, ShapeFilter)"/>
|
|
public unsafe uint CastRay(
|
|
in RayCast ray,
|
|
RayCastSettings rayCastSettings,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
Span<RayCastResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter = default
|
|
) => ((Shape)this).CastRay(in ray, rayCastSettings, subShapeIDCreator, results, out totalHits, shapeFilter);
|
|
|
|
/// <inheritdoc cref="Shape.CastRayClosest(in RayCast, RayCastSettings, SubShapeIDCreator, out RayCastResult, 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);
|
|
|
|
/// <inheritdoc cref="Shape.CollidePoint(float3, SubShapeIDCreator, Span{CollidePointResult}, out uint, ShapeFilter)"/>
|
|
public unsafe uint CollidePoint(
|
|
float3 point,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
Span<CollidePointResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter = default
|
|
) => ((Shape)this).CollidePoint(point, subShapeIDCreator, results, out totalHits, shapeFilter);
|
|
|
|
/// <inheritdoc cref="Shape.CollectTransformedShapes(in AABox, float3, floatQuat, float3, SubShapeIDCreator, ShapeFilter)"/>
|
|
public NativeHandleArray<TransformedShape> CollectTransformedShapes(
|
|
in AABox box,
|
|
float3 positionCOM,
|
|
floatQuat rotation,
|
|
float3 scale,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
ShapeFilter shapeFilter
|
|
) =>
|
|
((Shape)this).CollectTransformedShapes(
|
|
in box,
|
|
positionCOM,
|
|
rotation,
|
|
scale,
|
|
subShapeIDCreator,
|
|
shapeFilter
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.ScaleShape(float3)"/>
|
|
public Shape ScaleShape(float3 scale) => ((Shape)this).ScaleShape(scale);
|
|
|
|
/// <inheritdoc cref="Shape.SaveMaterialState()"/>
|
|
public NativeArray<PhysicsMaterial> SaveMaterialState() => ((Shape)this).SaveMaterialState();
|
|
|
|
/// <inheritdoc cref="Shape.RestoreMaterialState(ReadOnlySpan{PhysicsMaterial})"/>
|
|
public unsafe void RestoreMaterialState(ReadOnlySpan<PhysicsMaterial> materials) =>
|
|
((Shape)this).RestoreMaterialState(materials);
|
|
|
|
/// <inheritdoc cref="Shape.SaveWithChildren(StreamOut, ShapeToIDMap, MaterialToIDMap)"/>
|
|
public void SaveWithChildren(StreamOut stream, ShapeToIDMap shapeMap, MaterialToIDMap materialMap) =>
|
|
((Shape)this).SaveWithChildren(stream, shapeMap, materialMap);
|
|
|
|
/// <inheritdoc cref="Shape.GetStats()"/>
|
|
public Shape.Stats GetStats() => ((Shape)this).GetStats();
|
|
}
|
|
}
|