Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
SoftBodySharedSettings Class Reference

#include <SoftBodySharedSettings.h>

Inheritance diagram for SoftBodySharedSettings:
RefTarget< SoftBodySharedSettings >

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. More...
 
void CalculateVolumeConstraintVolumes ()
 Calculates the initial volume of all tetrahedra of this soft body. More...
 
void Optimize (OptimizationResults &outResults)
 Optimize the soft body settings for simulation. This will reorder constraints so they can be executed in parallel. More...
 
void Optimize ()
 Optimize the soft body settings without results. More...
 
void SaveBinaryState (StreamOut &inStream) const
 Saves the state of this object in binary form to inStream. Doesn't store the material list. More...
 
void RestoreBinaryState (StreamIn &inStream)
 Restore the state of this object from inStream. Doesn't restore the material list. More...
 
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. More...
 
void AddFace (const Face &inFace)
 Add a face to this soft body. More...
 
uint GetEdgeGroupSize (uint inGroupIdx) const
 Get the size of an edge group (edge groups can run in parallel) More...
 
- Public Member Functions inherited from RefTarget< SoftBodySharedSettings >
 RefTarget ()=default
 Constructor. More...
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us More...
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator. More...
 
uint32 GetRefCount () const
 Get current refcount of this object. More...
 
void AddRef () const
 Add or release a reference to this object. More...
 
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. More...
 
- Static Public Member Functions inherited from RefTarget< SoftBodySharedSettings >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More...
 

Public Attributes

Array< VertexmVertices
 The list of vertices or particles of the body. More...
 
Array< FacemFaces
 The list of faces of the body. More...
 
Array< EdgemEdgeConstraints
 The list of edges or springs of the body. More...
 
Array< uintmEdgeGroupEndIndices
 The start index of each group of edges that can be solved in parallel. More...
 
Array< VolumemVolumeConstraints
 The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant. More...
 
PhysicsMaterialList mMaterials { PhysicsMaterial::sDefault }
 The materials of the faces of the body, referenced by Face::mMaterialIndex. More...
 

Additional Inherited Members

- Protected Attributes inherited from RefTarget< SoftBodySharedSettings >
atomic< uint32mRefCount
 Current reference count. More...
 
- 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. More...
 

Detailed Description

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.

Member Typedef Documentation

◆ IDToMaterialMap

◆ IDToSharedSettingsMap

◆ MaterialToIDMap

◆ SettingsResult

◆ SharedSettingsToIDMap

Member Function Documentation

◆ AddFace()

void SoftBodySharedSettings::AddFace ( const Face inFace)
inline

Add a face to this soft body.

◆ CalculateEdgeLengths()

void SoftBodySharedSettings::CalculateEdgeLengths ( )

Calculate the initial lengths of all springs of the edges of this soft body.

◆ CalculateVolumeConstraintVolumes()

void SoftBodySharedSettings::CalculateVolumeConstraintVolumes ( )

Calculates the initial volume of all tetrahedra of this soft body.

◆ GetEdgeGroupSize()

uint SoftBodySharedSettings::GetEdgeGroupSize ( uint  inGroupIdx) const
inline

Get the size of an edge group (edge groups can run in parallel)

◆ Optimize() [1/2]

void SoftBodySharedSettings::Optimize ( )
inline

Optimize the soft body settings without results.

◆ Optimize() [2/2]

void SoftBodySharedSettings::Optimize ( OptimizationResults outResults)

Optimize the soft body settings for simulation. This will reorder constraints so they can be executed in parallel.

◆ RestoreBinaryState()

void SoftBodySharedSettings::RestoreBinaryState ( StreamIn inStream)

Restore the state of this object from inStream. Doesn't restore the material list.

◆ SaveBinaryState()

void SoftBodySharedSettings::SaveBinaryState ( StreamOut inStream) const

Saves the state of this object in binary form to inStream. Doesn't store the material list.

◆ SaveWithMaterials()

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.

◆ sRestoreWithMaterials()

SoftBodySharedSettings::SettingsResult SoftBodySharedSettings::sRestoreWithMaterials ( StreamIn inStream,
IDToSharedSettingsMap ioSettingsMap,
IDToMaterialMap ioMaterialMap 
)
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.

Member Data Documentation

◆ mEdgeConstraints

Array<Edge> SoftBodySharedSettings::mEdgeConstraints

The list of edges or springs of the body.

◆ mEdgeGroupEndIndices

Array<uint> SoftBodySharedSettings::mEdgeGroupEndIndices

The start index of each group of edges that can be solved in parallel.

◆ mFaces

Array<Face> SoftBodySharedSettings::mFaces

The list of faces of the body.

◆ mMaterials

PhysicsMaterialList SoftBodySharedSettings::mMaterials { PhysicsMaterial::sDefault }

The materials of the faces of the body, referenced by Face::mMaterialIndex.

◆ mVertices

Array<Vertex> SoftBodySharedSettings::mVertices

The list of vertices or particles of the body.

◆ mVolumeConstraints

Array<Volume> SoftBodySharedSettings::mVolumeConstraints

The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant.


The documentation for this class was generated from the following files: