summaryrefslogtreecommitdiff
path: root/src/mbgl/style/light_impl.hpp
diff options
context:
space:
mode:
authorLauren Budorick <lauren@mapbox.com>2017-04-27 15:56:55 -0700
committerGitHub <noreply@github.com>2017-04-27 15:56:55 -0700
commitf6e79d70735361438655f279c8699a786d25458c (patch)
treecc01ae7aba097bae4aa84beb12ac6b8f34f4d51a /src/mbgl/style/light_impl.hpp
parent839ad87f37a4880804fb4c79157d998ac59954b5 (diff)
downloadqtlocation-mapboxgl-f6e79d70735361438655f279c8699a786d25458c.tar.gz
[core] Render fill-extrusion layers (#8431)
Diffstat (limited to 'src/mbgl/style/light_impl.hpp')
-rw-r--r--src/mbgl/style/light_impl.hpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/mbgl/style/light_impl.hpp b/src/mbgl/style/light_impl.hpp
new file mode 100644
index 0000000000..d1825090fc
--- /dev/null
+++ b/src/mbgl/style/light_impl.hpp
@@ -0,0 +1,74 @@
+#pragma once
+
+#include <mbgl/style/light.hpp>
+#include <mbgl/style/transitioning_property.hpp>
+#include <mbgl/style/cascade_parameters.hpp>
+#include <mbgl/style/property_evaluator.hpp>
+#include <mbgl/style/property_evaluation_parameters.hpp>
+#include <mbgl/util/ignore.hpp>
+
+namespace mbgl {
+namespace style {
+
+template <class TypeList>
+class Transitioning;
+
+template <class... Ps>
+class Transitioning<TypeList<Ps...>> : public IndexedTuple<
+ TypeList<Ps...>,
+ TypeList<TransitioningProperty<typename Ps::ValueType>...>>
+{
+private:
+ using Properties = TypeList<Ps...>;
+ using Raw = IndexedTuple<Properties, Properties>;
+ using Super = IndexedTuple<
+ TypeList<Ps...>,
+ TypeList<TransitioningProperty<typename Ps::ValueType>...>>;
+
+public:
+ Transitioning() = default;
+ Transitioning(const Raw& raw, Transitioning&& prior, const CascadeParameters& params)
+ : Super {
+ TransitioningProperty<typename Ps::ValueType>(
+ raw.template get<Ps>().value,
+ std::move(prior.template get<Ps>()),
+ raw.template get<Ps>().transition.reverseMerge(params.transition),
+ params.now)...
+ } {}
+
+ bool hasTransition() const {
+ bool result = false;
+ util::ignore({ result |= this->template get<Ps>().hasTransition()... });
+ return result;
+ }
+};
+
+template <class TypeList>
+class Evaluated;
+
+template <class... Ps>
+class Evaluated<TypeList<Ps...>> : public IndexedTuple<
+ TypeList<Ps...>,
+ TypeList<typename Ps::Type...>>
+{
+private:
+ using Properties = TypeList<Ps...>;
+ using TransitioningPs = Transitioning<Properties>;
+ using Super = IndexedTuple<
+ TypeList<Ps...>,
+ TypeList<typename Ps::Type...>>;
+
+public:
+ Evaluated() = default;
+ Evaluated(TransitioningPs& transitioning, const PropertyEvaluationParameters& params)
+ : Super {
+ transitioning.template get<Ps>()
+ .evaluate(PropertyEvaluator<typename Ps::Type>(params, Ps::defaultValue()), params.now)...
+ } {}
+};
+
+using TransitioningLight = Transitioning<LightProperties>;
+using EvaluatedLight = Evaluated<LightProperties>;
+
+} // namespace style
+} // namespace mbgl