summaryrefslogtreecommitdiff
path: root/src/mbgl/style/function_evaluator.hpp
blob: 43549179df2f62401a00d84ecb7cf22779410440 (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
#pragma once

#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