java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Hair
- All Implemented Interfaces:
ConstJoltPhysicsObject,AutoCloseable,Comparable<JoltPhysicsObject>
An instance of hair simulation.
-
Constructor Summary
ConstructorsConstructorDescriptionHair(ConstHairSettings settings, RVec3Arg location, QuatArg orientation, int objectLayer) Instantiate a simulation with the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(ConstDrawSettings settings, DebugRenderer renderer) Draw the hair and its simulation properties.Access the settings used to create this hair.Copy the render positions of all strands.Copy the simulation results afterreadBackGpuState()has been invoked and the buffers have been locked.Copy the simulation's transform relative to system coordinates.voidinit(ComputeSystem computeSystem) Initialize the simulation.voidLock the data buffers.voidreadBackGpuState(ComputeQueue queue) Read back GPU state for debugging purposes.voidsetPosition(RVec3Arg location) Relocate the hair.voidsetRotation(QuatArg orientation) Reorient the hair.voidUnlock the data buffers.voidupdate(float deltaTime, Mat44Arg jointToHair, Mat44Array jointMatrices, ConstPhysicsSystem physicsSystem, HairShaders shaders, ComputeSystem computeSystem, ComputeQueue queue) Step the hair simulation forward.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
Hair
Instantiate a simulation with the specified settings.- Parameters:
settings- the settings to use (notnull, unaffected)location- the location to use (notnull, unaffected)orientation- the orientation to use (notnull, unaffected)objectLayer- the object layer for the simulation
-
-
Method Details
-
draw
Draw the hair and its simulation properties.- Parameters:
settings- the draw settings to use (notnull, unaffected)renderer- the renderer to use (notnull)
-
getHairSettings
Access the settings used to create this hair.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getRenderPositions
Copy the render positions of all strands.- Returns:
- a new direct buffer
-
getScalpVertices
Copy the simulation results afterreadBackGpuState()has been invoked and the buffers have been locked.- Returns:
- a new direct buffer
-
getWorldTransform
Copy the simulation's transform relative to system coordinates.- Returns:
- a new matrix
-
init
Initialize the simulation.- Parameters:
computeSystem- the compute system to use (notnull)
-
lockReadBackBuffers
public void lockReadBackBuffers()Lock the data buffers. -
readBackGpuState
Read back GPU state for debugging purposes.- Parameters:
queue- the queue to use (notnull)
-
setPosition
Relocate the hair.- Parameters:
location- the desired location (in system coordinates, notnull, unaffected)
-
setRotation
Reorient the hair.- Parameters:
orientation- the desired orientation (relative to system coordinates, notnull, unaffected)
-
unlockReadBackBuffers
public void unlockReadBackBuffers()Unlock the data buffers. -
update
public void update(float deltaTime, Mat44Arg jointToHair, Mat44Array jointMatrices, ConstPhysicsSystem physicsSystem, HairShaders shaders, ComputeSystem computeSystem, ComputeQueue queue) Step the hair simulation forward.- Parameters:
deltaTime- the time stepjointToHair- the transform from joint space to hair local space (notnull, unaffected)jointMatrices- the joint matrices (in system coordinates, unaffected) ornullif the scalp isn't skinnedphysicsSystem- the physics system to use for collision detection (notnull)shaders- the compute shaders to use (notnull)computeSystem- the compute system to use (notnull)queue- the compute queue to use (notnull)
-