summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-06-04 23:17:59 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-06-13 12:21:50 -0700
commit2c6fcd9f44ff93593a3f21c9f993a1eb4b299bb4 (patch)
treed13e07bbb2568e6a75f1435dcc39f685a653c40f
parent2cbc3d3332e32054e9fdc5323fef8e98f5f99a79 (diff)
downloadqtlocation-mapboxgl-2c6fcd9f44ff93593a3f21c9f993a1eb4b299bb4.tar.gz
[core] add uniforms to DataDrivenPaintPropertys
-rw-r--r--src/mbgl/programs/uniforms.hpp14
-rw-r--r--src/mbgl/style/layers/circle_layer_properties.hpp15
-rw-r--r--src/mbgl/style/layers/fill_extrusion_layer_properties.hpp7
-rw-r--r--src/mbgl/style/layers/fill_layer_properties.hpp7
-rw-r--r--src/mbgl/style/layers/line_layer_properties.hpp11
-rw-r--r--src/mbgl/style/layers/symbol_layer_properties.hpp21
-rw-r--r--src/mbgl/style/paint_property.hpp3
7 files changed, 48 insertions, 30 deletions
diff --git a/src/mbgl/programs/uniforms.hpp b/src/mbgl/programs/uniforms.hpp
index 78ac09942c..c5ec4c23a3 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_SCALAR(Size, u_texsize);
diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp
index 734dab109c..73b7028465 100644
--- a/src/mbgl/style/layers/circle_layer_properties.hpp
+++ b/src/mbgl/style/layers/circle_layer_properties.hpp
@@ -7,23 +7,24 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.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; }
};
@@ -39,15 +40,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 1819f98ae6..19be59a2fe 100644
--- a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp
+++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp
@@ -7,6 +7,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {
@@ -15,7 +16,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(); }
};
@@ -31,11 +32,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 67c2ae1fa4..cb01194515 100644
--- a/src/mbgl/style/layers/fill_layer_properties.hpp
+++ b/src/mbgl/style/layers/fill_layer_properties.hpp
@@ -7,6 +7,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {
@@ -15,15 +16,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 62acad295b..5276b41536 100644
--- a/src/mbgl/style/layers/line_layer_properties.hpp
+++ b/src/mbgl/style/layers/line_layer_properties.hpp
@@ -7,6 +7,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {
@@ -31,11 +32,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(); }
};
@@ -51,15 +52,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 d484d699d7..f7ceaecdaa 100644
--- a/src/mbgl/style/layers/symbol_layer_properties.hpp
+++ b/src/mbgl/style/layers/symbol_layer_properties.hpp
@@ -7,6 +7,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {
@@ -181,23 +182,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; }
};
@@ -209,23 +210,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 cb86fd1a30..c4c996b3bd 100644
--- a/src/mbgl/style/paint_property.hpp
+++ b/src/mbgl/style/paint_property.hpp
@@ -23,7 +23,7 @@ public:
static constexpr bool IsDataDriven = false;
};
-template <class T, class A>
+template <class T, class A, class U>
class DataDrivenPaintProperty {
public:
using TransitionableType = Transitionable<DataDrivenPropertyValue<T>>;
@@ -34,6 +34,7 @@ public:
static constexpr bool IsDataDriven = true;
using Attribute = A;
+ using Uniform = U;
};
template <class T>