All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class Hair extends NonCopyable
An instance of hair simulation.
  • Constructor Details

    • Hair

      public Hair(ConstHairSettings settings, RVec3Arg location, QuatArg orientation, int objectLayer)
      Instantiate a simulation with the specified settings.
      Parameters:
      settings - the settings to use (not null, unaffected)
      location - the location to use (not null, unaffected)
      orientation - the orientation to use (not null, unaffected)
      objectLayer - the object layer for the simulation
  • Method Details

    • draw

      public void draw(ConstDrawSettings settings, DebugRenderer renderer)
      Draw the hair and its simulation properties.
      Parameters:
      settings - the draw settings to use (not null, unaffected)
      renderer - the renderer to use (not null)
    • getHairSettings

      public ConstHairSettings getHairSettings()
      Access the settings used to create this hair.
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getRenderPositions

      public FloatBuffer getRenderPositions()
      Copy the render positions of all strands.
      Returns:
      a new direct buffer
    • getScalpVertices

      public FloatBuffer getScalpVertices()
      Copy the simulation results after readBackGpuState() has been invoked and the buffers have been locked.
      Returns:
      a new direct buffer
    • getWorldTransform

      public RMat44 getWorldTransform()
      Copy the simulation's transform relative to system coordinates.
      Returns:
      a new matrix
    • init

      public void init(ComputeSystem computeSystem)
      Initialize the simulation.
      Parameters:
      computeSystem - the compute system to use (not null)
    • lockReadBackBuffers

      public void lockReadBackBuffers()
      Lock the data buffers.
    • readBackGpuState

      public void readBackGpuState(ComputeQueue queue)
      Read back GPU state for debugging purposes.
      Parameters:
      queue - the queue to use (not null)
    • setPosition

      public void setPosition(RVec3Arg location)
      Relocate the hair.
      Parameters:
      location - the desired location (in system coordinates, not null, unaffected)
    • setRotation

      public void setRotation(QuatArg orientation)
      Reorient the hair.
      Parameters:
      orientation - the desired orientation (relative to system coordinates, not null, 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 step
      jointToHair - the transform from joint space to hair local space (not null, unaffected)
      jointMatrices - the joint matrices (in system coordinates, unaffected) or null if the scalp isn't skinned
      physicsSystem - the physics system to use for collision detection (not null)
      shaders - the compute shaders to use (not null)
      computeSystem - the compute system to use (not null)
      queue - the compute queue to use (not null)