[core] add uniforms to DataDrivenPaintPropertys
This commit is contained in:
committed by
John Firebaugh
parent
b141707b8d
commit
cf85873f36
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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 {}; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user