diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-05-31 18:42:13 +0200 |
---|---|---|
committer | Molly Lloyd <molly@mapbox.com> | 2018-08-27 13:13:47 -0700 |
commit | 7c8b984970e13401f9a118b9f603d5ac0fd84447 (patch) | |
tree | 8b61a586cac66d61b67bc6ce524a29d4b2bfc60c | |
parent | 6af44f0f158ebf7e6c43eef8af2ca1df39cc2bbd (diff) | |
download | qtlocation-mapboxgl-7c8b984970e13401f9a118b9f603d5ac0fd84447.tar.gz |
[core] allow passing multiple AttributeTypes to a PaintPropertyBinder
-rw-r--r-- | src/mbgl/renderer/paint_property_binder.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 82c36399a9..cf0a71847e 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -72,7 +72,7 @@ std::array<float, N*2> zoomInterpolatedAttributeValue(const std::array<float, N> Note that the shader source varies depending on whether we're using a uniform or attribute. Like GL JS, we dynamically compile shaders at runtime to accomodate this. */ -template <class T, class A> +template <class T, class... As> class PaintPropertyBinder { public: @@ -233,18 +233,18 @@ private: optional<gl::VertexBuffer<Vertex>> vertexBuffer; }; -template <class T, class A> -std::unique_ptr<PaintPropertyBinder<T, A>> -PaintPropertyBinder<T, A>::create(const PossiblyEvaluatedPropertyValue<T>& value, float zoom, T defaultValue) { +template <class T, class... As> +std::unique_ptr<PaintPropertyBinder<T, As...>> +PaintPropertyBinder<T, As...>::create(const PossiblyEvaluatedPropertyValue<T>& value, float zoom, T defaultValue) { return value.match( - [&] (const T& constant) -> std::unique_ptr<PaintPropertyBinder<T, A>> { - return std::make_unique<ConstantPaintPropertyBinder<T, A>>(constant); + [&] (const T& constant) -> std::unique_ptr<PaintPropertyBinder<T, As...>> { + return std::make_unique<ConstantPaintPropertyBinder<T, As...>>(constant); }, - [&] (const style::PropertyExpression<T>& expression) -> std::unique_ptr<PaintPropertyBinder<T, A>> { + [&] (const style::PropertyExpression<T>& expression) -> std::unique_ptr<PaintPropertyBinder<T, As...>> { if (expression.isZoomConstant()) { - return std::make_unique<SourceFunctionPaintPropertyBinder<T, A>>(expression, defaultValue); + return std::make_unique<SourceFunctionPaintPropertyBinder<T, As...>>(expression, defaultValue); } else { - return std::make_unique<CompositeFunctionPaintPropertyBinder<T, A>>(expression, zoom, defaultValue); + return std::make_unique<CompositeFunctionPaintPropertyBinder<T, As...>>(expression, zoom, defaultValue); } } ); |