summaryrefslogtreecommitdiff
path: root/src/mbgl/style/light_impl.hpp
blob: f094c9d462ea01bfc1011cc60286d96a6bc5ecb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include <mbgl/style/light.hpp>
#include <mbgl/style/property_value.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/style/position.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/renderer/property_evaluator.hpp>
#include <mbgl/util/color.hpp>
#include <mbgl/util/indexed_tuple.hpp>

namespace mbgl {
namespace style {

template <class T>
class LightProperty {
public:
    using TransitionableType = Transitionable<PropertyValue<T>>;
    using UnevaluatedType = Transitioning<PropertyValue<T>>;
    using EvaluatorType = PropertyEvaluator<T>;
    using PossiblyEvaluatedType = T;
    using Type = T;
    static constexpr bool IsDataDriven = false;
};

struct LightAnchor : LightProperty<LightAnchorType> {
    static LightAnchorType defaultValue() {
        return LightAnchorType::Viewport;
    }
};

struct LightPosition : LightProperty<Position> {
    static Position defaultValue() {
        std::array<float, 3> default_ = { { 1.15, 210, 30 } };
        return Position{ { default_ } };
    }
};

struct LightColor : LightProperty<Color> {
    static Color defaultValue() {
        return Color::white();
    }
};

struct LightIntensity : LightProperty<float> {
    static float defaultValue() {
        return 0.5;
    }
};

using LightProperties = Properties<LightAnchor, LightPosition, LightColor, LightIntensity>;

class Light::Impl {
public:
    LightProperties::Transitionable properties;
};

} // namespace style
} // namespace mbgl