GradientSampler< T_ModeNone, T_ModeLinearKnot, T_ModeSmoothKnot, T_ModeBlend, T_ModeCubicKnot, T_ModeCubicBias > Class Template Reference
#include <gradientmath.h>
This class adds a little convenience to setup a gradient for a set of interpolation modes given as MAXON_ATTRIBUTE. For example, a gradient can be configured as such:
// We setup the knot sequence. maxon::Color knotValues[2] = { maxon::Color (0), maxon::Color (1) }; maxon::SortedGradientKnots<Float, Int> sortedKnots; sortedKnots. InsertKnot (0.0) iferr_return ; sortedKnots. InsertKnot (1.0) iferr_return ; sortedKnots. Sort () iferr_return ;// We setup the gradient sampler instance. using InterpolationNone = decltype(maxonexample::DATATYPE::PORTBUNDLE::GRADIENT::INTERPOLATION_ENUM_NONE); using InterpolationLinearKnot = decltype(maxonexample::DATATYPE::PORTBUNDLE::GRADIENT::INTERPOLATION_ENUM_LINEARKNOT); using InterpolationSmoothKnot = decltype(maxonexample::DATATYPE::PORTBUNDLE::GRADIENT::INTERPOLATION_ENUM_SMOOTHKNOT); using InterpolationBlend = decltype(maxonexample::DATATYPE::PORTBUNDLE::GRADIENT::INTERPOLATION_ENUM_BLEND); using InterpolationCubicKnot = decltype(maxonexample::DATATYPE::PORTBUNDLE::GRADIENT::INTERPOLATION_ENUM_CUBICKNOT); using InterpolationCubicBias = decltype(maxonexample::DATATYPE::PORTBUNDLE::GRADIENT::INTERPOLATION_ENUM_CUBICBIAS); maxon::GradientSampler<InterpolationNone, InterpolationLinearKnot, InterpolationSmoothKnot, InterpolationBlend, InterpolationCubicKnot, InterpolationCubicBias> gradientSampler;
// We sample the gradient in the middle. const maxon::Color gray = gradientSampler. Sample < maxon::Color >(0.5, sortedKnots, GetKnotValue, GetKnotInterpolationMode, GetKnotBias) iferr_return ;
Additional Inherited Members |
|
![]() |
|
Result < ValueType > | Sample (typename SortedKnotsType::FloatType absolutePosition, const SortedKnotsType &sortedKnots, const GetKnotValueFunc &getKnotValue, const GetKnotInterpolationModeFunc &getKnotInterpolationMode, const GetKnotBiasFunc &getKnotBias) const |