summaryrefslogtreecommitdiff
path: root/src/mbgl/style/function_evaluator.hpp
blob: 7da1c299e05a8ee209ddc4a6b5ad6db2f0b87af4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef MBGL_STYLE_FUNCTION_EVALUATOR
#define MBGL_STYLE_FUNCTION_EVALUATOR

#include <mbgl/style/function.hpp>
#include <mbgl/util/interpolate.hpp>

namespace mbgl {

class StyleCalculationParameters;

template <typename T>
class NormalFunctionEvaluator {
public:
    using ResultType = T;
    T operator()(const Function<T>&, const StyleCalculationParameters&) const;
};

template <typename T>
struct Faded {
    Faded() = default;
    Faded(const T& v) : to(v) {}

    T from;
    float fromScale = 0;
    T to;
    float toScale = 0;
    float t = 0;
};

template <typename T>
class CrossFadedFunctionEvaluator {
public:
    using ResultType = Faded<T>;
    Faded<T> operator()(const Function<T>&, const StyleCalculationParameters&) const;
};

namespace util {
template <typename T>
struct Interpolator<Faded<T>>
    : Uninterpolated {};
}

} // namespace mbgl

#endif