diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-06-04 23:17:59 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-14 11:13:43 -0700 |
commit | cf85873f365e5baee73de0fb33113cd7bb134a47 (patch) | |
tree | b5d996ed8c5395085f3e0f0c86c68a49fafc7e93 /src/mbgl | |
parent | b141707b8d17fb72276010075fdc75297de8675e (diff) | |
download | qtlocation-mapboxgl-cf85873f365e5baee73de0fb33113cd7bb134a47.tar.gz |
[core] add uniforms to DataDrivenPaintPropertys
Diffstat (limited to 'src/mbgl')
-rw-r--r-- | src/mbgl/programs/uniforms.hpp | 14 | ||||
-rw-r--r-- | src/mbgl/style/layers/circle_layer_properties.hpp | 15 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_extrusion_layer_properties.hpp | 7 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_layer_properties.hpp | 7 | ||||
-rw-r--r-- | src/mbgl/style/layers/line_layer_properties.hpp | 11 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_properties.hpp | 21 | ||||
-rw-r--r-- | src/mbgl/style/paint_property.hpp | 3 |
7 files changed, 48 insertions, 30 deletions
diff --git a/src/mbgl/programs/uniforms.hpp b/src/mbgl/programs/uniforms.hpp index 972405d5a9..60a50a7cb2 100644 --- a/src/mbgl/programs/uniforms.hpp +++ b/src/mbgl/programs/uniforms.hpp @@ -16,7 +16,19 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_blur); MBGL_DEFINE_UNIFORM_SCALAR(float, u_zoom); MBGL_DEFINE_UNIFORM_SCALAR(float, u_pitch); MBGL_DEFINE_UNIFORM_SCALAR(float, u_bearing); - +MBGL_DEFINE_UNIFORM_SCALAR(float, u_radius); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_width); +MBGL_DEFINE_UNIFORM_SCALAR(Color, u_stroke_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_opacity); +MBGL_DEFINE_UNIFORM_SCALAR(Color, u_fill_color); +MBGL_DEFINE_UNIFORM_SCALAR(Color, u_halo_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_halo_width); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_halo_blur); +MBGL_DEFINE_UNIFORM_SCALAR(Color, u_outline_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_height); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_base); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_gap_width); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_offset); MBGL_DEFINE_UNIFORM_SCALAR(Size, u_world); MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_extrude_scale); diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp index 1cb4f5a635..58206c61da 100644 --- a/src/mbgl/style/layers/circle_layer_properties.hpp +++ b/src/mbgl/style/layers/circle_layer_properties.hpp @@ -6,23 +6,24 @@ #include <mbgl/style/layout_property.hpp> #include <mbgl/style/paint_property.hpp> #include <mbgl/programs/attributes.hpp> +#include <mbgl/programs/uniforms.hpp> namespace mbgl { namespace style { -struct CircleRadius : DataDrivenPaintProperty<float, attributes::a_radius> { +struct CircleRadius : DataDrivenPaintProperty<float, attributes::a_radius, uniforms::u_radius> { static float defaultValue() { return 5; } }; -struct CircleColor : DataDrivenPaintProperty<Color, attributes::a_color> { +struct CircleColor : DataDrivenPaintProperty<Color, attributes::a_color, uniforms::u_color> { static Color defaultValue() { return Color::black(); } }; -struct CircleBlur : DataDrivenPaintProperty<float, attributes::a_blur> { +struct CircleBlur : DataDrivenPaintProperty<float, attributes::a_blur, uniforms::u_blur> { static float defaultValue() { return 0; } }; -struct CircleOpacity : DataDrivenPaintProperty<float, attributes::a_opacity> { +struct CircleOpacity : DataDrivenPaintProperty<float, attributes::a_opacity, uniforms::u_opacity> { static float defaultValue() { return 1; } }; @@ -38,15 +39,15 @@ struct CirclePitchScale : PaintProperty<CirclePitchScaleType> { static CirclePitchScaleType defaultValue() { return CirclePitchScaleType::Map; } }; -struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::a_stroke_width> { +struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::a_stroke_width, uniforms::u_stroke_width> { static float defaultValue() { return 0; } }; -struct CircleStrokeColor : DataDrivenPaintProperty<Color, attributes::a_stroke_color> { +struct CircleStrokeColor : DataDrivenPaintProperty<Color, attributes::a_stroke_color, uniforms::u_stroke_color> { static Color defaultValue() { return Color::black(); } }; -struct CircleStrokeOpacity : DataDrivenPaintProperty<float, attributes::a_stroke_opacity> { +struct CircleStrokeOpacity : DataDrivenPaintProperty<float, attributes::a_stroke_opacity, uniforms::u_stroke_opacity> { static float defaultValue() { return 1; } }; diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp index c1dd3b079d..f41ce68b94 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp @@ -6,6 +6,7 @@ #include <mbgl/style/layout_property.hpp> #include <mbgl/style/paint_property.hpp> #include <mbgl/programs/attributes.hpp> +#include <mbgl/programs/uniforms.hpp> namespace mbgl { namespace style { @@ -14,7 +15,7 @@ struct FillExtrusionOpacity : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct FillExtrusionColor : DataDrivenPaintProperty<Color, attributes::a_color> { +struct FillExtrusionColor : DataDrivenPaintProperty<Color, attributes::a_color, uniforms::u_color> { static Color defaultValue() { return Color::black(); } }; @@ -30,11 +31,11 @@ struct FillExtrusionPattern : CrossFadedPaintProperty<std::string> { static std::string defaultValue() { return ""; } }; -struct FillExtrusionHeight : DataDrivenPaintProperty<float, attributes::a_height> { +struct FillExtrusionHeight : DataDrivenPaintProperty<float, attributes::a_height, uniforms::u_height> { static float defaultValue() { return 0; } }; -struct FillExtrusionBase : DataDrivenPaintProperty<float, attributes::a_base> { +struct FillExtrusionBase : DataDrivenPaintProperty<float, attributes::a_base, uniforms::u_base> { static float defaultValue() { return 0; } }; diff --git a/src/mbgl/style/layers/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp index f44a18d0e0..ee1e5158ce 100644 --- a/src/mbgl/style/layers/fill_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_layer_properties.hpp @@ -6,6 +6,7 @@ #include <mbgl/style/layout_property.hpp> #include <mbgl/style/paint_property.hpp> #include <mbgl/programs/attributes.hpp> +#include <mbgl/programs/uniforms.hpp> namespace mbgl { namespace style { @@ -14,15 +15,15 @@ struct FillAntialias : PaintProperty<bool> { static bool defaultValue() { return true; } }; -struct FillOpacity : DataDrivenPaintProperty<float, attributes::a_opacity> { +struct FillOpacity : DataDrivenPaintProperty<float, attributes::a_opacity, uniforms::u_opacity> { static float defaultValue() { return 1; } }; -struct FillColor : DataDrivenPaintProperty<Color, attributes::a_color> { +struct FillColor : DataDrivenPaintProperty<Color, attributes::a_color, uniforms::u_color> { static Color defaultValue() { return Color::black(); } }; -struct FillOutlineColor : DataDrivenPaintProperty<Color, attributes::a_outline_color> { +struct FillOutlineColor : DataDrivenPaintProperty<Color, attributes::a_outline_color, uniforms::u_outline_color> { static Color defaultValue() { return {}; } }; diff --git a/src/mbgl/style/layers/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp index 724026e3a6..0b234921ad 100644 --- a/src/mbgl/style/layers/line_layer_properties.hpp +++ b/src/mbgl/style/layers/line_layer_properties.hpp @@ -6,6 +6,7 @@ #include <mbgl/style/layout_property.hpp> #include <mbgl/style/paint_property.hpp> #include <mbgl/programs/attributes.hpp> +#include <mbgl/programs/uniforms.hpp> namespace mbgl { namespace style { @@ -30,11 +31,11 @@ struct LineRoundLimit : LayoutProperty<float> { static float defaultValue() { return 1; } }; -struct LineOpacity : DataDrivenPaintProperty<float, attributes::a_opacity> { +struct LineOpacity : DataDrivenPaintProperty<float, attributes::a_opacity, uniforms::u_opacity> { static float defaultValue() { return 1; } }; -struct LineColor : DataDrivenPaintProperty<Color, attributes::a_color> { +struct LineColor : DataDrivenPaintProperty<Color, attributes::a_color, uniforms::u_color> { static Color defaultValue() { return Color::black(); } }; @@ -50,15 +51,15 @@ struct LineWidth : PaintProperty<float> { static float defaultValue() { return 1; } }; -struct LineGapWidth : DataDrivenPaintProperty<float, attributes::a_gap_width> { +struct LineGapWidth : DataDrivenPaintProperty<float, attributes::a_gap_width, uniforms::u_gap_width> { static float defaultValue() { return 0; } }; -struct LineOffset : DataDrivenPaintProperty<float, attributes::a_offset<1>> { +struct LineOffset : DataDrivenPaintProperty<float, attributes::a_offset<1>, uniforms::u_offset> { static float defaultValue() { return 0; } }; -struct LineBlur : DataDrivenPaintProperty<float, attributes::a_blur> { +struct LineBlur : DataDrivenPaintProperty<float, attributes::a_blur, uniforms::u_blur> { static float defaultValue() { return 0; } }; diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index 42f593890b..5b57175785 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -6,6 +6,7 @@ #include <mbgl/style/layout_property.hpp> #include <mbgl/style/paint_property.hpp> #include <mbgl/programs/attributes.hpp> +#include <mbgl/programs/uniforms.hpp> namespace mbgl { namespace style { @@ -180,23 +181,23 @@ struct TextOptional : LayoutProperty<bool> { static bool defaultValue() { return false; } }; -struct IconOpacity : DataDrivenPaintProperty<float, attributes::a_opacity> { +struct IconOpacity : DataDrivenPaintProperty<float, attributes::a_opacity, uniforms::u_opacity> { static float defaultValue() { return 1; } }; -struct IconColor : DataDrivenPaintProperty<Color, attributes::a_fill_color> { +struct IconColor : DataDrivenPaintProperty<Color, attributes::a_fill_color, uniforms::u_fill_color> { static Color defaultValue() { return Color::black(); } }; -struct IconHaloColor : DataDrivenPaintProperty<Color, attributes::a_halo_color> { +struct IconHaloColor : DataDrivenPaintProperty<Color, attributes::a_halo_color, uniforms::u_halo_color> { static Color defaultValue() { return {}; } }; -struct IconHaloWidth : DataDrivenPaintProperty<float, attributes::a_halo_width> { +struct IconHaloWidth : DataDrivenPaintProperty<float, attributes::a_halo_width, uniforms::u_halo_width> { static float defaultValue() { return 0; } }; -struct IconHaloBlur : DataDrivenPaintProperty<float, attributes::a_halo_blur> { +struct IconHaloBlur : DataDrivenPaintProperty<float, attributes::a_halo_blur, uniforms::u_halo_blur> { static float defaultValue() { return 0; } }; @@ -208,23 +209,23 @@ struct IconTranslateAnchor : PaintProperty<TranslateAnchorType> { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct TextOpacity : DataDrivenPaintProperty<float, attributes::a_opacity> { +struct TextOpacity : DataDrivenPaintProperty<float, attributes::a_opacity, uniforms::u_opacity> { static float defaultValue() { return 1; } }; -struct TextColor : DataDrivenPaintProperty<Color, attributes::a_fill_color> { +struct TextColor : DataDrivenPaintProperty<Color, attributes::a_fill_color, uniforms::u_fill_color> { static Color defaultValue() { return Color::black(); } }; -struct TextHaloColor : DataDrivenPaintProperty<Color, attributes::a_halo_color> { +struct TextHaloColor : DataDrivenPaintProperty<Color, attributes::a_halo_color, uniforms::u_halo_color> { static Color defaultValue() { return {}; } }; -struct TextHaloWidth : DataDrivenPaintProperty<float, attributes::a_halo_width> { +struct TextHaloWidth : DataDrivenPaintProperty<float, attributes::a_halo_width, uniforms::u_halo_width> { static float defaultValue() { return 0; } }; -struct TextHaloBlur : DataDrivenPaintProperty<float, attributes::a_halo_blur> { +struct TextHaloBlur : DataDrivenPaintProperty<float, attributes::a_halo_blur, uniforms::u_halo_blur> { static float defaultValue() { return 0; } }; diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index f1752e69d9..c203083c49 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -92,7 +92,7 @@ public: static constexpr bool IsDataDriven = false; }; -template <class T, class A> +template <class T, class A, class U> class DataDrivenPaintProperty { public: using ValueType = DataDrivenPropertyValue<T>; @@ -104,6 +104,7 @@ public: using Type = T; using Attribute = A; + using Uniform = U; }; template <class T> |