diff options
Diffstat (limited to 'src/mbgl/style/layers/fill_layer_properties.hpp')
-rw-r--r-- | src/mbgl/style/layers/fill_layer_properties.hpp | 91 |
1 files changed, 82 insertions, 9 deletions
diff --git a/src/mbgl/style/layers/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp index cb01194515..23041d4a9c 100644 --- a/src/mbgl/style/layers/fill_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_layer_properties.hpp @@ -40,15 +40,88 @@ struct FillPattern : CrossFadedPaintProperty<std::string> { static std::string defaultValue() { return ""; } }; -class FillPaintProperties : public Properties< - FillAntialias, - FillOpacity, - FillColor, - FillOutlineColor, - FillTranslate, - FillTranslateAnchor, - FillPattern -> {}; +class FillPaintProperties { +public: + class PossiblyEvaluated; + + class Binders { + public: + std::unique_ptr<PaintPropertyBinder<float, typename attributes::a_opacity::Type>> fillOpacity; + std::unique_ptr<PaintPropertyBinder<Color, typename attributes::a_color::Type>> fillColor; + std::unique_ptr<PaintPropertyBinder<Color, typename attributes::a_outline_color::Type>> fillOutlineColor; + + void populateVertexVectors(const GeometryTileFeature&, std::size_t length); + void upload(gl::Context&); + + using Attributes = gl::Attributes< + ZoomInterpolatedAttribute<attributes::a_opacity>, + ZoomInterpolatedAttribute<attributes::a_color>, + ZoomInterpolatedAttribute<attributes::a_outline_color> + >; + + using Uniforms = gl::Uniforms< + InterpolationUniform<attributes::a_opacity>, + InterpolationUniform<attributes::a_color>, + InterpolationUniform<attributes::a_outline_color>, + uniforms::u_opacity, + uniforms::u_color, + uniforms::u_outline_color + >; + + using AttributeBindings = typename Attributes::Bindings; + using UniformValues = typename Uniforms::Values; + + AttributeBindings attributeBindings(const PossiblyEvaluated&) const; + UniformValues uniformValues(float z, const PossiblyEvaluated&) const; + }; + + class PossiblyEvaluated { + public: + bool fillAntialias; + PossiblyEvaluatedPropertyValue<float> fillOpacity; + PossiblyEvaluatedPropertyValue<Color> fillColor; + PossiblyEvaluatedPropertyValue<Color> fillOutlineColor; + std::array<float, 2> fillTranslate; + TranslateAnchorType fillTranslateAnchor; + Faded<std::string> fillPattern; + + Binders createBinders(float z) const; + + std::bitset<8> constants() const; + std::vector<std::string> defines() const; + }; + + class Unevaluated { + public: + style::Transitioning<PropertyValue<bool>> fillAntialias; + style::Transitioning<PropertyValue<float>> fillOpacity; + style::Transitioning<PropertyValue<Color>> fillColor; + style::Transitioning<PropertyValue<Color>> fillOutlineColor; + style::Transitioning<PropertyValue<std::array<float, 2>>> fillTranslate; + style::Transitioning<PropertyValue<TranslateAnchorType>> fillTranslateAnchor; + style::Transitioning<PropertyValue<std::string>> fillPattern; + + bool hasTransition() const; + PossiblyEvaluated evaluate(const PropertyEvaluationParameters&) const; + }; + + class Transitionable { + public: + style::Transitionable<PropertyValue<bool>> fillAntialias; + style::Transitionable<PropertyValue<float>> fillOpacity; + style::Transitionable<PropertyValue<Color>> fillColor; + style::Transitionable<PropertyValue<Color>> fillOutlineColor; + style::Transitionable<PropertyValue<std::array<float, 2>>> fillTranslate; + style::Transitionable<PropertyValue<TranslateAnchorType>> fillTranslateAnchor; + style::Transitionable<PropertyValue<std::string>> fillPattern; + + Unevaluated transitioned(const TransitionParameters&, Unevaluated&& prior) const; + Unevaluated untransitioned() const; + + bool hasDataDrivenPropertyDifference(const Transitionable& other) const; + }; +}; + } // namespace style } // namespace mbgl |