GradientSampler< T_ModeNone, T_ModeLinearKnot, T_ModeSmoothKnot, T_ModeBlend, T_ModeCubicKnot, T_ModeCubicBias > Class Template Reference

#include <gradientmath.h>

Inheritance diagram for GradientSampler< T_ModeNone, T_ModeLinearKnot, T_ModeSmoothKnot, T_ModeBlend, T_ModeCubicKnot, T_ModeCubicBias >:

详细描述

template<typename T_ModeNone, typename T_ModeLinearKnot, typename T_ModeSmoothKnot, typename T_ModeBlend, typename T_ModeCubicKnot, typename T_ModeCubicBias>
class maxon::GradientSampler< T_ModeNone, T_ModeLinearKnot, T_ModeSmoothKnot, T_ModeBlend, T_ModeCubicKnot, T_ModeCubicBias >

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;

auto GetKnotValue = [&knotValues]( Int index) { return knotValues[index]; }; auto GetKnotInterpolationMode = []( Int index) { return InterpolationLinearKnot::GetId(). GetHashCode (); }; auto GetKnotBias = []( Int index) { return Float (0.5); };

// 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

-  Public Member Functions inherited from IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>
Result < ValueType >  Sample (typename SortedKnotsType::FloatType absolutePosition, const SortedKnotsType &sortedKnots, const GetKnotValueFunc &getKnotValue, const GetKnotInterpolationModeFunc &getKnotInterpolationMode, const GetKnotBiasFunc &getKnotBias) const
Int
maxon::Int Int
定义: ge_sys_math.h:62
maxon::GradientSampler
定义: gradientmath.h:522
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::InterpolationCubicKnot
static const UInt InterpolationCubicKnot
定义: gradientmath.h:215
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::InterpolationLinearKnot
static const UInt InterpolationLinearKnot
定义: gradientmath.h:212
maxon::SortedGradientKnots::Sort
Result< void > Sort()
定义: gradientmath.h:173
iferr_return
#define iferr_return
定义: resultbase.h:1434
maxon::Col3::GetHashCode
constexpr HashInt GetHashCode() const
定义: col.h:226
maxon::Float
Float64 Float
定义: apibase.h:193
maxon::Color
Col3< Float, 1 > Color
定义: vector.h:82
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::InterpolationCubicBias
static const UInt InterpolationCubicBias
定义: gradientmath.h:216
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::InterpolationSmoothKnot
static const UInt InterpolationSmoothKnot
定义: gradientmath.h:213
maxon::SortedGradientKnots::InsertKnot
Result< void > InsertKnot(FloatType position)
定义: gradientmath.h:84
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::Sample
Result< ValueType > Sample(typename SortedKnotsType::FloatType absolutePosition, const SortedKnotsType &sortedKnots, const GetKnotValueFunc &getKnotValue, const GetKnotInterpolationModeFunc &getKnotInterpolationMode, const GetKnotBiasFunc &getKnotBias) const
定义: gradientmath.h:399
maxon::SortedGradientKnots
定义: gradientmath.h:52
maxon::Col3< Float, 1 >
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::InterpolationNone
static const UInt InterpolationNone
定义: gradientmath.h:211
maxon::IndexedGradientSampler< T_ModeNone::GetId().GetHashCode(), T_ModeLinearKnot::GetId().GetHashCode(), T_ModeSmoothKnot::GetId().GetHashCode(), T_ModeBlend::GetId().GetHashCode(), T_ModeCubicKnot::GetId().GetHashCode(), T_ModeCubicBias::GetId().GetHashCode()>::InterpolationBlend
static const UInt InterpolationBlend
定义: gradientmath.h:214