21 void CalculateEdgeLengths();
24 void CalculateVolumeConstraintVolumes();
40 void SaveBinaryState(
StreamOut &inStream)
const;
43 void RestoreBinaryState(
StreamIn &inStream);
65 Vertex(const
Float3 &inPosition, const
Float3 &inVelocity =
Float3(0, 0, 0),
float inInvMass = 1.0f) : mPosition(inPosition), mVelocity(inVelocity), mInvMass(inInvMass) { }
69 float mInvMass = 1.0f;
79 Face(
uint32 inVertex1,
uint32 inVertex2,
uint32 inVertex3,
uint32 inMaterialIndex = 0) : mVertex { inVertex1, inVertex2, inVertex3 }, mMaterialIndex(inMaterialIndex) { }
82 bool IsDegenerate()
const {
return mVertex[0] == mVertex[1] || mVertex[0] == mVertex[2] || mVertex[1] == mVertex[2]; }
95 Edge(
uint32 inVertex1,
uint32 inVertex2,
float inCompliance = 0.0f) : mVertex { inVertex1, inVertex2 }, mCompliance(inCompliance) { }
98 float mRestLength = 1.0f;
99 float mCompliance = 0.0f;
109 Volume(
uint32 inVertex1,
uint32 inVertex2,
uint32 inVertex3,
uint32 inVertex4,
float inCompliance = 0.0f) : mVertex { inVertex1, inVertex2, inVertex3, inVertex4 }, mCompliance(inCompliance) { }
112 float mSixRestVolume = 1.0f;
113 float mCompliance = 0.0f;
120 uint GetEdgeGroupSize(
uint inGroupIdx)
const {
return inGroupIdx == 0? mEdgeGroupEndIndices[0] : mEdgeGroupEndIndices[inGroupIdx] - mEdgeGroupEndIndices[inGroupIdx - 1]; }
#define JPH_EXPORT
Definition Core.h:214
unsigned int uint
Definition Core.h:426
#define JPH_NAMESPACE_END
Definition Core.h:354
std::uint32_t uint32
Definition Core.h:429
#define JPH_NAMESPACE_BEGIN
Definition Core.h:348
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
Array< RefConst< PhysicsMaterial > > PhysicsMaterialList
Definition PhysicsMaterial.h:50
std::vector< T, STLAllocator< T > > Array
Definition STLAllocator.h:81
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:71
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition Float3.h:13
static RefConst< PhysicsMaterial > sDefault
Default material that is used when a shape has no materials defined.
Definition PhysicsMaterial.h:31
Definition Reference.h:35
Helper class that either contains a valid result or an error.
Definition Result.h:15
Information about the optimization of the soft body, the indices of certain elements may have changed...
Definition SoftBodySharedSettings.h:28
Array< uint > mEdgeRemap
Maps old edge index to new edge index.
Definition SoftBodySharedSettings.h:30
Definition SoftBodySharedSettings.h:16
Array< Vertex > mVertices
The list of vertices or particles of the body.
Definition SoftBodySharedSettings.h:122
StreamUtils::ObjectToIDMap< PhysicsMaterial > MaterialToIDMap
Definition SoftBodySharedSettings.h:47
void Optimize()
Optimize the soft body settings without results.
Definition SoftBodySharedSettings.h:37
StreamUtils::IDToObjectMap< SoftBodySharedSettings > IDToSharedSettingsMap
Definition SoftBodySharedSettings.h:46
Array< Face > mFaces
The list of faces of the body.
Definition SoftBodySharedSettings.h:123
uint GetEdgeGroupSize(uint inGroupIdx) const
Get the size of an edge group (edge groups can run in parallel)
Definition SoftBodySharedSettings.h:120
Array< Volume > mVolumeConstraints
The list of volume constraints of the body that keep the volume of tetrahedra in the soft body consta...
Definition SoftBodySharedSettings.h:126
StreamUtils::IDToObjectMap< PhysicsMaterial > IDToMaterialMap
Definition SoftBodySharedSettings.h:48
Array< Edge > mEdgeConstraints
The list of edges or springs of the body.
Definition SoftBodySharedSettings.h:124
void AddFace(const Face &inFace)
Add a face to this soft body.
Definition SoftBodySharedSettings.h:117
Array< uint > mEdgeGroupEndIndices
The start index of each group of edges that can be solved in parallel.
Definition SoftBodySharedSettings.h:125
StreamUtils::ObjectToIDMap< SoftBodySharedSettings > SharedSettingsToIDMap
Definition SoftBodySharedSettings.h:45
Simple binary input stream.
Definition StreamIn.h:13
Simple binary output stream.
Definition StreamOut.h:13
UnorderedMap< const Type *, uint32 > ObjectToIDMap
Definition StreamUtils.h:18
Array< Ref< Type > > IDToObjectMap
Definition StreamUtils.h:21
An edge keeps two vertices at a constant distance using a spring: |x1 - x2| = rest length.
Definition SoftBodySharedSettings.h:90
A face defines the surface of the body.
Definition SoftBodySharedSettings.h:74
bool IsDegenerate() const
Check if this is a degenerate face (a face which points to the same vertex twice)
Definition SoftBodySharedSettings.h:82
A vertex is a particle, the data in this structure is only used during creation of the soft body and ...
Definition SoftBodySharedSettings.h:60
Volume constraint, keeps the volume of a tetrahedron constant.
Definition SoftBodySharedSettings.h:104