Files
MapLibreParticleLab/src/mbgl/style/function.hpp
John Firebaugh c4089b60bc [core] Extract Function::evaluation to a separate class (#4811)
This allows the Function<Faded<T>> partial specialization to be eliminated, giving all property functions a consistent storage type.
2016-04-25 09:51:47 -07:00

32 lines
641 B
C++

#ifndef MBGL_STYLE_FUNCTION
#define MBGL_STYLE_FUNCTION
#include <vector>
#include <utility>
namespace mbgl {
template <typename T>
class Function {
public:
using Stop = std::pair<float, T>;
using Stops = std::vector<Stop>;
explicit Function(const T& constant)
: stops({{ 0, constant }}) {}
explicit Function(const Stops& stops_, float base_)
: base(base_), stops(stops_) {}
float getBase() const { return base; }
const std::vector<std::pair<float, T>>& getStops() const { return stops; }
private:
float base = 1;
std::vector<std::pair<float, T>> stops;
};
} // namespace mbgl
#endif