//
// 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
{
///
///
/// This class defines the setup of all particles and their constraints. It is used during the simulation and
/// can be shared between multiple soft bodies.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:15
///
/// class SoftBodySharedSettings : public RefTarget<SoftBodySharedSettings>
///
///
[InteropHandle]
public readonly partial struct SoftBodySharedSettings : IDisposable
{
///
///
/// Which type of bend constraint should be created
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:21
///
/// enum class EBendType
///
///
public enum BendType : int
{
///
///
/// No bend constraints will be created
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:23
///
/// None
///
///
None,
///
///
/// A simple distance constraint
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:24
///
/// Distance
///
///
Distance,
///
///
/// A dihedral bend constraint (most expensive, but also supports triangles that are initially not in
/// the same plane)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:25
///
/// Dihedral
///
///
Dihedral,
}
///
///
/// The type of long range attachment constraint to create
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:29
///
/// enum class ELRAType
///
///
public enum LRAType : int
{
///
///
/// Don't create a LRA constraint
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:31
///
/// None
///
///
None,
///
///
/// Create a LRA constraint based on Euclidean distance between the closest kinematic vertex and this
/// vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:32
///
/// EuclideanDistance
///
///
EuclideanDistance,
///
///
/// Create a LRA constraint based on the geodesic distance between the closest kinematic vertex and this
/// vertex (follows the edge constraints)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:33
///
/// GeodesicDistance
///
///
GeodesicDistance,
}
///
///
/// Per vertex attributes used during the CreateConstraints function. For an edge or shear constraint, the
/// compliance is averaged between the two attached vertices. For a bend constraint, the compliance is
/// averaged between the two vertices on the shared edge.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:39
///
/// struct VertexAttributes
///
///
[StructLayout(LayoutKind.Explicit, Size = 20)]
public partial struct VertexAttributes
{
///
///
/// The compliance of the normal edges. Set to FLT_MAX to disable regular edges for any edge involving
/// this vertex.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:45
///
/// float mCompliance = 0.0f
///
///
[FieldOffset(0)]
public float Compliance;
///
///
/// The compliance of the shear edges. Set to FLT_MAX to disable shear edges for any edge involving this
/// vertex.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:46
///
/// float mShearCompliance = 0.0f
///
///
[FieldOffset(4)]
public float ShearCompliance;
///
///
/// The compliance of the bend edges. Set to FLT_MAX to disable bend edges for any bend constraint
/// involving this vertex.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:47
///
/// float mBendCompliance = FLT_MAX
///
///
[FieldOffset(8)]
public float BendCompliance;
///
///
/// The type of long range attachment constraint to create.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:48
///
/// ELRAType mLRAType = ELRAType::None
///
///
[FieldOffset(12)]
public SoftBodySharedSettings.LRAType LRAType;
///
///
/// Multiplier for the max distance of the LRA constraint, e.g. 1.01 means the max distance is 1% longer
/// than the calculated distance in the rest pose.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:49
///
/// float mLRAMaxDistanceMultiplier = 1.0f
///
///
[FieldOffset(16)]
public float LRAMaxDistanceMultiplier;
}
///
///
/// A vertex is a particle, the data in this structure is only used during creation of the soft body and not
/// during simulation
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:127
///
/// struct Vertex
///
///
[StructLayout(LayoutKind.Explicit, Size = 28)]
public partial struct Vertex
{
///
///
/// Initial position of the vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:135
///
/// Float3 mPosition { 0, 0, 0 }
///
///
[FieldOffset(0)]
public float3 Position;
///
///
/// Initial velocity of the vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:136
///
/// Float3 mVelocity { 0, 0, 0 }
///
///
[FieldOffset(12)]
public float3 Velocity;
///
///
/// Initial inverse of the mass of the vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:137
///
/// float mInvMass = 1.0f
///
///
[FieldOffset(24)]
public float InvMass;
}
///
///
/// A face defines the surface of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:141
///
/// struct Face
///
///
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct Face
{
///
///
/// Indices of the vertices that form the face
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:152
///
/// uint32 mVertex[3]
///
///
[FieldOffset(0)]
public uint_3 Vertex;
///
///
/// Index of the material of the face in SoftBodySharedSettings::mMaterials
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:153
///
/// uint32 mMaterialIndex = 0
///
///
[FieldOffset(12)]
public uint MaterialIndex;
}
///
///
/// An edge keeps two vertices at a constant distance using a spring: |x1 - x2| = rest length
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:157
///
/// struct Edge
///
///
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct Edge
{
///
///
/// Indices of the vertices that form the edge
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:168
///
/// uint32 mVertex[2]
///
///
[FieldOffset(0)]
public uint_2 Vertex;
///
///
/// Rest length of the spring, calculated by CalculateEdgeLengths
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:169
///
/// float mRestLength = 1.0f
///
///
[FieldOffset(8)]
public float RestLength;
///
///
/// Inverse of the stiffness of the spring
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:170
///
/// float mCompliance = 0.0f
///
///
[FieldOffset(12)]
public float Compliance;
}
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:191
///
/// struct DihedralBend
///
///
[StructLayout(LayoutKind.Explicit, Size = 24)]
public partial struct DihedralBend
{
///
///
/// Indices of the vertices of the 2 triangles that share an edge (the first 2 vertices are the shared
/// edge)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:202
///
/// uint32 mVertex[4]
///
///
[FieldOffset(0)]
public uint_4 Vertex;
///
///
/// Inverse of the stiffness of the constraint
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:203
///
/// float mCompliance = 0.0f
///
///
[FieldOffset(16)]
public float Compliance;
///
///
/// Initial angle between the normals of the triangles (pi - dihedral angle), calculated by
/// CalculateBendConstraintConstants
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:204
///
/// float mInitialAngle = 0.0f
///
///
[FieldOffset(20)]
public float InitialAngle;
}
///
///
/// Volume constraint, keeps the volume of a tetrahedron constant
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:208
///
/// struct Volume
///
///
[StructLayout(LayoutKind.Explicit, Size = 24)]
public partial struct Volume
{
///
///
/// Indices of the vertices that form the tetrahedron
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:219
///
/// uint32 mVertex[4]
///
///
[FieldOffset(0)]
public uint_4 Vertex;
///
///
/// 6 times the rest volume of the tetrahedron, calculated by CalculateVolumeConstraintVolumes
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:220
///
/// float mSixRestVolume = 1.0f
///
///
[FieldOffset(16)]
public float SixRestVolume;
///
///
/// Inverse of the stiffness of the constraint
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:221
///
/// float mCompliance = 0.0f
///
///
[FieldOffset(20)]
public float Compliance;
}
///
///
/// An inverse bind matrix take a skinned vertex from its bind pose into joint local space
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:225
///
/// class InvBind
///
///
[StructLayout(LayoutKind.Explicit, Size = 80)]
public partial struct InvBind
{
///
///
/// Joint index to which this is attached
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:234
///
/// uint32 mJointIndex = 0
///
///
[FieldOffset(0)]
public uint JointIndex;
///
///
/// The inverse bind matrix, this takes a vertex in its bind pose (Vertex::mPosition) to joint local
/// space
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:235
///
/// Mat44 mInvBind = Mat44::sIdentity()
///
///
[FieldOffset(16)]
public float4x4 mInvBind;
}
///
///
/// A joint and its skin weight
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:239
///
/// class SkinWeight
///
///
[StructLayout(LayoutKind.Explicit, Size = 8)]
public partial struct SkinWeight
{
///
///
/// Index in mInvBindMatrices
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:248
///
/// uint32 mInvBindIndex = 0
///
///
[FieldOffset(0)]
public uint InvBindIndex;
///
///
/// Weight with which it is skinned
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:249
///
/// float mWeight = 0.0f
///
///
[FieldOffset(4)]
public float Weight;
}
///
///
/// A constraint that skins a vertex to joints and limits the distance that the simulated vertex can travel
/// from this vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:253
///
/// class Skinned
///
///
[StructLayout(LayoutKind.Explicit, Size = 52)]
public partial struct Skinned
{
///
///
/// Index in mVertices which indicates which vertex is being skinned
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:279
///
/// uint32 mVertex = 0
///
///
[FieldOffset(0)]
public uint Vertex;
///
///
/// Skin weights, the bind pose of the vertex is assumed to be stored in Vertex::mPosition. The first
/// weight that is zero indicates the end of the list. Weights should add up to 1.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:280
///
/// SkinWeight mWeights[cMaxSkinWeights]
///
///
[FieldOffset(4)]
public SkinWeight_4 Weights;
///
///
/// Maximum distance that this vertex can reach from the skinned vertex, disabled when FLT_MAX. 0 when
/// you want to hard skin the vertex to the skinned vertex.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:281
///
/// float mMaxDistance = FLT_MAX
///
///
[FieldOffset(36)]
public float MaxDistance;
///
///
/// Disabled if mBackStopDistance >= mMaxDistance. The faces surrounding mVertex determine an average
/// normal. mBackStopDistance behind the vertex in the opposite direction of this normal, the back stop
/// sphere starts. The simulated vertex will be pushed out of this sphere and it can be used to
/// approximate the volume of the skinned mesh behind the skinned vertex.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:282
///
/// float mBackStopDistance = FLT_MAX
///
///
[FieldOffset(40)]
public float BackStopDistance;
///
///
/// Radius of the backstop sphere. By default this is a fairly large radius so the sphere approximates a
/// plane.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:283
///
/// float mBackStopRadius = 40.0f
///
///
[FieldOffset(44)]
public float BackStopRadius;
///
///
/// Information needed to calculate the normal of this vertex, lowest 24 bit is start index in
/// mSkinnedConstraintNormals, highest 8 bit is number of faces (generated by
/// CalculateSkinnedConstraintNormals)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:284
///
/// uint32 mNormalInfo = 0
///
///
[FieldOffset(48)]
public uint NormalInfo;
}
///
///
/// A discrete Cosserat rod connects two particles with a rigid rod that has fixed length and inertia. A rod
/// can be used instead of an Edge to constraint two vertices. The orientation of the rod can be used to
/// orient geometry attached to the rod (e.g. a plant leaf). Note that each rod needs to be constrained by
/// at least one RodBendTwist constraint in order to constrain the rotation of the rod. If you don't do this
/// then the orientation is likely to rotate around the rod axis with constant velocity. Based on "Position
/// and Orientation Based Cosserat Rods" - Kugelstadt and Schoemer - SIGGRAPH 2016 See:
/// https://www.researchgate.net/publication/325597548_Position_and_Orientation_Based_Cosserat_Rods
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:312
///
/// struct RodStretchShear
///
///
[StructLayout(LayoutKind.Explicit, Size = 48)]
public partial struct RodStretchShear
{
///
///
/// Indices of the vertices that form the rod
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:323
///
/// uint32 mVertex[2]
///
///
[FieldOffset(0)]
public uint_2 Vertex;
///
///
/// Fixed length of the rod, calculated by CalculateRodProperties
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:324
///
/// float mLength = 1.0f
///
///
[FieldOffset(8)]
public float Length;
///
///
/// Inverse of the mass of the rod (0 for static rods), calculated by CalculateRodProperties but can be
/// overridden afterwards
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:325
///
/// float mInvMass = 1.0f
///
///
[FieldOffset(12)]
public float InvMass;
///
///
/// Inverse of the stiffness of the rod
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:326
///
/// float mCompliance = 0.0f
///
///
[FieldOffset(16)]
public float Compliance;
///
///
/// The Bishop frame of the rod (the rotation of the rod in its rest pose so that it has zero twist
/// towards adjacent rods), calculated by CalculateRodProperties
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:327
///
/// Quat mBishop = Quat::sZero()
///
///
[FieldOffset(32)]
public floatQuat Bishop;
}
///
///
/// A constraint that connects two Cosserat rods and limits bend and twist between the rods.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:331
///
/// struct RodBendTwist
///
///
[StructLayout(LayoutKind.Explicit, Size = 32)]
public partial struct RodBendTwist
{
///
///
/// Indices of rods that are constrained (index in mRodStretchShearConstraints)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:339
///
/// uint32 mRod[2]
///
///
[FieldOffset(0)]
public uint_2 Rod;
///
///
/// Inverse of the stiffness of the rod
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:340
///
/// float mCompliance = 0.0f
///
///
[FieldOffset(8)]
public float Compliance;
///
///
/// The initial rotation between the rods: rod1.mBishop.Conjugated() * rod2.mBishop, calculated by
/// CalculateRodProperties
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:341
///
/// Quat mOmega0 = Quat::sZero()
///
///
[FieldOffset(16)]
public floatQuat Omega0;
}
///
///
/// Tracks the closest kinematic vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:366
///
/// struct ClosestKinematic
///
///
[StructLayout(LayoutKind.Explicit, Size = 12)]
public partial struct ClosestKinematic
{
///
///
/// Vertex index of closest kinematic vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:368
///
/// uint32 mVertex = 0xffffffff
///
///
[FieldOffset(0)]
public uint Vertex;
///
///
/// Number of hops to the closest kinematic vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:369
///
/// uint32 mHops = 0xffffffff
///
///
[FieldOffset(4)]
public uint Hops;
///
///
/// Distance to the closest kinematic vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:370
///
/// float mDistance = FLT_MAX
///
///
[FieldOffset(8)]
public float Distance;
}
///
///
/// Tracks the end indices of the various constraint groups
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:374
///
/// struct UpdateGroup
///
///
[StructLayout(LayoutKind.Explicit, Size = 28)]
public partial struct UpdateGroup
{
///
///
/// The end index of the edge constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:376
///
/// uint mEdgeEndIndex
///
///
[FieldOffset(0)]
public uint EdgeEndIndex;
///
///
/// The end index of the LRA constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:377
///
/// uint mLRAEndIndex
///
///
[FieldOffset(4)]
public uint LRAEndIndex;
///
///
/// The end index of the rod stretch shear constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:378
///
/// uint mRodStretchShearEndIndex
///
///
[FieldOffset(8)]
public uint RodStretchShearEndIndex;
///
///
/// The end index of the rod bend twist constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:379
///
/// uint mRodBendTwistEndIndex
///
///
[FieldOffset(12)]
public uint RodBendTwistEndIndex;
///
///
/// The end index of the dihedral bend constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:380
///
/// uint mDihedralBendEndIndex
///
///
[FieldOffset(16)]
public uint DihedralBendEndIndex;
///
///
/// The end index of the volume constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:381
///
/// uint mVolumeEndIndex
///
///
[FieldOffset(20)]
public uint VolumeEndIndex;
///
///
/// The end index of the skinned constraints in this group
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:382
///
/// uint mSkinnedEndIndex
///
///
[FieldOffset(24)]
public uint SkinnedEndIndex;
}
public static SoftBodySharedSettings Create() => Jolt.PInvoke.SoftBodySharedSettings_Create();
///
///
/// Automatically create constraints based on the faces of the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:57
///
/// void CreateConstraints(const VertexAttributes *inVertexAttributes, uint inVertexAttributesLength, EBendType inBendType = EBendType::Distance, float inAngleTolerance = DegreesToRadians(8.0f))
///
///
///
///
/// Automatically create constraints based on the faces of the soft body
/// @param inVertexAttributes A list of attributes for each vertex (1-on-1 with mVertices, note that if the list is smaller than mVertices the last element will be repeated). This defines the properties of the constraints that are created.
/// @param inVertexAttributesLength The length of inVertexAttributes
/// @param inBendType The type of bend constraint to create
/// @param inAngleTolerance Shear edges are created when two connected triangles form a quad (are roughly in the same plane and form a square with roughly 90 degree angles). This defines the tolerance (in radians).
///
///
/// vertexAttributes is the buffer the native call reads, and its element count travels with it: the span is
/// only read, and it is only read for the duration of the call.
///
///
public unsafe void CreateConstraints(
ReadOnlySpan vertexAttributes,
SoftBodySharedSettings.BendType bendType = SoftBodySharedSettings.BendType.Distance,
float angleTolerance = 0.13962634f
)
{
fixed (SoftBodySharedSettings.VertexAttributes* vertexAttributes_fixed = vertexAttributes)
{
Jolt.PInvoke.SoftBodySharedSettings_CreateConstraints(
this,
vertexAttributes_fixed,
(uint)vertexAttributes.Length,
bendType,
angleTolerance
);
}
}
///
///
/// Calculate the initial lengths of all springs of the edges of this soft body (if you use
/// CreateConstraint, this is already done)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:60
///
/// void CalculateEdgeLengths()
///
///
public void CalculateEdgeLengths() => Jolt.PInvoke.SoftBodySharedSettings_CalculateEdgeLengths(this);
///
///
/// Calculate the properties of the rods Note that this can swap mVertex of the RodStretchShear constraints
/// if two rods are connected through a RodBendTwist constraint but point in opposite directions.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:64
///
/// void CalculateRodProperties()
///
///
public void CalculateRodProperties() => Jolt.PInvoke.SoftBodySharedSettings_CalculateRodProperties(this);
///
///
/// Calculate the max lengths for the long range attachment constraints based on Euclidean distance (if you
/// use CreateConstraints, this is already done)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:68
///
/// void CalculateLRALengths(float inMaxDistanceMultiplier = 1.0f)
///
///
///
///
/// Calculate the max lengths for the long range attachment constraints based on Euclidean distance (if you use CreateConstraints, this is already done)
/// @param inMaxDistanceMultiplier Multiplier for the max distance of the LRA constraint, e.g. 1.01 means the max distance is 1% longer than the calculated distance in the rest pose.
///
///
public void CalculateLRALengths(float maxDistanceMultiplier = 1f) =>
Jolt.PInvoke.SoftBodySharedSettings_CalculateLRALengths(this, maxDistanceMultiplier);
///
///
/// Calculate the constants for the bend constraints (if you use CreateConstraints, this is already done)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:71
///
/// void CalculateBendConstraintConstants()
///
///
public void CalculateBendConstraintConstants() =>
Jolt.PInvoke.SoftBodySharedSettings_CalculateBendConstraintConstants(this);
///
///
/// Calculates the initial volume of all tetrahedra of this soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:74
///
/// void CalculateVolumeConstraintVolumes()
///
///
public void CalculateVolumeConstraintVolumes() =>
Jolt.PInvoke.SoftBodySharedSettings_CalculateVolumeConstraintVolumes(this);
///
///
/// Calculate information needed to be able to calculate the skinned constraint normals at run-time
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:77
///
/// void CalculateSkinnedConstraintNormals()
///
///
public void CalculateSkinnedConstraintNormals() =>
Jolt.PInvoke.SoftBodySharedSettings_CalculateSkinnedConstraintNormals(this);
///
///
/// Optimize the soft body settings without results
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:96
///
/// void Optimize()
///
///
public void Optimize() => Jolt.PInvoke.SoftBodySharedSettings_Optimize(this);
///
///
/// Clone this object
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:99
///
/// Ref<SoftBodySharedSettings> Clone() const
///
///
///
///
/// The returned handle carries its own reference; Dispose it once when you're done.
///
///
public SoftBodySharedSettings Clone() => Jolt.PInvoke.SoftBodySharedSettings_Clone(this);
///
///
/// Saves the state of this object in binary form to inStream. Doesn't store the material list.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:102
///
/// void SaveBinaryState(StreamOut &inStream) const
///
///
public void SaveBinaryState(StreamOut stream) =>
Jolt.PInvoke.SoftBodySharedSettings_SaveBinaryState(this, stream);
///
///
/// Restore the state of this object from inStream. Doesn't restore the material list.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:105
///
/// void RestoreBinaryState(StreamIn &inStream)
///
///
public void RestoreBinaryState(StreamIn stream) =>
Jolt.PInvoke.SoftBodySharedSettings_RestoreBinaryState(this, stream);
///
///
/// Save this shared settings and its materials. Pass in an empty map ioSettingsMap / ioMaterialMap or reuse
/// the same map while saving multiple settings objects to the same stream in order to avoid writing
/// duplicates.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:113
///
/// void SaveWithMaterials(StreamOut &inStream, SharedSettingsToIDMap &ioSettingsMap, MaterialToIDMap &ioMaterialMap) const
///
///
public void SaveWithMaterials(
StreamOut stream,
SharedSettingsToIDMap settingsMap,
MaterialToIDMap materialMap
) => Jolt.PInvoke.SoftBodySharedSettings_SaveWithMaterials(this, stream, settingsMap, materialMap);
///
///
/// Restore a shape and materials. Pass in an empty map in ioSettingsMap / ioMaterialMap or reuse the same
/// map while reading multiple settings objects from the same stream in order to restore duplicates.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:118
///
/// static SettingsResult sRestoreWithMaterials(StreamIn &inStream, IDToSharedSettingsMap &ioSettingsMap, IDToMaterialMap &ioMaterialMap)
///
///
///
///
/// Throws JoltException with Jolt's error message when the operation fails.
///
///
public static SoftBodySharedSettings RestoreWithMaterials(
StreamIn stream,
IDToSharedSettingsMap settingsMap,
IDToMaterialMap materialMap
)
{
var _handle = Jolt.PInvoke.SoftBodySharedSettings_RestoreWithMaterials(stream, settingsMap, materialMap);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
///
///
/// Create a cube. This can be used to create a simple soft body for testing purposes. It will contain edge
/// constraints, volume constraints and faces.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:124
///
/// static Ref<SoftBodySharedSettings> sCreateCube(uint inGridSize, float inGridSpacing)
///
///
///
///
/// Create a cube. This can be used to create a simple soft body for testing purposes.
/// It will contain edge constraints, volume constraints and faces.
/// @param inGridSize Number of points along each axis
/// @param inGridSpacing Distance between points
///
///
/// The returned handle carries its own reference; Dispose it once when you're done.
///
///
public static SoftBodySharedSettings CreateCube(uint gridSize, float gridSpacing) =>
Jolt.PInvoke.SoftBodySharedSettings_CreateCube(gridSize, gridSpacing);
///
///
/// Add a face to this soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:345
///
/// void AddFace(const Face &inFace)
///
///
public void AddFace(in SoftBodySharedSettings.Face face) =>
Jolt.PInvoke.SoftBodySharedSettings_AddFace(this, in face);
///
///
/// The list of vertices or particles of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:347
///
/// Array<Vertex> mVertices
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetVertices()
{
Jolt.PInvoke.SoftBodySharedSettings_GetVertices(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// The list of vertices or particles of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:347
///
/// Array<Vertex> mVertices
///
///
public unsafe void SetVertices(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.Vertex* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetVertices(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of faces of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:348
///
/// Array<Face> mFaces
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetFaces()
{
Jolt.PInvoke.SoftBodySharedSettings_GetFaces(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// The list of faces of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:348
///
/// Array<Face> mFaces
///
///
public unsafe void SetFaces(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.Face* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetFaces(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of edges or springs of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:349
///
/// Array<Edge> mEdgeConstraints
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetEdgeConstraints()
{
Jolt.PInvoke.SoftBodySharedSettings_GetEdgeConstraints(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// The list of edges or springs of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:349
///
/// Array<Edge> mEdgeConstraints
///
///
public unsafe void SetEdgeConstraints(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.Edge* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetEdgeConstraints(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of dihedral bend constraints of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:350
///
/// Array<DihedralBend> mDihedralBendConstraints
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetDihedralBendConstraints()
{
Jolt.PInvoke.SoftBodySharedSettings_GetDihedralBendConstraints(this, out var _outResult);
return new Span(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
///
///
/// The list of dihedral bend constraints of the body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:350
///
/// Array<DihedralBend> mDihedralBendConstraints
///
///
public unsafe void SetDihedralBendConstraints(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.DihedralBend* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetDihedralBendConstraints(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:351
///
/// Array<Volume> mVolumeConstraints
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetVolumeConstraints()
{
Jolt.PInvoke.SoftBodySharedSettings_GetVolumeConstraints(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:351
///
/// Array<Volume> mVolumeConstraints
///
///
public unsafe void SetVolumeConstraints(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.Volume* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetVolumeConstraints(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of vertices that are constrained to a skinned vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:352
///
/// Array<Skinned> mSkinnedConstraints
///
///
///
///
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
/// It's only valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe Span GetSkinnedConstraints()
{
Jolt.PInvoke.SoftBodySharedSettings_GetSkinnedConstraints(this, out var _outResult);
return new Span((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// The list of vertices that are constrained to a skinned vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:352
///
/// Array<Skinned> mSkinnedConstraints
///
///
public unsafe void SetSkinnedConstraints(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.Skinned* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetSkinnedConstraints(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of inverse bind matrices for skinning vertices
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:353
///
/// Array<InvBind> mInvBindMatrices
///
///
///
///
/// 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 GetInvBindMatrices()
{
Jolt.PInvoke.SoftBodySharedSettings_GetInvBindMatrices(this, out var _outResult);
return new ReadOnlySpan(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
///
///
/// The list of inverse bind matrices for skinning vertices
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:353
///
/// Array<InvBind> mInvBindMatrices
///
///
public unsafe void SetInvBindMatrices(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.InvBind* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetInvBindMatrices(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The list of Cosserat rod constraints that connect two vertices and that limit stretch and shear
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:355
///
/// Array<RodStretchShear> mRodStretchShearConstraints
///
///
///
///
/// 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 GetRodStretchShearConstraints()
{
Jolt.PInvoke.SoftBodySharedSettings_GetRodStretchShearConstraints(this, out var _outResult);
return new ReadOnlySpan(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
///
///
/// The list of Cosserat rod constraints that connect two vertices and that limit stretch and shear
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:355
///
/// Array<RodStretchShear> mRodStretchShearConstraints
///
///
public unsafe void SetRodStretchShearConstraints(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.RodStretchShear* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetRodStretchShearConstraints(
this,
value_fixed,
(nuint)value.Length
);
}
}
///
///
/// The list of Cosserat rod constraints that connect two rods and limit the bend and twist
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:356
///
/// Array<RodBendTwist> mRodBendTwistConstraints
///
///
///
///
/// 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 GetRodBendTwistConstraints()
{
Jolt.PInvoke.SoftBodySharedSettings_GetRodBendTwistConstraints(this, out var _outResult);
return new ReadOnlySpan(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
///
///
/// The list of Cosserat rod constraints that connect two rods and limit the bend and twist
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:356
///
/// Array<RodBendTwist> mRodBendTwistConstraints
///
///
public unsafe void SetRodBendTwistConstraints(ReadOnlySpan value)
{
fixed (SoftBodySharedSettings.RodBendTwist* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetRodBendTwistConstraints(this, value_fixed, (nuint)value.Length);
}
}
///
///
/// The materials of the faces of the body, referenced by Face::mMaterialIndex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:357
///
/// PhysicsMaterialList mMaterials { PhysicsMaterial::sDefault }
///
///
///
///
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
/// themselves.
///
///
public NativeArray GetMaterials() =>
new NativeArray(Jolt.PInvoke.SoftBodySharedSettings_GetMaterials(this));
///
///
/// The materials of the faces of the body, referenced by Face::mMaterialIndex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodySharedSettings.h:357
///
/// PhysicsMaterialList mMaterials { PhysicsMaterial::sDefault }
///
///
public unsafe void SetMaterials(ReadOnlySpan value)
{
fixed (PhysicsMaterial* value_fixed = value)
{
Jolt.PInvoke.SoftBodySharedSettings_SetMaterials(this, value_fixed, (nuint)value.Length);
}
}
public void AddRef() => Jolt.PInvoke.SoftBodySharedSettings_AddRef(this);
public void Release() => Jolt.PInvoke.SoftBodySharedSettings_Release(this);
public uint GetRefCount() => Jolt.PInvoke.SoftBodySharedSettings_GetRefCount(this);
public void Dispose()
{
if (IsNull())
return;
Release();
}
}
}