| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <mbgl/style/light.hpp> |
| 4 | #include <mbgl/style/property_value.hpp> |
| 5 | #include <mbgl/style/types.hpp> |
| 6 | #include <mbgl/style/position.hpp> |
| 7 | #include <mbgl/style/properties.hpp> |
| 8 | #include <mbgl/renderer/property_evaluator.hpp> |
| 9 | #include <mbgl/util/color.hpp> |
| 10 | #include <mbgl/util/indexed_tuple.hpp> |
| 11 | |
| 12 | namespace mbgl { |
| 13 | namespace style { |
| 14 | |
| 15 | template <class T> |
| 16 | class LightProperty { |
| 17 | public: |
| 18 | using TransitionableType = Transitionable<PropertyValue<T>>; |
| 19 | using UnevaluatedType = Transitioning<PropertyValue<T>>; |
| 20 | using EvaluatorType = PropertyEvaluator<T>; |
| 21 | using PossiblyEvaluatedType = T; |
| 22 | using Type = T; |
| 23 | static constexpr bool IsDataDriven = false; |
| 24 | }; |
| 25 | |
| 26 | struct LightAnchor : LightProperty<LightAnchorType> { |
| 27 | static LightAnchorType defaultValue() { |
| 28 | return LightAnchorType::Viewport; |
| 29 | } |
| 30 | }; |
| 31 | |
| 32 | struct LightPosition : LightProperty<Position> { |
| 33 | static Position defaultValue() { |
| 34 | std::array<float, 3> default_ = { ._M_elems: { 1.15, 210, 30 } }; |
| 35 | return Position{ { default_ } }; |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | struct LightColor : LightProperty<Color> { |
| 40 | static Color defaultValue() { |
| 41 | return Color::white(); |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | struct LightIntensity : LightProperty<float> { |
| 46 | static float defaultValue() { |
| 47 | return 0.5; |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | using LightProperties = Properties<LightAnchor, LightPosition, LightColor, LightIntensity>; |
| 52 | |
| 53 | class Light::Impl { |
| 54 | public: |
| 55 | LightProperties::Transitionable properties; |
| 56 | }; |
| 57 | |
| 58 | } // namespace style |
| 59 | } // namespace mbgl |
| 60 |
