Jolt Physics
A multi core friendly Game Physics Engine
|
#include <SoftBodySharedSettings.h>
Classes | |
struct | Edge |
An edge keeps two vertices at a constant distance using a spring: |x1 - x2| = rest length. More... | |
struct | Face |
A face defines the surface of the body. More... | |
class | OptimizationResults |
Information about the optimization of the soft body, the indices of certain elements may have changed. More... | |
struct | Vertex |
A vertex is a particle, the data in this structure is only used during creation of the soft body and not during simulation. More... | |
struct | Volume |
Volume constraint, keeps the volume of a tetrahedron constant. More... | |
Public Types | |
using | SharedSettingsToIDMap = StreamUtils::ObjectToIDMap<SoftBodySharedSettings> |
using | IDToSharedSettingsMap = StreamUtils::IDToObjectMap<SoftBodySharedSettings> |
using | MaterialToIDMap = StreamUtils::ObjectToIDMap<PhysicsMaterial> |
using | IDToMaterialMap = StreamUtils::IDToObjectMap<PhysicsMaterial> |
using | SettingsResult = Result<Ref<SoftBodySharedSettings>> |
Public Member Functions | |
void | CalculateEdgeLengths () |
Calculate the initial lengths of all springs of the edges of this soft body. | |
void | CalculateVolumeConstraintVolumes () |
Calculates the initial volume of all tetrahedra of this soft body. | |
void | Optimize (OptimizationResults &outResults) |
Optimize the soft body settings for simulation. This will reorder constraints so they can be executed in parallel. | |
void | Optimize () |
Optimize the soft body settings without results. | |
void | SaveBinaryState (StreamOut &inStream) const |
Saves the state of this object in binary form to inStream. Doesn't store the material list. | |
void | RestoreBinaryState (StreamIn &inStream) |
Restore the state of this object from inStream. Doesn't restore the material list. | |
void | SaveWithMaterials (StreamOut &inStream, SharedSettingsToIDMap &ioSettingsMap, MaterialToIDMap &ioMaterialMap) const |
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. | |
void | AddFace (const Face &inFace) |
Add a face to this soft body. | |
uint | GetEdgeGroupSize (uint inGroupIdx) const |
Get the size of an edge group (edge groups can run in parallel) | |
Public Member Functions inherited from RefTarget< SoftBodySharedSettings > | |
RefTarget ()=default | |
Constructor. | |
RefTarget (const RefTarget &) | |
~RefTarget () | |
assert no one is referencing us | |
void | SetEmbedded () const |
RefTarget & | operator= (const RefTarget &) |
Assignment operator. | |
uint32 | GetRefCount () const |
Get current refcount of this object. | |
void | AddRef () const |
Add or release a reference to this object. | |
void | Release () const |
Static Public Member Functions | |
static SettingsResult | sRestoreWithMaterials (StreamIn &inStream, IDToSharedSettingsMap &ioSettingsMap, IDToMaterialMap &ioMaterialMap) |
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. | |
Static Public Member Functions inherited from RefTarget< SoftBodySharedSettings > | |
static int | sInternalGetRefCountOffset () |
INTERNAL HELPER FUNCTION USED BY SERIALIZATION. | |
Public Attributes | |
Array< Vertex > | mVertices |
The list of vertices or particles of the body. | |
Array< Face > | mFaces |
The list of faces of the body. | |
Array< Edge > | mEdgeConstraints |
The list of edges or springs of the body. | |
Array< uint > | mEdgeGroupEndIndices |
The start index of each group of edges that can be solved in parallel. | |
Array< Volume > | mVolumeConstraints |
The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant. | |
PhysicsMaterialList | mMaterials { PhysicsMaterial::sDefault } |
The materials of the faces of the body, referenced by Face::mMaterialIndex. | |
Additional Inherited Members | |
Protected Attributes inherited from RefTarget< SoftBodySharedSettings > | |
atomic< uint32 > | mRefCount |
Current reference count. | |
Static Protected Attributes inherited from RefTarget< SoftBodySharedSettings > | |
static constexpr uint32 | cEmbedded |
A large value that gets added to the refcount to mark the object as embedded. | |
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.
using SoftBodySharedSettings::IDToSharedSettingsMap = StreamUtils::IDToObjectMap<SoftBodySharedSettings> |
using SoftBodySharedSettings::SharedSettingsToIDMap = StreamUtils::ObjectToIDMap<SoftBodySharedSettings> |
|
inline |
Add a face to this soft body.
void SoftBodySharedSettings::CalculateEdgeLengths | ( | ) |
Calculate the initial lengths of all springs of the edges of this soft body.
void SoftBodySharedSettings::CalculateVolumeConstraintVolumes | ( | ) |
Calculates the initial volume of all tetrahedra of this soft body.
Get the size of an edge group (edge groups can run in parallel)
|
inline |
Optimize the soft body settings without results.
void SoftBodySharedSettings::Optimize | ( | OptimizationResults & | outResults | ) |
Optimize the soft body settings for simulation. This will reorder constraints so they can be executed in parallel.
void SoftBodySharedSettings::RestoreBinaryState | ( | StreamIn & | inStream | ) |
Restore the state of this object from inStream. Doesn't restore the material list.
void SoftBodySharedSettings::SaveBinaryState | ( | StreamOut & | inStream | ) | const |
Saves the state of this object in binary form to inStream. Doesn't store the material list.
void SoftBodySharedSettings::SaveWithMaterials | ( | StreamOut & | inStream, |
SharedSettingsToIDMap & | ioSettingsMap, | ||
MaterialToIDMap & | ioMaterialMap ) const |
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.
|
static |
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.
The start index of each group of edges that can be solved in parallel.
PhysicsMaterialList SoftBodySharedSettings::mMaterials { PhysicsMaterial::sDefault } |
The materials of the faces of the body, referenced by Face::mMaterialIndex.
The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant.