Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
HairSettings::Gradient Class Reference

Gradient along a hair strand of a value, e.g. compliance, friction, etc. More...

#include <HairSettings.h>

Public Member Functions

 Gradient ()=default
 
 Gradient (float inMin, float inMax, float inMinFraction=0.0f, float inMaxFraction=1.0f)
 
Gradient MakeStepDependent (float inTimeRatio) const
 
void SaveBinaryState (StreamOut &inStream) const
 Saves the state of this object in binary form to inStream. Doesn't store the compute buffers.
 
void RestoreBinaryState (StreamIn &inStream)
 Restore the state of this object from inStream.
 

Public Attributes

float mMin = 0.0f
 Minimum value of the gradient.
 
float mMax = 1.0f
 Maximum value of the gradient.
 
float mMinFraction = 0.0f
 Fraction along the hair strand that corresponds to the minimum value.
 
float mMaxFraction = 1.0f
 Fraction along the hair strand that corresponds to the maximum value.
 

Detailed Description

Gradient along a hair strand of a value, e.g. compliance, friction, etc.

Constructor & Destructor Documentation

◆ Gradient() [1/2]

HairSettings::Gradient::Gradient ( )
default

◆ Gradient() [2/2]

HairSettings::Gradient::Gradient ( float inMin,
float inMax,
float inMinFraction = 0.0f,
float inMaxFraction = 1.0f )
inline

Member Function Documentation

◆ MakeStepDependent()

Gradient HairSettings::Gradient::MakeStepDependent ( float inTimeRatio) const
inline

We drive a value to its target with fixed time steps using:

x(t + fixed_dt) = target + (1 - k) * (x(t) - target)

For varying time steps we can rewrite this to:

x(t + dt) = target + (1 - k)^inTimeRatio * (x(t) - target)

Where inTimeRatio is defined as dt / fixed_dt.

This means k' = 1 - (1 - k)^inTimeRatio

◆ RestoreBinaryState()

void HairSettings::Gradient::RestoreBinaryState ( StreamIn & inStream)

Restore the state of this object from inStream.

◆ SaveBinaryState()

void HairSettings::Gradient::SaveBinaryState ( StreamOut & inStream) const

Saves the state of this object in binary form to inStream. Doesn't store the compute buffers.

Member Data Documentation

◆ mMax

float HairSettings::Gradient::mMax = 1.0f

Maximum value of the gradient.

◆ mMaxFraction

float HairSettings::Gradient::mMaxFraction = 1.0f

Fraction along the hair strand that corresponds to the maximum value.

◆ mMin

float HairSettings::Gradient::mMin = 0.0f

Minimum value of the gradient.

◆ mMinFraction

float HairSettings::Gradient::mMinFraction = 0.0f

Fraction along the hair strand that corresponds to the minimum value.


The documentation for this class was generated from the following files: