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

public class Gradient extends JoltPhysicsObject implements ConstGradient
Parameterize the variation (along a hair strand) of some value, such as compliance or friction. (native type: HairSettings::Gradient)
  • Constructor Details

    • Gradient

      public Gradient()
      Instantiate a default gradient.
    • Gradient

      public Gradient(ConstGradient original)
      Instantiate a copy of the specified gradient.
      Parameters:
      original - the gradient to copy (not null, unaffected)
    • Gradient

      public Gradient(float min, float max)
      Instantiate a gradient between the specified parameter values.
      Parameters:
      min - the parameter value when the fraction is zero (default=0)
      max - the parameter value when the fraction is one (default=1)
    • Gradient

      public Gradient(float min, float max, float minFraction)
      Instantiate a gradient between the specified parameter values.
      Parameters:
      min - the parameter value when the fraction is minFraction (default=0)
      max - the parameter value when the fraction is one (default=1)
      minFraction - the fraction at which the parameter value is min (default=0)
    • Gradient

      public Gradient(float min, float max, float minFraction, float maxFraction)
      Instantiate a gradient between the specified parameter values.
      Parameters:
      min - the parameter value when the fraction is minFraction (default=0)
      max - the parameter value when the fraction is maxFraction (default=1)
      minFraction - the fraction at which the value is min (default=0)
      maxFraction - the fraction at which the value is max (default=1)
  • Method Details

    • restoreBinaryState

      public void restoreBinaryState(StreamIn stream)
      Read the state of this object from the specified stream.
      Parameters:
      stream - where to read from (not null)
    • setMax

      public Gradient setMax(float max)
      Alter the parameter value when the fraction is maxFraction. (native member: mMax)
      Parameters:
      max - the desired parameter value (default=1)
      Returns:
      the modified settings, for chaining
    • setMaxFraction

      public Gradient setMaxFraction(float fraction)
      Alter the fraction at which the parameter value reaches max. (native member: mMaxFraction)
      Parameters:
      fraction - the desired fraction (default=1)
      Returns:
      the modified settings, for chaining
    • setMin

      public Gradient setMin(float min)
      Alter the parameter value when the fraction is minFraction. (native member: mMin)
      Parameters:
      min - the desired parameter value (default=0)
      Returns:
      the modified settings, for chaining
    • setMinFraction

      public Gradient setMinFraction(float fraction)
      Alter the fraction at which the parameter value is min. (native member: mMinFraction)
      Parameters:
      fraction - the desired fraction (default=0)
      Returns:
      the modified settings, for chaining
    • getMax

      public float getMax()
      Return the parameter value when the fraction is maxFraction. The gradient is unaffected. (native member: mMax)
      Specified by:
      getMax in interface ConstGradient
      Returns:
      the parameter value
    • getMaxFraction

      public float getMaxFraction()
      Return the fraction at which the parameter value is max. The gradient is unaffected. (native member: mMaxFraction)
      Specified by:
      getMaxFraction in interface ConstGradient
      Returns:
      the fraction
    • getMin

      public float getMin()
      Return the parameter value when the fraction is minFraction. The gradient is unaffected. (native member: mMin)
      Specified by:
      getMin in interface ConstGradient
      Returns:
      the parameter value
    • getMinFraction

      public float getMinFraction()
      Return the fraction at which the parameter value is min. The gradient is unaffected. (native member: mMinFraction)
      Specified by:
      getMinFraction in interface ConstGradient
      Returns:
      the fraction
    • saveBinaryState

      public void saveBinaryState(StreamOut stream)
      Write the state of this gradient to the specified stream. The gradient is unaffected.
      Specified by:
      saveBinaryState in interface ConstGradient
      Parameters:
      stream - where to write objects (not null)