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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEdgeConstraint
(Edge edge) Add the specified edge constraint.void
Add the specified face.void
addInvBindMatrix
(InvBind invBind) Append the specified inverse-bind matrix.void
addSkinnedConstraint
(Skinned skinned) Append the specified skinning constraint.void
Add the specified vertex.void
addVolumeConstraint
(Volume volume) Add the specified volume constraint.void
Calculate the initial lengths of all edges in the body.void
Calculate the information needed for skinned constraint normals.void
Calculate the initial volumes of all tetrahedra in the body.int
Count the edge constraints.int
Count the faces.int
Count the pinned vertices.int
Count the vertices.int
Count the volume constraints.void
createConstraints
(ConstVertexAttributes[] vertexAttributes, EBendType bendType) Automatically generate constraints based on the faces.void
createConstraints
(ConstVertexAttributes[] vertexAttributes, EBendType bendType, float angleTolerance) Automatically generate constraints based on the faces.void
createConstraints
(ConstVertexAttributes vertexAttributes, int numAttributes, EBendType bendType) Automatically generate constraints based on the faces.Edge[]
Enumerate all edge constraints in the settings.int
Count the active references to the nativeSoftBodySharedSettings
.getVertex
(int index) Access the specified vertex.float
Return the radius of each particle.Vertex[]
Enumerate all vertices in the settings.void
optimize()
Optimize the settings without writing any results.void
putEdgeIndices
(IntBuffer storeIndices) Write the vertex indices of all edges to the specified buffer and advance the buffer's position.void
putFaceIndices
(IntBuffer storeIndices) Write the vertex indices of all faces to the specified buffer and advance the buffer's position.static SoftBodySharedSettingsRef
sCreateCube
(int gridSize, float gridSpacing) Create a cube with edge constraints, volume constraints, and faces.void
Mark the nativeSoftBodySharedSettings
as embedded.void
setMaterials
(PhysicsMaterial material) Replace the materials.void
setVertexRadius
(float radius) Alter the size of every particle.toRef()
Create a counted reference to the nativeSoftBodySharedSettings
.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods 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 property: mInvBindMatrices)- Parameters:
invBind
- the matrix to add (not null)
-
addSkinnedConstraint
Append the specified skinning constraint. (native property: mSkinnedConstraints)- Parameters:
skinned
- the constraint to add (not null)
-
addVertex
Add the specified vertex. (native attribute: 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. -
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)
-
getEdgeConstraints
Enumerate all edge constraints in the settings. (native attribute: mEdgeConstraints)- Returns:
- a new array of new JVM objects with the pre-existing native objects assigned
-
getVertex
Access the specified vertex.- 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 attribute: mVertices)- Returns:
- a new array of new JVM objects with pre-existing native objects assigned
-
optimize
public void optimize()Optimize the settings without writing any results. -
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 attribute: mMaterials)- Parameters:
material
- the desired material, ornull
-
setVertexRadius
public void setVertexRadius(float radius) Alter the size of every particle.- Parameters:
radius
- the desired radius (≥0, default=0)
-
countEdgeConstraints
public int countEdgeConstraints()Count the edge constraints. The settings are unaffected. (native attribute: mEdgeConstraints)- Specified by:
countEdgeConstraints
in interfaceConstSoftBodySharedSettings
- Returns:
- the count (≥0)
-
countFaces
public int countFaces()Count the faces. The settings are unaffected. (native attribute: mFaces)- Specified by:
countFaces
in interfaceConstSoftBodySharedSettings
- Returns:
- the count (≥0)
-
countPinnedVertices
public int countPinnedVertices()Count the pinned vertices. The settings are unaffected.- Specified by:
countPinnedVertices
in interfaceConstSoftBodySharedSettings
- Returns:
- the count (≥0)
-
countVertices
public int countVertices()Count the vertices. The settings are unaffected. (native attribute: mVertices)- Specified by:
countVertices
in interfaceConstSoftBodySharedSettings
- Returns:
- the count (≥0)
-
countVolumeConstraints
public int countVolumeConstraints()Count the volume constraints. The settings are unaffected. (native attribute: mVolumeConstraints)- Specified by:
countVolumeConstraints
in interfaceConstSoftBodySharedSettings
- Returns:
- the count (≥0)
-
getVertexRadius
public float getVertexRadius()Return the radius of each particle. The settings are unaffected. (native attribute: mVertexRadius)- Specified by:
getVertexRadius
in interfaceConstSoftBodySharedSettings
- Returns:
- the radius (in meters)
-
putEdgeIndices
Write the vertex indices of all edges to the specified buffer and advance the buffer's position. The settings are unaffected.- Specified by:
putEdgeIndices
in 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:
putFaceIndices
in interfaceConstSoftBodySharedSettings
- Parameters:
storeIndices
- the destination buffer (not null, modified)
-
getRefCount
public int getRefCount()Count the active references to the nativeSoftBodySharedSettings
. The settings are unaffected.- Specified by:
getRefCount
in interfaceRefTarget
- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeSoftBodySharedSettings
as embedded.- Specified by:
setEmbedded
in interfaceRefTarget
-
toRef
Create a counted reference to the nativeSoftBodySharedSettings
.
-