java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.HairMaterial
All Implemented Interfaces:
ConstHairMaterial, ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class HairMaterial extends JoltPhysicsObject implements ConstHairMaterial
Simulation parameters for a hair strand. (native type: HairSettings::Material)
  • Constructor Details

    • HairMaterial

      public HairMaterial()
      Instantiate a default material.
    • HairMaterial

      public HairMaterial(ConstHairMaterial original)
      Instantiate a copy of the specified material.
      Parameters:
      original - the material to copy (not null, unaffected)
  • Method Details

    • setAngularDamping

      public HairMaterial setAngularDamping(float damping)
      Alter the angular damping coefficient of the rods. (native attribute: mAngularDamping)
      Parameters:
      damping - the desired coefficient (default=2)
      Returns:
      the modified material, for chaining
    • setBendCompliance

      public HairMaterial setBendCompliance(float compliance)
      Alter the compliance of bend constraints, the inverse of bend stiffness. (native attribute: mBendCompliance)
      Parameters:
      compliance - the desired compliance (default=10^-7)
      Returns:
      the modified material, for chaining
    • setBendComplianceMultiplier

      public HairMaterial setBendComplianceMultiplier(Float4 multipliers)
      Alter the multiples of bend compliance to be applied to the strand at 0%, 33%, 66% and 100% of its length. (native attribute: mBendComplianceMultiplier)
      Parameters:
      multipliers - the desired multipliers (not null, unaffected, default=(1,100,100,1))
      Returns:
      the modified material, for chaining
    • setEnableCollision

      public HairMaterial setEnableCollision(boolean setting)
      Enable or disable collisions between hair strands and the environment. (native attribute: mEnableCollision)
      Parameters:
      setting - true to enable collisions, false to disable them (default=true)
      Returns:
      the modified material, for chaining
    • setEnableLra

      public HairMaterial setEnableLra(boolean setting)
      Enable or disable long-range attachments to keep hair near its modeled pose. (native attribute: mEnableLRA)
      Parameters:
      setting - true to enable attachments, false to disable them (default=true)
      Returns:
      the modified material, for chaining
    • setFriction

      public HairMaterial setFriction(float friction)
      Alter the friction coefficient for collisions between hair strands and the environment. (native attribute: mFriction)
      Parameters:
      friction - the desired friction coefficient (default=0.2)
      Returns:
      the modified material, for chaining
    • setGlobalPose

      public HairMaterial setGlobalPose(ConstGradient gradient)
      Alter the fraction of the neutral pose applied to hair during each iteration. (native attribute: mGlobalPose)
      Parameters:
      gradient - the desired variation of the pose fraction along each strand (not null, unaffected, default=(0.01,0,0,0.3))
      Returns:
      the modified material, for chaining
    • setGravityFactor

      public HairMaterial setGravityFactor(ConstGradient gradient)
      Alter the fraction of gravity to be applied to the hair during simulation. (native attribute: mGravityFactor)
      Parameters:
      gradient - the desired variation of the gravity factor along each strand (not null, unaffected, default=(0.1,1,0.2,0.8))
      Returns:
      the modified material, for chaining
    • setGravityPreloadFactor

      public HairMaterial setGravityPreloadFactor(float factor)
      Alter the fraction of gravity to be removed during initialization. (native attribute: mGravityPreloadFactor)
      Parameters:
      factor - the desired fraction to remove (default=0)
      Returns:
      the modified material, for chaining
    • setGridDensityForceFactor

      public HairMaterial setGridDensityForceFactor(float factor)
      Alter the force factor pushing the hair toward neutral density. (native attribute: mGridDensityForceFactor)
      Parameters:
      factor - the desired force factor (default=0)
      Returns:
      the modified material, for chaining
    • setGridVelocityFactor

      public HairMaterial setGridVelocityFactor(ConstGradient gradient)
      Alter the fraction of grid velocity to be applied to the hair. (native attribute: mGridVelocityFactor)
      Parameters:
      gradient - the desired variation of the grid influence along each strand (not null, unaffected, default=(0.05,0.01))
      Returns:
      the modified material, for chaining
    • setHairRadius

      public HairMaterial setHairRadius(ConstGradient gradient)
      Alter the radius of the hair strand. (native attribute: mHairRadius)
      Parameters:
      gradient - the desired variation of each strand's radius along its length (in meters, not null, unaffected, default=(0.001,0.001))
      Returns:
      the modified material, for chaining
    • setInertiaMultiplier

      public HairMaterial setInertiaMultiplier(float multiplier)
      Alter the inertia of each rod as a multiple of its mass. (native attribute: mInertiaMultiplier)
      Parameters:
      multiplier - the desired ratio (default=10)
      Returns:
      the modified material, for chaining
    • setLinearDamping

      public HairMaterial setLinearDamping(float damping)
      Alter the linear damping coefficient of the rods. (native attribute: mLinearDamping)
      Parameters:
      damping - the desired coefficient (default=2)
      Returns:
      the modified material, for chaining
    • setMaxAngularVelocity

      public HairMaterial setMaxAngularVelocity(float angularRate)
      Alter the maximum angular rate of vertices. (native attribute: mMaxAngularVelocity)
      Parameters:
      angularRate - the desired rate limit (in radians per second, default=50)
      Returns:
      the modified material, for chaining
    • setMaxLinearVelocity

      public HairMaterial setMaxLinearVelocity(float speed)
      Alter the maximum speed of vertices. (native attribute: mMaxLinearVelocity)
      Parameters:
      speed - the desired speed (in meters per second, default=10)
      Returns:
      the modified material, for chaining
    • setSimulationStrandsFraction

      public HairMaterial setSimulationStrandsFraction(float fraction)
      Alter fraction of strands that should be simulated. Used by InitRenderAndSimulationStrands only. (native attribute: mSimulationStrandsFraction)
      Parameters:
      fraction - the desired fraction (default=0.1)
      Returns:
      the modified material, for chaining
    • setSkinGlobalPose

      public HairMaterial setSkinGlobalPose(ConstGradient gradient)
      Alter how strongly the scalp influences the global pose. (native attribute: mSkinGlobalPose)
      Parameters:
      gradient - the desired variation of influence along each strand (not null, unaffected, 0=no influence, 1=fully following, default=(1,0,0,0.1))
      Returns:
      the modified material, for chaining
    • setStretchCompliance

      public HairMaterial setStretchCompliance(float compliance)
      Alter the compliance of stretch constraints, the inverse of stretch stiffness. (native attribute: mStretchCompliance)
      Parameters:
      compliance - the desired compliance (default=10^-8)
      Returns:
      the modified material, for chaining
    • setWorldTransformInfluence

      public HairMaterial setWorldTransformInfluence(ConstGradient gradient)
      Alter the influence of head rotation on hair. (native attribute: mWorldTransformInfluence)
      Parameters:
      gradient - the desired variation of influence along each strand (not null, unaffected, 0=no influence, 1=fully following, default=(0,1))
      Returns:
      the modified material, for chaining
    • getAngularDamping

      public float getAngularDamping()
      Return the angular damping coefficient of the rods. The material is unaffected. (native attribute: mAngularDamping)
      Specified by:
      getAngularDamping in interface ConstHairMaterial
      Returns:
      the coefficient
    • getBendCompliance

      public float getBendCompliance()
      Return the compliance of bend constraints, the inverse of bend stiffness. The material is unaffected. (native attribute: mBendCompliance)
      Specified by:
      getBendCompliance in interface ConstHairMaterial
      Returns:
      the compliance value
    • getBendComplianceMultiplier

      public Float4 getBendComplianceMultiplier()
      Copy the multiples of bend compliance to be applied to the strand at 0%, 33%, 66% and 100% of its length. (native attribute: mBendComplianceMultiplier)
      Specified by:
      getBendComplianceMultiplier in interface ConstHairMaterial
      Returns:
      a new object
    • getEnableCollision

      public boolean getEnableCollision()
      Test whether collisions between hair strands and the environment are enabled. The material is unaffected. (native attribute: mEnableCollision)
      Specified by:
      getEnableCollision in interface ConstHairMaterial
      Returns:
      true if enabled, otherwise false
    • getEnableLra

      public boolean getEnableLra()
      Test whether long-range attachments are enabled to keep hair near its modeled pose. The material is unaffected. (native attribute: mEnableLRA)
      Specified by:
      getEnableLra in interface ConstHairMaterial
      Returns:
      true if enabled, otherwise false
    • getFriction

      public float getFriction()
      Return the friction coefficient for collisions between hair strands and the environment. The material is unaffected. (native attribute: mFriction)
      Specified by:
      getFriction in interface ConstHairMaterial
      Returns:
      the friction coefficient
    • getGlobalPose

      public Gradient getGlobalPose()
      Access the fraction of the neutral pose applied to hair during each iteration. (native attribute: mGlobalPose)
      Specified by:
      getGlobalPose in interface ConstHairMaterial
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getGravityFactor

      public Gradient getGravityFactor()
      Access the fraction of gravity to be applied to the hair during simulation. (native attribute: mGravityFactor)
      Specified by:
      getGravityFactor in interface ConstHairMaterial
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getGravityPreloadFactor

      public float getGravityPreloadFactor()
      Return the fraction of gravity to be removed during initialization. The material is unaffected. (native attribute: mGravityPreloadFactor)
      Specified by:
      getGravityPreloadFactor in interface ConstHairMaterial
      Returns:
      the fraction
    • getGridDensityForceFactor

      public float getGridDensityForceFactor()
      Return the force factor pushing the hair toward neutral density. The material is unaffected. (native attribute: mGridDensityForceFactor)
      Specified by:
      getGridDensityForceFactor in interface ConstHairMaterial
      Returns:
      the force factor
    • getGridVelocityFactor

      public Gradient getGridVelocityFactor()
      Access the fraction of grid velocity to be applied to the hair. (native attribute: mGridVelocityFactor)
      Specified by:
      getGridVelocityFactor in interface ConstHairMaterial
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getHairRadius

      public Gradient getHairRadius()
      Access the radius of the hair strand. (native attribute: mHairRadius)
      Specified by:
      getHairRadius in interface ConstHairMaterial
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getInertiaMultiplier

      public float getInertiaMultiplier()
      Return the inertia of each rod as a multiple of its mass. The material is unaffected. (native attribute: mInertiaMultiplier)
      Specified by:
      getInertiaMultiplier in interface ConstHairMaterial
      Returns:
      the ratio
    • getLinearDamping

      public float getLinearDamping()
      Return the linear damping coefficient of the rods. The material is unaffected. (native attribute: mLinearDamping)
      Specified by:
      getLinearDamping in interface ConstHairMaterial
      Returns:
      the damping coefficient
    • getMaxAngularVelocity

      public float getMaxAngularVelocity()
      Return the maximum angular rate of vertices. The material is unaffected. (native attribute: mMaxAngularVelocity)
      Specified by:
      getMaxAngularVelocity in interface ConstHairMaterial
      Returns:
      the rate limit (in radians per second)
    • getMaxLinearVelocity

      public float getMaxLinearVelocity()
      Return the maximum speed of vertices. The material is unaffected. (native attribute: mMaxLinearVelocity)
      Specified by:
      getMaxLinearVelocity in interface ConstHairMaterial
      Returns:
      the speed limit (in meters per second)
    • getSimulationStrandsFraction

      public float getSimulationStrandsFraction()
      Return the fraction of strands that should be simulated. Used by InitRenderAndSimulationStrands only. The material is unaffected. (native attribute: mSimulationStrandsFraction)
      Specified by:
      getSimulationStrandsFraction in interface ConstHairMaterial
      Returns:
      the fraction
    • getSkinGlobalPose

      public Gradient getSkinGlobalPose()
      Access how strongly the scalp influences the global pose. (native attribute: mSkinGlobalPose)
      Specified by:
      getSkinGlobalPose in interface ConstHairMaterial
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getStretchCompliance

      public float getStretchCompliance()
      Return the compliance of stretch constraints, the inverse of stretch stiffness. The material is unaffected. (native attribute: mStretchCompliance)
      Specified by:
      getStretchCompliance in interface ConstHairMaterial
      Returns:
      the compliance value
    • getWorldTransformInfluence

      public Gradient getWorldTransformInfluence()
      Access the influence of head rotation on hair. (native attribute: mWorldTransformInfluence)
      Specified by:
      getWorldTransformInfluence in interface ConstHairMaterial
      Returns:
      a new JVM object with the pre-existing native object assigned