summaryrefslogtreecommitdiff
path: root/src/mbgl/programs
diff options
context:
space:
mode:
authorMolly Lloyd <molly@mapbox.com>2018-06-14 14:35:39 -0700
committerMolly Lloyd <mollymerp@users.noreply.github.com>2018-08-31 13:08:47 -0700
commit4a5dc37245d23805d13865f5ef9c5f26e539a9ca (patch)
treede77bfeff6f7afbe02210c9189bf72da59293083 /src/mbgl/programs
parentec62e321531b1a836074056e86de8e20018280fb (diff)
downloadqtlocation-mapboxgl-4a5dc37245d23805d13865f5ef9c5f26e539a9ca.tar.gz
[core] Implement CrossFadedDataDrivenProperty to add support for feature expressions in `*-pattern` properties
Diffstat (limited to 'src/mbgl/programs')
-rw-r--r--src/mbgl/programs/attributes.hpp10
-rw-r--r--src/mbgl/programs/background_program.cpp34
-rw-r--r--src/mbgl/programs/background_program.hpp2
-rw-r--r--src/mbgl/programs/fill_extrusion_program.cpp44
-rw-r--r--src/mbgl/programs/fill_extrusion_program.hpp19
-rw-r--r--src/mbgl/programs/fill_program.cpp32
-rw-r--r--src/mbgl/programs/fill_program.hpp21
-rw-r--r--src/mbgl/programs/line_program.cpp55
-rw-r--r--src/mbgl/programs/line_program.hpp15
-rw-r--r--src/mbgl/programs/symbol_program.cpp34
-rw-r--r--src/mbgl/programs/symbol_program.hpp8
-rw-r--r--src/mbgl/programs/uniforms.hpp4
12 files changed, 121 insertions, 157 deletions
diff --git a/src/mbgl/programs/attributes.hpp b/src/mbgl/programs/attributes.hpp
index f1f1bdaa3f..ce3e7a7668 100644
--- a/src/mbgl/programs/attributes.hpp
+++ b/src/mbgl/programs/attributes.hpp
@@ -147,6 +147,16 @@ struct a_weight {
using Type = gl::AttributeType<float, 1>;
};
+struct a_pattern_to {
+ static auto name() { return "a_pattern_to"; }
+ using Type = gl::AttributeType<uint16_t, 4>;
+};
+
+struct a_pattern_from {
+ static auto name() { return "a_pattern_from"; }
+ using Type = gl::AttributeType<uint16_t, 4>;
+};
+
} // namespace attributes
struct PositionOnlyLayoutAttributes : gl::Attributes<
diff --git a/src/mbgl/programs/background_program.cpp b/src/mbgl/programs/background_program.cpp
index 52a9638d6b..94d7aab2c8 100644
--- a/src/mbgl/programs/background_program.cpp
+++ b/src/mbgl/programs/background_program.cpp
@@ -16,7 +16,7 @@ BackgroundPatternUniforms::values(mat4 matrix,
Size atlasSize,
const ImagePosition& a,
const ImagePosition& b,
- const Faded<std::string>& fading,
+ const CrossfadeParameters& fading,
const UnwrappedTileID& tileID,
const TransformState& state)
{
@@ -25,22 +25,22 @@ BackgroundPatternUniforms::values(mat4 matrix,
int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y;
return BackgroundPatternUniforms::Values {
- uniforms::u_matrix::Value{ matrix },
- uniforms::u_opacity::Value{ opacity },
- uniforms::u_texsize::Value{ atlasSize },
- uniforms::u_pattern_tl_a::Value{ a.tl() },
- uniforms::u_pattern_br_a::Value{ a.br() },
- uniforms::u_pattern_tl_b::Value{ b.tl() },
- uniforms::u_pattern_br_b::Value{ b.br() },
- uniforms::u_pattern_size_a::Value{ a.displaySize() },
- uniforms::u_pattern_size_b::Value{ b.displaySize() },
- uniforms::u_scale_a::Value{ fading.fromScale },
- uniforms::u_scale_b::Value{ fading.toScale },
- uniforms::u_mix::Value{ fading.t },
- uniforms::u_image::Value{ 0 },
- uniforms::u_pixel_coord_upper::Value{ std::array<float, 2> {{ float(pixelX >> 16), float(pixelY >> 16) }} },
- uniforms::u_pixel_coord_lower::Value{ std::array<float, 2> {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} },
- uniforms::u_tile_units_to_pixels::Value{ 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) },
+ uniforms::u_matrix::Value( matrix ),
+ uniforms::u_opacity::Value( opacity ),
+ uniforms::u_texsize::Value( atlasSize ),
+ uniforms::u_pattern_tl_a::Value( a.tl() ),
+ uniforms::u_pattern_br_a::Value( a.br() ),
+ uniforms::u_pattern_tl_b::Value( b.tl() ),
+ uniforms::u_pattern_br_b::Value( b.br() ),
+ uniforms::u_pattern_size_a::Value( a.displaySize() ),
+ uniforms::u_pattern_size_b::Value( b.displaySize() ),
+ uniforms::u_scale_a::Value( fading.fromScale ),
+ uniforms::u_scale_b::Value( fading.toScale ),
+ uniforms::u_mix::Value( fading.t ),
+ uniforms::u_image::Value( 0 ),
+ uniforms::u_pixel_coord_upper::Value( std::array<float, 2> {{ float(pixelX >> 16), float(pixelY >> 16) }}),
+ uniforms::u_pixel_coord_lower::Value( std::array<float, 2> {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF)}}),
+ uniforms::u_tile_units_to_pixels::Value( 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) ),
};
}
diff --git a/src/mbgl/programs/background_program.hpp b/src/mbgl/programs/background_program.hpp
index b76318938c..667db7792b 100644
--- a/src/mbgl/programs/background_program.hpp
+++ b/src/mbgl/programs/background_program.hpp
@@ -50,7 +50,7 @@ struct BackgroundPatternUniforms : gl::Uniforms<
Size atlasSize,
const ImagePosition&,
const ImagePosition&,
- const Faded<std::string>&,
+ const CrossfadeParameters&,
const UnwrappedTileID&,
const TransformState&);
};
diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp
index aaf192a843..2bdd0604d7 100644
--- a/src/mbgl/programs/fill_extrusion_program.cpp
+++ b/src/mbgl/programs/fill_extrusion_program.cpp
@@ -36,47 +36,39 @@ FillExtrusionUniforms::values(mat4 matrix,
const TransformState& state,
const EvaluatedLight& light) {
return FillExtrusionUniforms::Values{
- uniforms::u_matrix::Value{ matrix },
- uniforms::u_lightcolor::Value{ lightColor(light) },
- uniforms::u_lightpos::Value{ lightPosition(light, state) },
- uniforms::u_lightintensity::Value{ lightIntensity(light) }
+ uniforms::u_matrix::Value( matrix ),
+ uniforms::u_lightcolor::Value( lightColor(light) ),
+ uniforms::u_lightpos::Value( lightPosition(light, state) ),
+ uniforms::u_lightintensity::Value( lightIntensity(light) )
};
}
FillExtrusionPatternUniforms::Values
FillExtrusionPatternUniforms::values(mat4 matrix,
Size atlasSize,
- const ImagePosition& a,
- const ImagePosition& b,
- const Faded<std::string>& fading,
+ const CrossfadeParameters& crossfade,
const UnwrappedTileID& tileID,
const TransformState& state,
const float heightFactor,
+ const float pixelRatio,
const EvaluatedLight& light) {
+ const auto tileRatio = 1 / tileID.pixelsToTileUnits(1, state.getIntegerZoom());
int32_t tileSizeAtNearestZoom = util::tileSize * state.zoomScale(state.getIntegerZoom() - tileID.canonical.z);
int32_t pixelX = tileSizeAtNearestZoom * (tileID.canonical.x + tileID.wrap * state.zoomScale(tileID.canonical.z));
int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y;
return FillExtrusionPatternUniforms::Values{
- uniforms::u_matrix::Value{ matrix },
- uniforms::u_pattern_tl_a::Value{ a.tl() },
- uniforms::u_pattern_br_a::Value{ a.br() },
- uniforms::u_pattern_tl_b::Value{ b.tl() },
- uniforms::u_pattern_br_b::Value{ b.br() },
- uniforms::u_pattern_size_a::Value{ a.displaySize() },
- uniforms::u_pattern_size_b::Value{ b.displaySize() },
- uniforms::u_scale_a::Value{ fading.fromScale },
- uniforms::u_scale_b::Value{ fading.toScale },
- uniforms::u_texsize::Value{ atlasSize },
- uniforms::u_mix::Value{ fading.t },
- uniforms::u_image::Value{ 0 },
- uniforms::u_pixel_coord_upper::Value{ std::array<float, 2>{{ float(pixelX >> 16), float(pixelY >> 16) }} },
- uniforms::u_pixel_coord_lower::Value{ std::array<float, 2>{{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} },
- uniforms::u_tile_units_to_pixels::Value{ 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) },
- uniforms::u_height_factor::Value{ heightFactor },
- uniforms::u_lightcolor::Value{ lightColor(light) },
- uniforms::u_lightpos::Value{ lightPosition(light, state) },
- uniforms::u_lightintensity::Value{ lightIntensity(light) },
+ uniforms::u_matrix::Value( matrix ),
+ uniforms::u_scale::Value( {{pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale}} ),
+ uniforms::u_texsize::Value( atlasSize ),
+ uniforms::u_fade::Value( crossfade.t ),
+ uniforms::u_image::Value( 0 ),
+ uniforms::u_pixel_coord_upper::Value( std::array<float, 2>{{ float(pixelX >> 16), float(pixelY >> 16) }} ),
+ uniforms::u_pixel_coord_lower::Value( std::array<float, 2>{{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} ),
+ uniforms::u_height_factor::Value( heightFactor ),
+ uniforms::u_lightcolor::Value( lightColor(light) ),
+ uniforms::u_lightpos::Value( lightPosition(light, state) ),
+ uniforms::u_lightintensity::Value( lightIntensity(light) ),
};
}
diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp
index c499e9ef2d..657238d4c0 100644
--- a/src/mbgl/programs/fill_extrusion_program.hpp
+++ b/src/mbgl/programs/fill_extrusion_program.hpp
@@ -46,20 +46,12 @@ struct FillExtrusionUniforms : gl::Uniforms<
struct FillExtrusionPatternUniforms : gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_pattern_tl_a,
- uniforms::u_pattern_br_a,
- uniforms::u_pattern_tl_b,
- uniforms::u_pattern_br_b,
- uniforms::u_pattern_size_a,
- uniforms::u_pattern_size_b,
- uniforms::u_scale_a,
- uniforms::u_scale_b,
+ uniforms::u_scale,
uniforms::u_texsize,
- uniforms::u_mix,
+ uniforms::u_fade,
uniforms::u_image,
uniforms::u_pixel_coord_upper,
uniforms::u_pixel_coord_lower,
- uniforms::u_tile_units_to_pixels,
uniforms::u_height_factor,
uniforms::u_lightcolor,
uniforms::u_lightpos,
@@ -67,12 +59,11 @@ struct FillExtrusionPatternUniforms : gl::Uniforms<
{
static Values values(mat4,
Size atlasSize,
- const ImagePosition&,
- const ImagePosition&,
- const Faded<std::string>&,
+ const CrossfadeParameters&,
const UnwrappedTileID&,
const TransformState&,
- const float,
+ const float heightFactor,
+ const float pixelRatio,
const EvaluatedLight&);
};
diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp
index 46dc830102..b072343e7a 100644
--- a/src/mbgl/programs/fill_program.cpp
+++ b/src/mbgl/programs/fill_program.cpp
@@ -14,33 +14,25 @@ FillPatternUniforms::Values
FillPatternUniforms::values(mat4 matrix,
Size framebufferSize,
Size atlasSize,
- const ImagePosition& a,
- const ImagePosition& b,
- const Faded<std::string>& fading,
+ const CrossfadeParameters& crossfade,
const UnwrappedTileID& tileID,
- const TransformState& state)
+ const TransformState& state,
+ const float pixelRatio)
{
+ const auto tileRatio = 1 / tileID.pixelsToTileUnits(1, state.getIntegerZoom());
int32_t tileSizeAtNearestZoom = util::tileSize * state.zoomScale(state.getIntegerZoom() - tileID.canonical.z);
int32_t pixelX = tileSizeAtNearestZoom * (tileID.canonical.x + tileID.wrap * state.zoomScale(tileID.canonical.z));
int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y;
return FillPatternUniforms::Values {
- uniforms::u_matrix::Value{ matrix },
- uniforms::u_world::Value{ framebufferSize },
- uniforms::u_texsize::Value{ atlasSize },
- uniforms::u_pattern_tl_a::Value{ a.tl() },
- uniforms::u_pattern_br_a::Value{ a.br() },
- uniforms::u_pattern_tl_b::Value{ b.tl() },
- uniforms::u_pattern_br_b::Value{ b.br() },
- uniforms::u_pattern_size_a::Value{ a.displaySize() },
- uniforms::u_pattern_size_b::Value{ b.displaySize() },
- uniforms::u_scale_a::Value{ fading.fromScale },
- uniforms::u_scale_b::Value{ fading.toScale },
- uniforms::u_mix::Value{ fading.t },
- uniforms::u_image::Value{ 0 },
- uniforms::u_pixel_coord_upper::Value{ std::array<float, 2> {{ float(pixelX >> 16), float(pixelY >> 16) }} },
- uniforms::u_pixel_coord_lower::Value{ std::array<float, 2> {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} },
- uniforms::u_tile_units_to_pixels::Value{ 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) },
+ uniforms::u_matrix::Value( matrix ),
+ uniforms::u_world::Value( framebufferSize ),
+ uniforms::u_texsize::Value( atlasSize ),
+ uniforms::u_scale::Value({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} } ),
+ uniforms::u_fade::Value( crossfade.t ),
+ uniforms::u_image::Value( 0 ),
+ uniforms::u_pixel_coord_upper::Value( std::array<float, 2> {{ float(pixelX >> 16), float(pixelY >> 16) }}),
+ uniforms::u_pixel_coord_lower::Value( std::array<float, 2> {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} )
};
}
diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp
index ac478250fc..9c623fee22 100644
--- a/src/mbgl/programs/fill_program.hpp
+++ b/src/mbgl/programs/fill_program.hpp
@@ -32,28 +32,19 @@ struct FillPatternUniforms : gl::Uniforms<
uniforms::u_matrix,
uniforms::u_world,
uniforms::u_texsize,
- uniforms::u_pattern_tl_a,
- uniforms::u_pattern_br_a,
- uniforms::u_pattern_tl_b,
- uniforms::u_pattern_br_b,
- uniforms::u_pattern_size_a,
- uniforms::u_pattern_size_b,
- uniforms::u_scale_a,
- uniforms::u_scale_b,
- uniforms::u_mix,
+ uniforms::u_scale,
+ uniforms::u_fade,
uniforms::u_image,
uniforms::u_pixel_coord_upper,
- uniforms::u_pixel_coord_lower,
- uniforms::u_tile_units_to_pixels>
+ uniforms::u_pixel_coord_lower>
{
static Values values(mat4 matrix,
Size framebufferSize,
Size atlasSize,
- const ImagePosition&,
- const ImagePosition&,
- const Faded<std::string>&,
+ const CrossfadeParameters& crossfade,
const UnwrappedTileID&,
- const TransformState&);
+ const TransformState&,
+ const float pixelRatio);
};
class FillProgram : public Program<
diff --git a/src/mbgl/programs/line_program.cpp b/src/mbgl/programs/line_program.cpp
index 0533a13c35..55362ad6fe 100644
--- a/src/mbgl/programs/line_program.cpp
+++ b/src/mbgl/programs/line_program.cpp
@@ -20,13 +20,13 @@ Values makeValues(const RenderLinePaintProperties::PossiblyEvaluated& properties
Args&&... args) {
return Values {
- uniforms::u_matrix::Value{
+ uniforms::u_matrix::Value(
tile.translatedMatrix(properties.get<LineTranslate>(),
properties.get<LineTranslateAnchor>(),
state)
- },
- uniforms::u_ratio::Value{ 1.0f / tile.id.pixelsToTileUnits(1.0, state.getZoom()) },
- uniforms::u_gl_units_to_pixels::Value{{{ 1.0f / pixelsToGLUnits[0], 1.0f / pixelsToGLUnits[1] }}},
+ ),
+ uniforms::u_ratio::Value( 1.0f / tile.id.pixelsToTileUnits(1.0, state.getZoom()) ),
+ uniforms::u_gl_units_to_pixels::Value({ {1.0f / pixelsToGLUnits[0], 1.0f / pixelsToGLUnits[1]} }),
std::forward<Args>(args)...
};
}
@@ -52,9 +52,10 @@ LineSDFProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated
const std::array<float, 2>& pixelsToGLUnits,
const LinePatternPos& posA,
const LinePatternPos& posB,
+ const CrossfadeParameters& crossfade,
float atlasWidth) {
- const float widthA = posA.width * properties.get<LineDasharray>().fromScale;
- const float widthB = posB.width * properties.get<LineDasharray>().toScale;
+ const float widthA = posA.width * crossfade.fromScale;
+ const float widthB = posB.width * crossfade.toScale;
std::array<float, 2> scaleA {{
1.0f / tile.id.pixelsToTileUnits(widthA, state.getIntegerZoom()),
@@ -71,13 +72,13 @@ LineSDFProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated
tile,
state,
pixelsToGLUnits,
- uniforms::u_patternscale_a::Value{ scaleA },
- uniforms::u_patternscale_b::Value{ scaleB },
- uniforms::u_tex_y_a::Value{ posA.y },
- uniforms::u_tex_y_b::Value{ posB.y },
- uniforms::u_mix::Value{ properties.get<LineDasharray>().t },
- uniforms::u_sdfgamma::Value{ atlasWidth / (std::min(widthA, widthB) * 256.0f * pixelRatio) / 2.0f },
- uniforms::u_image::Value{ 0 }
+ uniforms::u_patternscale_a::Value( scaleA ),
+ uniforms::u_patternscale_b::Value( scaleB ),
+ uniforms::u_tex_y_a::Value( posA.y ),
+ uniforms::u_tex_y_b::Value( posB.y ),
+ uniforms::u_mix::Value( crossfade.t ),
+ uniforms::u_sdfgamma::Value( atlasWidth / (std::min(widthA, widthB) * 256.0f * pixelRatio) / 2.0f ),
+ uniforms::u_image::Value( 0 )
);
}
@@ -87,32 +88,20 @@ LinePatternProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvalu
const TransformState& state,
const std::array<float, 2>& pixelsToGLUnits,
const Size atlasSize,
- const ImagePosition& posA,
- const ImagePosition& posB) {
- std::array<float, 2> sizeA {{
- tile.id.pixelsToTileUnits(posA.displaySize()[0] * properties.get<LinePattern>().fromScale, state.getIntegerZoom()),
- posA.displaySize()[1]
- }};
-
- std::array<float, 2> sizeB {{
- tile.id.pixelsToTileUnits(posB.displaySize()[0] * properties.get<LinePattern>().toScale, state.getIntegerZoom()),
- posB.displaySize()[1]
- }};
+ const CrossfadeParameters& crossfade,
+ const float pixelRatio) {
+
+ const auto tileRatio = 1 / tile.id.pixelsToTileUnits(1, state.getIntegerZoom());
return makeValues<LinePatternProgram::UniformValues>(
properties,
tile,
state,
pixelsToGLUnits,
- uniforms::u_pattern_tl_a::Value{ posA.tl() },
- uniforms::u_pattern_br_a::Value{ posA.br() },
- uniforms::u_pattern_tl_b::Value{ posB.tl() },
- uniforms::u_pattern_br_b::Value{ posB.br() },
- uniforms::u_pattern_size_a::Value{ sizeA },
- uniforms::u_pattern_size_b::Value{ sizeB },
- uniforms::u_texsize::Value{ atlasSize },
- uniforms::u_fade::Value{ properties.get<LinePattern>().t },
- uniforms::u_image::Value{ 0 }
+ uniforms::u_scale::Value ({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} }),
+ uniforms::u_texsize::Value( atlasSize ),
+ uniforms::u_fade::Value( crossfade.t ),
+ uniforms::u_image::Value( 0 )
);
}
diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp
index 632dbe92b9..9dde0939e7 100644
--- a/src/mbgl/programs/line_program.hpp
+++ b/src/mbgl/programs/line_program.hpp
@@ -9,7 +9,7 @@
#include <mbgl/shaders/line_sdf.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/renderer/layers/render_line_layer.hpp>
-
+#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <cmath>
namespace mbgl {
@@ -24,7 +24,6 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_ratio);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_tex_y_a);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_tex_y_b);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_sdfgamma);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_fade);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_patternscale_a);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_patternscale_b);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_gl_units_to_pixels);
@@ -107,12 +106,7 @@ class LinePatternProgram : public Program<
uniforms::u_matrix,
uniforms::u_ratio,
uniforms::u_gl_units_to_pixels,
- uniforms::u_pattern_tl_a,
- uniforms::u_pattern_br_a,
- uniforms::u_pattern_tl_b,
- uniforms::u_pattern_br_b,
- uniforms::u_pattern_size_a,
- uniforms::u_pattern_size_b,
+ uniforms::u_scale,
uniforms::u_texsize,
uniforms::u_fade,
uniforms::u_image>,
@@ -126,8 +120,8 @@ public:
const TransformState&,
const std::array<float, 2>& pixelsToGLUnits,
Size atlasSize,
- const ImagePosition& posA,
- const ImagePosition& posB);
+ const CrossfadeParameters& crossfade,
+ const float pixelRatio);
};
class LineSDFProgram : public Program<
@@ -157,6 +151,7 @@ public:
const std::array<float, 2>& pixelsToGLUnits,
const LinePatternPos& posA,
const LinePatternPos& posB,
+ const CrossfadeParameters& crossfade,
float atlasWidth);
};
diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp
index d73abd4fe1..0c195e4d37 100644
--- a/src/mbgl/programs/symbol_program.cpp
+++ b/src/mbgl/programs/symbol_program.cpp
@@ -77,25 +77,25 @@ Values makeValues(const bool isText,
mat4 glCoordMatrix = getGlCoordMatrix(tile.matrix, pitchWithMap, rotateWithMap, state, pixelsToTileUnits);
return Values {
- uniforms::u_matrix::Value{ tile.translatedMatrix(values.translate,
+ uniforms::u_matrix::Value( tile.translatedMatrix(values.translate,
values.translateAnchor,
- state) },
- uniforms::u_label_plane_matrix::Value{labelPlaneMatrix},
- uniforms::u_gl_coord_matrix::Value{ tile.translateVtxMatrix(glCoordMatrix,
+ state) ),
+ uniforms::u_label_plane_matrix::Value(labelPlaneMatrix),
+ uniforms::u_gl_coord_matrix::Value( tile.translateVtxMatrix(glCoordMatrix,
values.translate,
values.translateAnchor,
state,
- true) },
- uniforms::u_extrude_scale::Value{ extrudeScale },
- uniforms::u_texsize::Value{ texsize },
- uniforms::u_texture::Value{ 0 },
- uniforms::u_fade_change::Value{ symbolFadeChange },
- uniforms::u_is_text::Value{ isText },
- uniforms::u_camera_to_center_distance::Value{ state.getCameraToCenterDistance() },
- uniforms::u_pitch::Value{ state.getPitch() },
- uniforms::u_pitch_with_map::Value{ pitchWithMap },
- uniforms::u_rotate_symbol::Value{ rotateInShader },
- uniforms::u_aspect_ratio::Value{ state.getSize().aspectRatio() },
+ true) ),
+ uniforms::u_extrude_scale::Value( extrudeScale ),
+ uniforms::u_texsize::Value( texsize ),
+ uniforms::u_texture::Value( 0 ),
+ uniforms::u_fade_change::Value( symbolFadeChange ),
+ uniforms::u_is_text::Value( isText ),
+ uniforms::u_camera_to_center_distance::Value( state.getCameraToCenterDistance() ),
+ uniforms::u_pitch::Value( state.getPitch() ),
+ uniforms::u_pitch_with_map::Value( pitchWithMap ),
+ uniforms::u_rotate_symbol::Value( rotateInShader ),
+ uniforms::u_aspect_ratio::Value( state.getSize().aspectRatio() ),
std::forward<Args>(args)...
};
}
@@ -147,8 +147,8 @@ typename SymbolSDFProgram<PaintProperties>::UniformValues SymbolSDFProgram<Paint
tile,
state,
symbolFadeChange,
- uniforms::u_gamma_scale::Value{ gammaScale },
- uniforms::u_is_halo::Value{ part == SymbolSDFPart::Halo }
+ uniforms::u_gamma_scale::Value( gammaScale ),
+ uniforms::u_is_halo::Value( part == SymbolSDFPart::Halo )
);
}
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index 27bcd7b427..6d22e812fa 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -125,10 +125,10 @@ public:
UniformValues uniformValues(float currentZoom) const {
const ZoomEvaluatedSize u = evaluateForZoom(currentZoom);
return UniformValues {
- uniforms::u_is_size_zoom_constant::Value{ u.isZoomConstant },
- uniforms::u_is_size_feature_constant::Value{ u.isFeatureConstant},
- uniforms::u_size_t::Value{ u.sizeT },
- uniforms::u_size::Value{ u.size }
+ uniforms::u_is_size_zoom_constant::Value( u.isZoomConstant ),
+ uniforms::u_is_size_feature_constant::Value( u.isFeatureConstant),
+ uniforms::u_size_t::Value( u.sizeT ),
+ uniforms::u_size::Value( u.size )
};
}
};
diff --git a/src/mbgl/programs/uniforms.hpp b/src/mbgl/programs/uniforms.hpp
index 071a27c808..ab68e43c87 100644
--- a/src/mbgl/programs/uniforms.hpp
+++ b/src/mbgl/programs/uniforms.hpp
@@ -36,6 +36,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(Size, u_world);
MBGL_DEFINE_UNIFORM_SCALAR(Size, u_texsize);
MBGL_DEFINE_UNIFORM_SCALAR(bool, u_pitch_with_map);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_camera_to_center_distance);
+MBGL_DEFINE_UNIFORM_SCALAR(float, u_fade);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_fade_change);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_weight);
@@ -45,6 +46,9 @@ namespace heatmap {
MBGL_DEFINE_UNIFORM_SCALAR(float, u_extrude_scale);
} // namespace heatmap
+MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 4, u_pattern_from);
+MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 4, u_pattern_to);
+MBGL_DEFINE_UNIFORM_VECTOR(float, 4, u_scale);
MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_tl_a);
MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_br_a);
MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_tl_b);