mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
482 lines
26 KiB
C#
482 lines
26 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Jolt.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
using Brutal.Interop;
|
|
using Brutal.Numerics;
|
|
namespace Brutal.JoltApi
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L185">Jolt/Physics/Collision/Shape/Shape.h:185</see>
|
|
/// <br/>
|
|
/// <c>class Shape : public RefTarget<Shape>, public NonCopyable</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Base class for all shapes (collision volume of a body). Defines a virtual interface for collision detection.
|
|
/// </para>
|
|
/// </remarks>
|
|
[InteropHandle]
|
|
public readonly partial struct Shape : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L348">Jolt/Physics/Collision/Shape/Shape.h:348</see>
|
|
/// <br/>
|
|
/// <c>struct alignas(16) GetTrianglesContext { uint8 mData[4288]; }</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// An opaque buffer that holds shape specific information during GetTrianglesStart/Next.
|
|
/// </para>
|
|
/// </remarks>
|
|
[StructLayout(LayoutKind.Explicit, Size = 4288)]
|
|
public struct GetTrianglesContext
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L348">Jolt/Physics/Collision/Shape/Shape.h:348</see>
|
|
/// <br/>
|
|
/// <c>uint8 mData[4288]</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// An opaque buffer that holds shape specific information during GetTrianglesStart/Next.
|
|
/// </para>
|
|
/// </remarks>
|
|
[FieldOffset(0)]
|
|
public byte_4288 mData;
|
|
}
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L407">Jolt/Physics/Collision/Shape/Shape.h:407</see>
|
|
/// <br/>
|
|
/// <c>struct Stats</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Class that holds information about the shape that can be used for logging / data collection purposes
|
|
/// </para>
|
|
/// </remarks>
|
|
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
|
public struct Stats
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Amount of memory used by this shape (size in bytes)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L411">Jolt/Physics/Collision/Shape/Shape.h:411</see>
|
|
/// <br/>
|
|
/// <c>size_t mSizeBytes</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(0)]
|
|
public nuint mSizeBytes;
|
|
/// <summary>
|
|
/// <para>
|
|
/// Number of triangles in this shape (when applicable)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L412">Jolt/Physics/Collision/Shape/Shape.h:412</see>
|
|
/// <br/>
|
|
/// <c>uint mNumTriangles</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(8)]
|
|
public uint mNumTriangles;
|
|
}
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L200">Jolt/Physics/Collision/Shape/Shape.h:200</see>
|
|
/// <br/>
|
|
/// <c>inline EShapeType GetType() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Get type
|
|
/// </para>
|
|
/// </remarks>
|
|
public EShapeType GetShapeType() => Jolt.PInvoke.Shape_GetShapeType(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L201">Jolt/Physics/Collision/Shape/Shape.h:201</see>
|
|
/// <br/>
|
|
/// <c>inline EShapeSubType GetSubType() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public EShapeSubType GetSubType() => Jolt.PInvoke.Shape_GetSubType(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L204">Jolt/Physics/Collision/Shape/Shape.h:204</see>
|
|
/// <br/>
|
|
/// <c>uint64 GetUserData() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// User data (to be used freely by the application)
|
|
/// </para>
|
|
/// </remarks>
|
|
public ulong GetUserData() => Jolt.PInvoke.Shape_GetUserData(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L205">Jolt/Physics/Collision/Shape/Shape.h:205</see>
|
|
/// <br/>
|
|
/// <c>void SetUserData(uint64 inUserData)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetUserData(ulong userData) => Jolt.PInvoke.Shape_SetUserData(this, userData);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L208">Jolt/Physics/Collision/Shape/Shape.h:208</see>
|
|
/// <br/>
|
|
/// <c>virtual bool MustBeStatic() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Check if this shape can only be used to create a static body or if it can also be dynamic/kinematic
|
|
/// </para>
|
|
/// </remarks>
|
|
public bool MustBeStatic() => Jolt.PInvoke.Shape_MustBeStatic(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L211">Jolt/Physics/Collision/Shape/Shape.h:211</see>
|
|
/// <br/>
|
|
/// <c>virtual Vec3 GetCenterOfMass() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// All shapes are centered around their center of mass. This function returns the center of mass position
|
|
/// that needs to be applied to transform the shape to where it was created.
|
|
/// </para>
|
|
/// </remarks>
|
|
public float3 GetCenterOfMass() => Jolt.PInvoke.Shape_GetCenterOfMass(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L217">Jolt/Physics/Collision/Shape/Shape.h:217</see>
|
|
/// <br/>
|
|
/// <c>virtual uint GetSubShapeIDBitsRecursive() const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Get the max number of sub shape ID bits that are needed to be able to address any leaf shape in this
|
|
/// shape. Used mainly for checking that it is smaller or equal than SubShapeID::MaxBits.
|
|
/// </para>
|
|
/// </remarks>
|
|
public uint GetSubShapeIDBitsRecursive() => Jolt.PInvoke.Shape_GetSubShapeIDBitsRecursive(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L238">Jolt/Physics/Collision/Shape/Shape.h:238</see>
|
|
/// <br/>
|
|
/// <c>virtual float GetInnerRadius() const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Returns the radius of the biggest sphere that fits entirely in the shape. In case this shape consists of multiple sub shapes, it returns the smallest sphere of the parts.
|
|
/// This can be used as a measure of how far the shape can be moved without risking going through geometry.
|
|
/// </code>
|
|
/// </remarks>
|
|
public float GetInnerRadius() => Jolt.PInvoke.Shape_GetInnerRadius(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L247">Jolt/Physics/Collision/Shape/Shape.h:247</see>
|
|
/// <br/>
|
|
/// <c>virtual const Shape * GetLeafShape(const SubShapeID &inSubShapeID, SubShapeID &outRemainder) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Get the leaf shape for a particular sub shape ID.
|
|
/// @param inSubShapeID The full sub shape ID that indicates the path to the leaf shape
|
|
/// @param outRemainder What remains of the sub shape ID after removing the path to the leaf shape (could e.g. refer to a triangle within a MeshShape)
|
|
/// @return The shape or null if the sub shape ID is invalid
|
|
/// </code>
|
|
/// </remarks>
|
|
public Shape GetLeafShape(uint subShapeID, out uint remainder) => Jolt.PInvoke.Shape_GetLeafShape(this, subShapeID, out remainder);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L250">Jolt/Physics/Collision/Shape/Shape.h:250</see>
|
|
/// <br/>
|
|
/// <c>virtual const PhysicsMaterial * GetMaterial(const SubShapeID &inSubShapeID) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Get the material assigned to a particular sub shape ID
|
|
/// </para>
|
|
/// </remarks>
|
|
public PhysicsMaterial GetMaterial(uint subShapeID) => Jolt.PInvoke.Shape_GetMaterial(this, subShapeID);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L254">Jolt/Physics/Collision/Shape/Shape.h:254</see>
|
|
/// <br/>
|
|
/// <c>virtual Vec3 GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Get the surface normal of a particular sub shape ID and point on surface (all vectors are relative to center of mass for this shape).
|
|
/// Note: When you have a CollideShapeResult or ShapeCastResult you should use -mPenetrationAxis.Normalized() as contact normal as GetSurfaceNormal will only return face normals (and not vertex or edge normals).
|
|
/// </code>
|
|
/// </remarks>
|
|
public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) => Jolt.PInvoke.Shape_GetSurfaceNormal(this, subShapeID, localSurfacePosition);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L269">Jolt/Physics/Collision/Shape/Shape.h:269</see>
|
|
/// <br/>
|
|
/// <c>virtual uint64 GetSubShapeUserData(const SubShapeID &inSubShapeID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Get the user data of a particular sub shape ID. Corresponds with the value stored in Shape::GetUserData
|
|
/// of the leaf shape pointed to by inSubShapeID.
|
|
/// </para>
|
|
/// </remarks>
|
|
public ulong GetSubShapeUserData(uint subShapeID) => Jolt.PInvoke.Shape_GetSubShapeUserData(this, subShapeID);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L290">Jolt/Physics/Collision/Shape/Shape.h:290</see>
|
|
/// <br/>
|
|
/// <c>virtual void GetSubmergedVolume(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const Plane &inSurface, float &outTotalVolume, float &outSubmergedVolume, Vec3 &outCenterOfBuoyancy</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void GetSubmergedVolume(float4x4 centerOfMassTransform, float3 scale, Plane surface, out float totalVolume, out float submergedVolume, out float3 centerOfBuoyancy, float3 baseOffset) => Jolt.PInvoke.Shape_GetSubmergedVolume(this, centerOfMassTransform, scale, surface, out totalVolume, out submergedVolume, out centerOfBuoyancy, baseOffset);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L298">Jolt/Physics/Collision/Shape/Shape.h:298</see>
|
|
/// <br/>
|
|
/// <c>virtual void Draw(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inUseMaterialColors, bool inDrawWireframe) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Draw the shape at a particular location with a particular color (debugging purposes)
|
|
/// </para>
|
|
/// </remarks>
|
|
public void Draw(DebugRenderer renderer, float4x4 centerOfMassTransform, float3 scale, uint color, bool useMaterialColors, bool drawWireframe) => Jolt.PInvoke.Shape_Draw(this, renderer, centerOfMassTransform, scale, color, useMaterialColors, drawWireframe);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L301">Jolt/Physics/Collision/Shape/Shape.h:301</see>
|
|
/// <br/>
|
|
/// <c>virtual void DrawGetSupportFunction(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inDrawSupportDirection) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Draw the results of the GetSupportFunction with the convex radius added back on to show any errors
|
|
/// introduced by this process (only relevant for convex shapes)
|
|
/// </para>
|
|
/// </remarks>
|
|
public void DrawGetSupportFunction(DebugRenderer renderer, float4x4 centerOfMassTransform, float3 scale, uint color, bool drawSupportDirection) => Jolt.PInvoke.Shape_DrawGetSupportFunction(this, renderer, centerOfMassTransform, scale, color, drawSupportDirection);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L304">Jolt/Physics/Collision/Shape/Shape.h:304</see>
|
|
/// <br/>
|
|
/// <c>virtual void DrawGetSupportingFace(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Draw the results of the GetSupportingFace function to show any errors introduced by this process (only
|
|
/// relevant for convex shapes)
|
|
/// </para>
|
|
/// </remarks>
|
|
public void DrawGetSupportingFace(DebugRenderer renderer, float4x4 centerOfMassTransform, float3 scale) => Jolt.PInvoke.Shape_DrawGetSupportingFace(this, renderer, centerOfMassTransform, scale);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L329">Jolt/Physics/Collision/Shape/Shape.h:329</see>
|
|
/// <br/>
|
|
/// <c>virtual void CollideSoftBodyVertices(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const CollideSoftBodyVertexIterator &inVertices, uint inNumVertices, int inCollidingShapeIndex) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Collides all vertices of a soft body with this shape and updates SoftBodyVertex::mCollisionPlane, SoftBodyVertex::mCollidingShapeIndex and SoftBodyVertex::mLargestPenetration if a collision with more penetration was found.
|
|
/// @param inCenterOfMassTransform Center of mass transform for this shape relative to the vertices.
|
|
/// @param inScale Scale in local space of the shape (scales relative to its center of mass)
|
|
/// @param inVertices The vertices of the soft body
|
|
/// @param inNumVertices The number of vertices in inVertices
|
|
/// @param inCollidingShapeIndex Value to store in CollideSoftBodyVertexIterator::mCollidingShapeIndex when a collision was found
|
|
/// </code>
|
|
/// </remarks>
|
|
public void CollideSoftBodyVertices(float4x4 centerOfMassTransform, float3 scale, CollideSoftBodyVertexIterator vertices, uint numVertices, int collidingShapeIndex) => Jolt.PInvoke.Shape_CollideSoftBodyVertices(this, centerOfMassTransform, scale, vertices, numVertices, collidingShapeIndex);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L345">Jolt/Physics/Collision/Shape/Shape.h:345</see>
|
|
/// <br/>
|
|
/// <c>ShapeResult ScaleShape(Vec3Arg inScale) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Scale this shape. Note that not all shapes support all scales, this will return a shape that matches the scale as accurately as possible. See Shape::IsValidScale for more information.
|
|
/// @param inScale The scale to use for this shape (note: this scale is applied to the entire shape in the space it was created, most other functions apply the scale in the space of the leaf shapes and from the center of mass!)
|
|
/// </code>
|
|
/// <para>
|
|
/// Throws InvalidOperationException with Jolt's error message when the operation fails.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Shape ScaleShape(float3 scale)
|
|
{
|
|
var _handle = Jolt.PInvoke.Shape_ScaleShape(this, scale);
|
|
if (_handle.IsNull()) throw new InvalidOperationException(Jolt.GetLastError());
|
|
return _handle;
|
|
}
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L358">Jolt/Physics/Collision/Shape/Shape.h:358</see>
|
|
/// <br/>
|
|
/// <c>virtual void GetTrianglesStart(GetTrianglesContext &ioContext, const AABox &inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// To start iterating over triangles, call this function first.
|
|
/// ioContext is a temporary buffer and should remain untouched until the last call to GetTrianglesNext.
|
|
/// inBox is the world space bounding in which you want to get the triangles.
|
|
/// inPositionCOM/inRotation/inScale describes the transform of this shape.
|
|
/// To get the actual triangles call GetTrianglesNext.
|
|
/// </code>
|
|
/// </remarks>
|
|
public void GetTrianglesStart(ref Shape.GetTrianglesContext context, AABox box, float3 positionCOM, floatQuat rotation, float3 scale) => Jolt.PInvoke.Shape_GetTrianglesStart(this, ref context, box, positionCOM, rotation, scale);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L376">Jolt/Physics/Collision/Shape/Shape.h:376</see>
|
|
/// <br/>
|
|
/// <c>virtual void SaveBinaryState(StreamOut &inStream) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Saves the contents of the shape in binary form to inStream.
|
|
/// </para>
|
|
/// </remarks>
|
|
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.Shape_SaveBinaryState(this, stream);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L379">Jolt/Physics/Collision/Shape/Shape.h:379</see>
|
|
/// <br/>
|
|
/// <c>static ShapeResult sRestoreFromBinaryState(StreamIn &inStream)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Creates a Shape of the correct type and restores its contents from the binary stream inStream.
|
|
/// </para>
|
|
/// <para>
|
|
/// Throws InvalidOperationException with Jolt's error message when the operation fails.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static Shape sRestoreFromBinaryState(StreamIn stream)
|
|
{
|
|
var _handle = Jolt.PInvoke.Shape_sRestoreFromBinaryState(stream);
|
|
if (_handle.IsNull()) throw new InvalidOperationException(Jolt.GetLastError());
|
|
return _handle;
|
|
}
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L425">Jolt/Physics/Collision/Shape/Shape.h:425</see>
|
|
/// <br/>
|
|
/// <c>virtual float GetVolume() const = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// < Volume of this shape (m^3). Note that for compound shapes the volume may be incorrect since child
|
|
/// shapes can overlap which is not accounted for.
|
|
/// </para>
|
|
/// </remarks>
|
|
public float GetVolume() => Jolt.PInvoke.Shape_GetVolume(this);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L439">Jolt/Physics/Collision/Shape/Shape.h:439</see>
|
|
/// <br/>
|
|
/// <c>virtual bool IsValidScale(Vec3Arg inScale) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Test if inScale is a valid scale for this shape. Some shapes can only be scaled uniformly, compound shapes cannot handle shapes
|
|
/// being rotated and scaled (this would cause shearing), scale can never be zero. When the scale is invalid, the function will return false.
|
|
///
|
|
/// Here's a list of supported scales:
|
|
/// * SphereShape: Scale must be uniform (signs of scale are ignored).
|
|
/// * BoxShape: Any scale supported (signs of scale are ignored).
|
|
/// * TriangleShape: Any scale supported when convex radius is zero, otherwise only uniform scale supported.
|
|
/// * CapsuleShape: Scale must be uniform (signs of scale are ignored).
|
|
/// * TaperedCapsuleShape: Scale must be uniform (sign of Y scale can be used to flip the capsule).
|
|
/// * CylinderShape: Scale must be uniform in XZ plane, Y can scale independently (signs of scale are ignored).
|
|
/// * RotatedTranslatedShape: Scale must not cause shear in the child shape.
|
|
/// * CompoundShape: Scale must not cause shear in any of the child shapes.
|
|
/// </code>
|
|
/// </remarks>
|
|
public bool IsValidScale(float3 scale) => Jolt.PInvoke.Shape_IsValidScale(this, scale);
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Physics/Collision/Shape/Shape.h#L446">Jolt/Physics/Collision/Shape/Shape.h:446</see>
|
|
/// <br/>
|
|
/// <c>virtual Vec3 MakeScaleValid(Vec3Arg inScale) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// This function will make sure that if you wrap this shape in a ScaledShape that the scale is valid.
|
|
/// Note that this involves discarding components of the scale that are invalid, so the resulting scaled shape may be different than the requested scale.
|
|
/// Compare the return value of this function with the scale you passed in to detect major inconsistencies and possibly warn the user.
|
|
/// @param inScale Local space scale for this shape.
|
|
/// @return Scale that can be used to wrap this shape in a ScaledShape. IsValidScale will return true for this scale.
|
|
/// </code>
|
|
/// </remarks>
|
|
public float3 MakeScaleValid(float3 scale) => Jolt.PInvoke.Shape_MakeScaleValid(this, scale);
|
|
public void AddRef() => Jolt.PInvoke.Shape_AddRef(this);
|
|
public void Release() => Jolt.PInvoke.Shape_Release(this);
|
|
public uint GetRefCount() => Jolt.PInvoke.Shape_GetRefCount(this);
|
|
public void Dispose()
|
|
{
|
|
if (IsNull()) return;
|
|
Release();
|
|
}
|
|
}
|
|
}
|