summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/style/conversion/make_property_setters.hpp1
-rw-r--r--include/mbgl/style/layers/circle_layer.hpp3
-rw-r--r--include/mbgl/style/types.hpp5
-rw-r--r--package.json6
-rw-r--r--src/mbgl/renderer/painter_circle.cpp16
-rw-r--r--src/mbgl/shader/circle_shader.hpp1
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp8
-rw-r--r--src/mbgl/style/layers/circle_layer_properties.cpp2
-rw-r--r--src/mbgl/style/layers/circle_layer_properties.hpp1
-rw-r--r--src/mbgl/style/property_evaluator.cpp2
-rw-r--r--src/mbgl/style/types.cpp5
11 files changed, 43 insertions, 7 deletions
diff --git a/include/mbgl/style/conversion/make_property_setters.hpp b/include/mbgl/style/conversion/make_property_setters.hpp
index 4c0089deaf..3da04e4a63 100644
--- a/include/mbgl/style/conversion/make_property_setters.hpp
+++ b/include/mbgl/style/conversion/make_property_setters.hpp
@@ -112,6 +112,7 @@ auto makePaintPropertySetters() {
result["circle-opacity"] = makePropertySetter<V>(&CircleLayer::setCircleOpacity);
result["circle-translate"] = makePropertySetter<V>(&CircleLayer::setCircleTranslate);
result["circle-translate-anchor"] = makePropertySetter<V>(&CircleLayer::setCircleTranslateAnchor);
+ result["circle-pitch-scale"] = makePropertySetter<V>(&CircleLayer::setCirclePitchScale);
result["raster-opacity"] = makePropertySetter<V>(&RasterLayer::setRasterOpacity);
result["raster-hue-rotate"] = makePropertySetter<V>(&RasterLayer::setRasterHueRotate);
diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp
index c8d99ab30e..873f95bcff 100644
--- a/include/mbgl/style/layers/circle_layer.hpp
+++ b/include/mbgl/style/layers/circle_layer.hpp
@@ -44,6 +44,9 @@ public:
PropertyValue<TranslateAnchorType> getCircleTranslateAnchor() const;
void setCircleTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
+ PropertyValue<CirclePitchScaleType> getCirclePitchScale() const;
+ void setCirclePitchScale(PropertyValue<CirclePitchScaleType>, const optional<std::string>& klass = {});
+
// Private implementation
class Impl;
diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp
index 28ebda9fb9..34e5642ec6 100644
--- a/include/mbgl/style/types.hpp
+++ b/include/mbgl/style/types.hpp
@@ -45,6 +45,11 @@ enum class RotateAnchorType : bool {
Viewport,
};
+enum class CirclePitchScaleType : bool {
+ Map,
+ Viewport,
+};
+
enum class SymbolPlacementType : bool {
Point,
Line,
diff --git a/package.json b/package.json
index 89d361bb90..ac3cd446c5 100644
--- a/package.json
+++ b/package.json
@@ -21,9 +21,9 @@
"csscolorparser": "^1.0.2",
"ejs": "^2.4.1",
"express": "^4.11.1",
- "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#d3a10d1a46b99d3da264cf2d1903cbde6fea3185",
- "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#194fc55b6a7dd54c1e2cf2dd9048fbb5e836716d",
- "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#725bd7410b612d5ddba918f6da82045e3340644e",
+ "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#4d1f89514bf03536c8e682439df165c33a37122a",
+ "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae",
+ "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#d4c5c157397a2df619ba1eecf69a08b34159b3e1",
"node-gyp": "^3.3.1",
"request": "^2.72.0",
"tape": "^4.5.1"
diff --git a/src/mbgl/renderer/painter_circle.cpp b/src/mbgl/renderer/painter_circle.cpp
index 5bc31f7f81..8e9f1909bb 100644
--- a/src/mbgl/renderer/painter_circle.cpp
+++ b/src/mbgl/renderer/painter_circle.cpp
@@ -32,10 +32,18 @@ void Painter::renderCircle(CircleBucket& bucket,
config.program = circleShader.getID();
circleShader.u_matrix = vtxMatrix;
- circleShader->u_extrude_scale = {{
- pixelsToGLUnits[0] * state.getAltitude(),
- pixelsToGLUnits[1] * state.getAltitude()
- }};
+
+ if (properties.circlePitchScale == CirclePitchScaleType::Map) {
+ circleShader.u_extrude_scale = {{
+ pixelsToGLUnits[0] * state.getAltitude(),
+ pixelsToGLUnits[1] * state.getAltitude()
+ }};
+ circleShader.u_scale_with_map = true;
+ } else {
+ circleShader.u_extrude_scale = pixelsToGLUnits;
+ circleShader.u_scale_with_map = false;
+ }
+
circleShader.u_devicepixelratio = frame.pixelRatio;
circleShader.u_color = properties.circleColor;
circleShader.u_radius = properties.circleRadius;
diff --git a/src/mbgl/shader/circle_shader.hpp b/src/mbgl/shader/circle_shader.hpp
index 34466ace04..c454fc1337 100644
--- a/src/mbgl/shader/circle_shader.hpp
+++ b/src/mbgl/shader/circle_shader.hpp
@@ -19,6 +19,7 @@ public:
Uniform<GLfloat> u_radius = {"u_radius", *this};
Uniform<GLfloat> u_blur = {"u_blur", *this};
Uniform<GLfloat> u_opacity = {"u_opacity", *this};
+ Uniform<GLint> u_scale_with_map = {"u_scale_with_map", *this};
};
} // namespace mbgl
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index a47d723548..96cc0b610c 100644
--- a/src/mbgl/style/layers/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -109,5 +109,13 @@ void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> va
impl->paint.circleTranslateAnchor.set(value, klass);
}
+PropertyValue<CirclePitchScaleType> CircleLayer::getCirclePitchScale() const {
+ return impl->paint.circlePitchScale.get();
+}
+
+void CircleLayer::setCirclePitchScale(PropertyValue<CirclePitchScaleType> value, const optional<std::string>& klass) {
+ impl->paint.circlePitchScale.set(value, klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/circle_layer_properties.cpp b/src/mbgl/style/layers/circle_layer_properties.cpp
index 045c73ba63..7243cf87f4 100644
--- a/src/mbgl/style/layers/circle_layer_properties.cpp
+++ b/src/mbgl/style/layers/circle_layer_properties.cpp
@@ -12,6 +12,7 @@ void CirclePaintProperties::cascade(const CascadeParameters& parameters) {
circleOpacity.cascade(parameters);
circleTranslate.cascade(parameters);
circleTranslateAnchor.cascade(parameters);
+ circlePitchScale.cascade(parameters);
}
bool CirclePaintProperties::recalculate(const CalculationParameters& parameters) {
@@ -23,6 +24,7 @@ bool CirclePaintProperties::recalculate(const CalculationParameters& parameters)
hasTransitions |= circleOpacity.calculate(parameters);
hasTransitions |= circleTranslate.calculate(parameters);
hasTransitions |= circleTranslateAnchor.calculate(parameters);
+ hasTransitions |= circlePitchScale.calculate(parameters);
return hasTransitions;
}
diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp
index 40d37dc392..227a67eb6b 100644
--- a/src/mbgl/style/layers/circle_layer_properties.hpp
+++ b/src/mbgl/style/layers/circle_layer_properties.hpp
@@ -23,6 +23,7 @@ public:
PaintProperty<float> circleOpacity { 1 };
PaintProperty<std::array<float, 2>> circleTranslate { {{ 0, 0 }} };
PaintProperty<TranslateAnchorType> circleTranslateAnchor { TranslateAnchorType::Map };
+ PaintProperty<CirclePitchScaleType> circlePitchScale { CirclePitchScaleType::Map };
};
} // namespace style
diff --git a/src/mbgl/style/property_evaluator.cpp b/src/mbgl/style/property_evaluator.cpp
index fd31451d72..abb3681efa 100644
--- a/src/mbgl/style/property_evaluator.cpp
+++ b/src/mbgl/style/property_evaluator.cpp
@@ -24,6 +24,7 @@ template <> std::array<float, 4> defaultStopsValue() { return {{ 0, 0, 0, 0 }};
template <> std::string defaultStopsValue() { return {}; }
template <> TranslateAnchorType defaultStopsValue() { return {}; }
template <> RotateAnchorType defaultStopsValue() { return {}; }
+template <> CirclePitchScaleType defaultStopsValue() { return {}; }
template <> LineCapType defaultStopsValue() { return {}; }
template <> LineJoinType defaultStopsValue() { return {}; }
template <> SymbolPlacementType defaultStopsValue() { return {}; }
@@ -94,6 +95,7 @@ template class PropertyEvaluator<std::array<float, 4>>;
template class PropertyEvaluator<std::string>;
template class PropertyEvaluator<TranslateAnchorType>;
template class PropertyEvaluator<RotateAnchorType>;
+template class PropertyEvaluator<CirclePitchScaleType>;
template class PropertyEvaluator<LineCapType>;
template class PropertyEvaluator<LineJoinType>;
template class PropertyEvaluator<SymbolPlacementType>;
diff --git a/src/mbgl/style/types.cpp b/src/mbgl/style/types.cpp
index 25a1753870..be0b217134 100644
--- a/src/mbgl/style/types.cpp
+++ b/src/mbgl/style/types.cpp
@@ -28,6 +28,11 @@ MBGL_DEFINE_ENUM(RotateAnchorType, {
{ RotateAnchorType::Viewport, "viewport" },
});
+MBGL_DEFINE_ENUM(CirclePitchScaleType, {
+ { CirclePitchScaleType::Map, "map" },
+ { CirclePitchScaleType::Viewport, "viewport" },
+});
+
MBGL_DEFINE_ENUM(LineCapType, {
{ LineCapType::Round, "round" },
{ LineCapType::Butt, "butt" },