java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.HairSettings
- All Implemented Interfaces:
ConstHairSettings,ConstJoltPhysicsObject,RefTarget,AutoCloseable,Comparable<JoltPhysicsObject>
Settings used to construct a hair simulation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intdefault simulation rate for hair (in iterations per second) -
Constructor Summary
ConstructorsConstructorDescriptionInstantiate default settings.HairSettings(ConstHairSettings original) Instantiate a copy of the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMaterial(ConstHairMaterial material) Append the specified material.intReturn the number of materials.intReturn the number of render strands.intReturn the number of render vertices.intReturn the number of triangles in the scalp mesh.intReturn the number of vertices in the scalp mesh.intReturn the number of simulation strands.Copy the initial gravity vector.getMaterial(int index) Access the specified material.Access the materials.intReturn the iteration rate.intCount the active references to the nativeHairSettings.getRenderStrand(int index) Access the specified render strand.RStrand[]Access the render strands.intAlter the number of skinning weights per vertex.getScalpTriangle(int triangleIndex) Access the vertex indices of the specified triangle in the scalp mesh.Access the vertex indices of the triangles in the scalp mesh.getScalpVertex(int vertexIndex) Copy the specified vertex in the scalp mesh.getSimStrand(int strandIndex) Access the specified simulation strand.Access the simulation bounds.voidinit(float[] maxDistSqHairToScalp) Calculate simulation bounds and vertex properties.voidinitCompute(ComputeSystem system) Further initialization to set up compute buffers.voidinitRenderAndSimulationStrands(SVertexList vertices, SStrandList strands) Split the supplied strands into render and simulation strands and calculate connections between them.voidrestoreBinaryState(StreamIn streamIn) Read the state of this object from the specified stream, excluding the shape and group filter.voidsaveBinaryState(StreamOut streamOut) Write the state of this object to the specified stream, excluding the compute buffers.voidMark the nativeHairSettingsas embedded.setInitialGravity(Vec3Arg gravity) Alter the initial gravity vector.setNumIterationsPerSecond(int numIterations) Alter the iteration rate.setScalpInverseBindPose(Mat44Arg... pose) Alter the scalp mesh-vertex locations in bind pose.setScalpNumSkinWeightsPerVertex(int numWeights) Alter the number of skinning weights per vertex.setScalpSkinWeights(HairSkinWeight... weights) Alter the scalp skinning weights.setScalpTriangles(ConstIndexedTriangleNoMaterial... triangles) Alter the scalp mesh-triangle indices.setScalpVertices(ConstFloat3... vertices) Alter the scalp mesh-vertex locations.setSimulationBoundsPadding(Vec3Arg padding) Alter how much padding to add on all sides of the neutral pose when determining the bounds of the simulation grid.static voidsResample(SVertexList vertices, SStrandList strands, int numVerticesPerStrand) Resample the hairs to the specified number of vertices per strand.toRef()Create a counted reference to the nativeHairSettings.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
-
Field Details
-
cDefaultIterationsPerSecond
public static final int cDefaultIterationsPerSeconddefault simulation rate for hair (in iterations per second)- See Also:
-
-
Constructor Details
-
HairSettings
public HairSettings()Instantiate default settings. -
HairSettings
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
Method Details
-
addMaterial
Append the specified material. (native member: mMaterial)- Parameters:
material- the material to add (notnull)
-
getMaterials
Access the materials. (native member: mMaterial)- Returns:
- a new array containing new JVM objects with the pre-existing native objects assigned
-
getRenderStrands
Access the render strands. (native member: mRenderStrands)- Returns:
- a new array containing new JVM objects with the pre-existing native objects assigned
-
getScalpTriangles
Access the vertex indices of the triangles in the scalp mesh. (native member: mScalpTriangles)- Returns:
- a new array containing new JVM objects with the pre-existing native objects assigned
-
init
public void init(float[] maxDistSqHairToScalp) Calculate simulation bounds and vertex properties.- Parameters:
maxDistSqHairToScalp- storage for the maximum squared distance of a root vertex from the scalp (notnull, length>0)
-
initCompute
Further initialization to set up compute buffers. Invoke afterinit().- Parameters:
system- the compute system to use (notnull)
-
initRenderAndSimulationStrands
Split the supplied strands into render and simulation strands and calculate connections between them.- Parameters:
vertices- the vertices to be used in strands (notnull)strands- the strands to use (notnull)
-
restoreBinaryState
Read the state of this object from the specified stream, excluding the shape and group filter.- Parameters:
streamIn- where to read objects from (notnull)
-
setInitialGravity
Alter the initial gravity vector. (native member: mInitialGravity)- Parameters:
gravity- the desired acceleration vector (meters per second squared in system coordinates, notnull, unaffected, default=(0,-9.81,0))- Returns:
- the modified settings, for chaining
-
setNumIterationsPerSecond
Alter the iteration rate. (native member: mNumIterationsPerSecond)- Parameters:
numIterations- the desired number of iterations (≥1, default=360)- Returns:
- the modified settings, for chaining
-
setScalpInverseBindPose
Alter the scalp mesh-vertex locations in bind pose. (native member: mScalpInverseBindPose)- Parameters:
pose- the desired pose (notnull, unaffected)- Returns:
- the modified settings, for chaining
-
setScalpNumSkinWeightsPerVertex
Alter the number of skinning weights per vertex. (native member: mScalpNumSkinWeightsPerVertex)- Parameters:
numWeights- the desired number of weights (≥0, default=0)- Returns:
- the modified settings, for chaining
-
setScalpSkinWeights
Alter the scalp skinning weights. (native member: mScalpSkinWeights)- Parameters:
weights- the desired weights of the scalp mesh (notnull,mScalpNumSkinWeightsPerVertexelements per vertex, unaffected)- Returns:
- the modified settings, for chaining
-
setScalpTriangles
Alter the scalp mesh-triangle indices. (native member: mScalpTriangles)- Parameters:
triangles- the desired vertex indices (notnull, unaffected)- Returns:
- the modified settings, for chaining
-
setScalpVertices
Alter the scalp mesh-vertex locations. (native member: mScalpVertices)- Parameters:
vertices- the desired locations (notnull, unaffected)- Returns:
- the modified settings, for chaining
-
setSimulationBoundsPadding
Alter how much padding to add on all sides of the neutral pose when determining the bounds of the simulation grid. (native member: mSimulationBoundsPadding)- Parameters:
padding- the desired amount of padding along each axis (in meters, notnull)- Returns:
- the modified settings, for chaining
-
sResample
Resample the hairs to the specified number of vertices per strand. Invoke beforeinit().- Parameters:
vertices- the vertex list to use (notnull)strands- the strands to use (notnull)numVerticesPerStrand- the desired number of vertices per strand
-
countMaterials
public int countMaterials()Return the number of materials. The settings are unaffected. (native member: mMaterial)- Specified by:
countMaterialsin interfaceConstHairSettings- Returns:
- the count (≥0)
-
countRenderStrands
public int countRenderStrands()Return the number of render strands. The settings are unaffected. (native member: mRenderStrands)- Specified by:
countRenderStrandsin interfaceConstHairSettings- Returns:
- the count (≥0)
-
countRenderVertices
public int countRenderVertices()Return the number of render vertices. The settings are unaffected. (native member: mRenderVertices)- Specified by:
countRenderVerticesin interfaceConstHairSettings- Returns:
- the count (≥0)
-
countScalpTriangles
public int countScalpTriangles()Return the number of triangles in the scalp mesh. The settings are unaffected. (native member: mScalpTriangles)- Specified by:
countScalpTrianglesin interfaceConstHairSettings- Returns:
- the count (≥0)
-
countScalpVertices
public int countScalpVertices()Return the number of vertices in the scalp mesh. The settings are unaffected. (native member: mScalpVertices)- Specified by:
countScalpVerticesin interfaceConstHairSettings- Returns:
- the count (≥0)
-
countSimStrands
public int countSimStrands()Return the number of simulation strands. The settings are unaffected. (native member: mSimStrands)- Specified by:
countSimStrandsin interfaceConstHairSettings- Returns:
- the count (≥0)
-
getInitialGravity
Copy the initial gravity vector. The settings are unaffected. (native member: mInitialGravity)- Specified by:
getInitialGravityin interfaceConstHairSettings- Returns:
- a new vector (in meters per second squared)
-
getMaterial
Access the specified material. (native member: mMaterial)- Specified by:
getMaterialin interfaceConstHairSettings- Parameters:
index- the index of the material to access (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getNumIterationsPerSecond
public int getNumIterationsPerSecond()Return the iteration rate. The settings are unaffected. (native member: mNumIterationsPerSecond)- Specified by:
getNumIterationsPerSecondin interfaceConstHairSettings- Returns:
- the number of iterations per second (≥1)
-
getRenderStrand
Access the specified render strand. (native member: mRenderStrands)- Specified by:
getRenderStrandin interfaceConstHairSettings- Parameters:
index- the index of the strand to access (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getScalpNumSkinWeightsPerVertex
public int getScalpNumSkinWeightsPerVertex()Alter the number of skinning weights per vertex. The settings are unaffected. (native member: mScalpNumSkinWeightsPerVertex)- Specified by:
getScalpNumSkinWeightsPerVertexin interfaceConstHairSettings- Returns:
- the number of weights per vertex
-
getScalpTriangle
Access the vertex indices of the specified triangle in the scalp mesh. (native member: mScalpTriangles)- Specified by:
getScalpTrianglein interfaceConstHairSettings- Parameters:
triangleIndex- the index of the triangle to access (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getScalpVertex
Copy the specified vertex in the scalp mesh. The settings are unaffected. (native member: mScalpVertices)- Specified by:
getScalpVertexin interfaceConstHairSettings- Parameters:
vertexIndex- the index of the vertex to access (≥0)- Returns:
- a new vector
-
getSimStrand
Access the specified simulation strand. (native member: mSimStrands)- Specified by:
getSimStrandin interfaceConstHairSettings- Parameters:
strandIndex- the index of the strand to access (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getSimulationBounds
Access the simulation bounds. (native member: mSimulationBounds)- Specified by:
getSimulationBoundsin interfaceConstHairSettings- Returns:
- a new JVM object with the pre-existing native object assigned
-
saveBinaryState
Write the state of this object to the specified stream, excluding the compute buffers. The settings are unaffected.- Specified by:
saveBinaryStatein interfaceConstHairSettings- Parameters:
streamOut- where to write objects (notnull)
-
getRefCount
public int getRefCount()Count the active references to the nativeHairSettings. The scene is unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeHairSettingsas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeHairSettings.
-