#include <gradientmath.h>
This class implements the gradient blending operation for a series of knots with different interpolation modes. For performance reasons interpolation modes are handled as unsigned integers.
| T_ModeNone | The index of constant / stairstep interpolation of 1 knot. |
| T_ModeLinearKnot | The index of linear interpolation between 2 knots. |
| T_ModeSmoothKnot | The index of the smooth-stepped linear interpolation between 2 knots. |
| T_ModeBlend | The index of the box-stepped linear interpolation between 2 knots. |
| T_ModeCubicKnot | The index of the cubic interpolation between 4 knots. |
| T_ModeCubicBias | The index of the cubic interpolation between 2 knots. |
Public Member Functions | |
| template<typename ValueType , typename SortedKnotsType , typename GetKnotValueFunc , typename GetKnotInterpolationModeFunc , typename GetKnotBiasFunc > | |
| Result< ValueType > | Sample (typename SortedKnotsType::FloatType absolutePosition, const SortedKnotsType &sortedKnots, const GetKnotValueFunc &getKnotValue, const GetKnotInterpolationModeFunc &getKnotInterpolationMode, const GetKnotBiasFunc &getKnotBias) const |
Static Private Member Functions | |
| template<typename FloatType > | |
| static FloatType | GetBiasedWeight (FloatType weight, FloatType bias) |
| template<typename FloatType > | |
| static Vec4< FloatType > | GetCubicBlendWeights (FloatType a) |
| template<typename ValueType , typename FloatType , typename IntType , typename GetKnotValueFunc > | |
| static Result< ValueType > | BlendTwoValuesLinear (IntType leftIndex, IntType rightIndex, FloatType weight, const GetKnotValueFunc &getKnotValue) |
| template<typename ValueType , typename FloatType , typename IntType , typename GetKnotValueFunc > | |
| static Result< ValueType > | BlendTwoValuesCubic (IntType leftIndex, IntType rightIndex, FloatType biasLeft, FloatType biasRight, const Vec4< FloatType > &cubicWeights, const GetKnotValueFunc &getKnotValue) |
| template<typename ValueType , typename FloatType , typename IntType , typename GetKnotValueFunc > | |
| static Result< ValueType > | BlendFourValues (IntType index0, IntType index1, IntType index2, IntType index3, FloatType weight, const GetKnotValueFunc &getKnotValue) |
Static Private Attributes | |
| static const UInt | InterpolationNone |
| static const UInt | InterpolationLinearKnot |
| static const UInt | InterpolationSmoothKnot |
| static const UInt | InterpolationBlend |
| static const UInt | InterpolationCubicKnot |
| static const UInt | InterpolationCubicBias |
|
staticprivate |
Applies the bias blending to a weight.
| FloatType | The type of real number. |
| [in] | weight | The original unbiased weight. |
| [in] | bias | The bias to apply. |
|
staticprivate |
Computes the four blend weights of cubic interpolation.
| FloatType | The type of real number. |
| [in] | a | The original weight. |
|
staticprivate |
Linearly interpolates between two values.
| ValueType | The type of value to interpolate. |
| FloatType | The type of real number. |
| IntType | The type of index. |
| GetKnotValueFunc | The type of value sample function. |
| [in] | leftIndex | The index of the left knot. |
| [in] | rightIndex | The index of the right knot. |
| [in] | weight | The interpolation weight between the 2 knots. |
| [in] | getKnotValue | The value sample function. |
|
staticprivate |
Computes the biased cubic interpolation between two values.
| ValueType | The type of value to interpolate. |
| FloatType | The type of real number. |
| IntType | The type of index. |
| GetKnotValueFunc | The type of value sample function. |
| [in] | leftIndex | The index of the left knot. |
| [in] | rightIndex | The index of the right knot. |
| [in] | biasLeft | The bias towards the left knot. |
| [in] | biasRight | The bias towards the right knot. |
| [in] | cubicWeights | The cubic weights. |
| [in] | getKnotValue | The value sample function. |
|
staticprivate |
Computes the interpolation between four values.
| ValueType | The type of value to interpolate. |
| FloatType | The type of real number. |
| IntType | The type of index. |
| GetKnotValueFunc | The type of value sample function. |
| [in] | index0 | The index of the first knot. |
| [in] | index1 | The index of the second knot. |
| [in] | index2 | The index of the third knot. |
| [in] | index3 | The index of the fourth knot. |
| [in] | weight | The interpolation weight. |
| [in] | getKnotValue | The value sample function. |
| Result<ValueType> Sample | ( | typename SortedKnotsType::FloatType | absolutePosition, |
| const SortedKnotsType & | sortedKnots, | ||
| const GetKnotValueFunc & | getKnotValue, | ||
| const GetKnotInterpolationModeFunc & | getKnotInterpolationMode, | ||
| const GetKnotBiasFunc & | getKnotBias | ||
| ) | const |
Samples the gradient at the requested position.
| ValueType | The type of value to sample. |
| SortedKnotsType | The type of sorted knot sequence. |
| GetKnotValueFunc | The type of value sample function. |
| GetKnotInterpolationModeFunc | The type of interpolation mode sample function. |
| GetKnotBiasFunc | The type of bias sample function. |
| [in] | absolutePosition | The position to sample in the gradient. |
| [in] | sortedKnots | The sorted knot sequence. |
| [in] | getKnotValue | The value sample function.. |
| [in] | getKnotInterpolationMode | The interpolation mode sample function. |
| [in] | getKnotBias | The bias sample function. |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |