Package com.github.stephengold.joltjni
Class SoftBodySharedSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.SoftBodySharedSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstSoftBodySharedSettings,RefTarget,AutoCloseable,Comparable<JoltPhysicsObject>
public class SoftBodySharedSettings
extends JoltPhysicsObject
implements ConstSoftBodySharedSettings, RefTarget
Properties of a soft body that may be shared among multiple bodies.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate with the default settings.Instantiate a copy of the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEdgeConstraint(ConstEdge edge) Add the specified edge constraint.voidAdd the specified face.voidaddInvBindMatrix(InvBind invBind) Append the specified inverse-bind matrix.voidaddRodBendTwistConstraint(ConstRodBendTwist constraint) Append the specified bend-twist constraint.voidAppend the specified discrete Cosserat rod.voidaddSkinnedConstraint(Skinned skinned) Append the specified skinning constraint.voidaddVertex(ConstVertex vertex) Add the specified vertex.voidaddVolumeConstraint(ConstVolume volume) Add the specified volume constraint.voidCalculate the initial lengths of all edges in the body.voidCalculate the information needed to simulate Cosserat rods.voidCalculate the information needed for skinned constraint normals.voidCalculate the initial volumes of all tetrahedra in the body.intCount the edge constraints.intCount the faces.intCount the pinned vertices.intCount the bend-twist constraints.intCount the discrete Cosserat rods.intCount the vertices.intCount the volume constraints.voidcreateConstraints(ConstVertexAttributes[] vertexAttributes, EBendType bendType) Automatically generate constraints based on the faces.voidcreateConstraints(ConstVertexAttributes[] vertexAttributes, EBendType bendType, float angleTolerance) Automatically generate constraints based on the faces.voidcreateConstraints(ConstVertexAttributes vertexAttributes, int numAttributes, EBendType bendType) Automatically generate constraints based on the faces.Edge[]Enumerate all edge constraints in the settings.intCount the active references to the nativeSoftBodySharedSettings.Enumerate all bend-twist constraints in the settings.Enumerate all Cosserat rods in the settings.getVertex(int index) Access the specified vertex.Vertex[]Enumerate all vertices in the settings.voidoptimize()Optimize the settings without writing any results.voidputEdgeIndices(IntBuffer storeIndices) Write the vertex indices of all edges to the specified buffer and advance the buffer's position.voidputFaceIndices(IntBuffer storeIndices) Write the vertex indices of all faces to the specified buffer and advance the buffer's position.voidputRodIndices(IntBuffer storeIndices) Write the vertex indices of all Cosserat rods to the specified buffer and advance the buffer's position.voidrestoreBinaryState(StreamIn stream) Read the state of this object from the specified stream, excluding the shape and group filter.voidsaveBinaryState(StreamOut stream) Write the state of this object to the specified stream, excluding the materials.voidsaveWithMaterials(StreamOut stream, SharedSettingsToIdMap settingsMap, MaterialToIdMap materialMap) Write the state of this object to the specified stream.static SoftBodySharedSettingsRefsCreateCube(int gridSize, float gridSpacing) Create a cube with edge constraints, volume constraints, and faces.voidMark the nativeSoftBodySharedSettingsas embedded.voidsetMaterials(PhysicsMaterial material) Replace the materials.static SettingsResultsRestoreWithMaterials(StreamIn stream, IdToSharedSettingsMap settingsMap, IdToMaterialMap materialMap) Read a settings object from the specified binary stream.toRef()Create a counted reference to the nativeSoftBodySharedSettings.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
SoftBodySharedSettings
public SoftBodySharedSettings()Instantiate with the default settings.
-
-
Method Details
-
addEdgeConstraint
Add the specified edge constraint.- Parameters:
edge- the edge to add (not null, unaffected)
-
addFace
Add the specified face.- Parameters:
face- the face to add (not null, unaffected)
-
addInvBindMatrix
Append the specified inverse-bind matrix. (native member: mInvBindMatrices)- Parameters:
invBind- the matrix to add (not null)
-
addRodBendTwistConstraint
Append the specified bend-twist constraint. (native member: mRodBendTwistConstraints)- Parameters:
constraint- the constraint to add (not null)
-
addRodStretchShearConstraint
Append the specified discrete Cosserat rod. (native member: mRodStretchShearConstraints)- Parameters:
rod- the rod to add (not null)
-
addSkinnedConstraint
Append the specified skinning constraint. (native member: mSkinnedConstraints)- Parameters:
skinned- the constraint to add (not null)
-
addVertex
Add the specified vertex. (native member: mVertices)- Parameters:
vertex- the vertex to add (not null, unaffected)
-
addVolumeConstraint
Add the specified volume constraint.- Parameters:
volume- the constraint to add (not null, unaffected)
-
calculateEdgeLengths
public void calculateEdgeLengths()Calculate the initial lengths of all edges in the body. -
calculateRodProperties
public void calculateRodProperties()Calculate the information needed to simulate Cosserat rods. -
calculateSkinnedConstraintNormals
public void calculateSkinnedConstraintNormals()Calculate the information needed for skinned constraint normals. -
calculateVolumeConstraintVolumes
public void calculateVolumeConstraintVolumes()Calculate the initial volumes of all tetrahedra in the body. -
createConstraints
public void createConstraints(ConstVertexAttributes vertexAttributes, int numAttributes, EBendType bendType) Automatically generate constraints based on the faces.- Parameters:
vertexAttributes- the desired attributes (one for each vertex)numAttributes- the number of attributes provided (≥0)bendType- the desired type of bend constraint (not null, default=Distance)
-
createConstraints
Automatically generate constraints based on the faces.- Parameters:
vertexAttributes- the desired attributes (one for each vertex)bendType- the desired type of bend constraint (not null, default=Distance)
-
createConstraints
public void createConstraints(ConstVertexAttributes[] vertexAttributes, EBendType bendType, float angleTolerance) Automatically generate constraints based on the faces.- Parameters:
vertexAttributes- the desired attributes (one for each vertex)bendType- the desired type of bend constraint (not null, default=Distance)angleTolerance- the desired tolerance for creating shear edges (in radians, default=2*Pi/45)
-
optimize
public void optimize()Optimize the settings without writing any results. -
restoreBinaryState
Read the state of this object from the specified stream, excluding the shape and group filter.- Parameters:
stream- where to read objects from (not null)
-
sCreateCube
Create a cube with edge constraints, volume constraints, and faces.- Parameters:
gridSize- the desired number of points on each axis (≥1)gridSpacing- the distance between adjacent points- Returns:
- a counted reference to new settings
-
setMaterials
Replace the materials. (native member: mMaterials)- Parameters:
material- the desired material, ornull
-
countEdgeConstraints
public int countEdgeConstraints()Count the edge constraints. The settings are unaffected. (native member: mEdgeConstraints)- Specified by:
countEdgeConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
countFaces
public int countFaces()Count the faces. The settings are unaffected. (native member: mFaces)- Specified by:
countFacesin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
countPinnedVertices
public int countPinnedVertices()Count the pinned vertices. The settings are unaffected.- Specified by:
countPinnedVerticesin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
countRodBendTwistConstraints
public int countRodBendTwistConstraints()Count the bend-twist constraints. The settings are unaffected. (native member: mRodBendTwistConstraint)- Specified by:
countRodBendTwistConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
countRodStretchShearConstraints
public int countRodStretchShearConstraints()Count the discrete Cosserat rods. The settings are unaffected. (native member: mRodStretchShearConstraint)- Specified by:
countRodStretchShearConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
countVertices
public int countVertices()Count the vertices. The settings are unaffected. (native member: mVertices)- Specified by:
countVerticesin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
countVolumeConstraints
public int countVolumeConstraints()Count the volume constraints. The settings are unaffected. (native member: mVolumeConstraints)- Specified by:
countVolumeConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- the count (≥0)
-
getEdgeConstraints
Enumerate all edge constraints in the settings. (native member: mEdgeConstraints)- Specified by:
getEdgeConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- a new array of new JVM objects with the pre-existing native objects assigned
-
getRodBendTwistConstraints
Enumerate all bend-twist constraints in the settings. (native member: mRodBendTwistConstraints)- Specified by:
getRodBendTwistConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- a new array of new JVM objects with the pre-existing native objects assigned
-
getRodStretchShearConstraints
Enumerate all Cosserat rods in the settings. (native member: mRodStretchShearConstraints)- Specified by:
getRodStretchShearConstraintsin interfaceConstSoftBodySharedSettings- Returns:
- a new array of new JVM objects with the pre-existing native objects assigned
-
getVertex
Access the specified vertex.- Specified by:
getVertexin interfaceConstSoftBodySharedSettings- Parameters:
index- the index of the vertex (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getVertices
Enumerate all vertices in the settings. (native member: mVertices)- Specified by:
getVerticesin interfaceConstSoftBodySharedSettings- Returns:
- a new array of new JVM objects with pre-existing native objects assigned
-
putEdgeIndices
Write the vertex indices of all edges to the specified buffer and advance the buffer's position. The settings are unaffected.- Specified by:
putEdgeIndicesin interfaceConstSoftBodySharedSettings- Parameters:
storeIndices- the destination buffer (not null, modified)
-
putFaceIndices
Write the vertex indices of all faces to the specified buffer and advance the buffer's position. The settings are unaffected.- Specified by:
putFaceIndicesin interfaceConstSoftBodySharedSettings- Parameters:
storeIndices- the destination buffer (not null, modified)
-
putRodIndices
Write the vertex indices of all Cosserat rods to the specified buffer and advance the buffer's position. The settings are unaffected.- Specified by:
putRodIndicesin interfaceConstSoftBodySharedSettings- Parameters:
storeIndices- the destination buffer (not null, modified)
-
saveBinaryState
Write the state of this object to the specified stream, excluding the materials. The settings are unaffected.- Specified by:
saveBinaryStatein interfaceConstSoftBodySharedSettings- Parameters:
stream- where to write objects (notnull)
-
getRefCount
public int getRefCount()Count the active references to the nativeSoftBodySharedSettings. The settings are unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeSoftBodySharedSettingsas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeSoftBodySharedSettings.
-