[core] allow passing multiple AttributeTypes to a PaintPropertyBinder
This commit is contained in:
committed by
Molly Lloyd
parent
f97ba60da4
commit
748e6bde5f
@@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user