diff --git a/package.json b/package.json index b0b7924bc34..8eb1b16f7a1 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "devDependencies": { "aws-sdk": "^2.3.5", "express": "^4.11.1", - "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#4a567b438be303fbbf13e5ddf49d72d8debd811d", + "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#13aad76282c1b6c4d38fd46f373325dfec69ab01", "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#b3441d9a285ffbe9b876677acb13d7df07e5b975", "node-gyp": "^3.3.1", "request": "^2.72.0", diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index a3ca2b08581..0f7d894e026 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -100,6 +100,8 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a // The extrusion matrix. matrix::ortho(extrudeMatrix, 0, state.getWidth(), state.getHeight(), 0, 0, -1); + extrudeScale = {{ (2.0f / state.getWidth()) * state.getAltitude(), -2.0f / state.getHeight() * state.getAltitude() }}; + // The native matrix is a 1:1 matrix that paints the coordinates at the // same screen position as the vertex specifies. matrix::identity(nativeMatrix); diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp index a5d4a25b680..6b86dfa69d8 100644 --- a/src/mbgl/renderer/painter.hpp +++ b/src/mbgl/renderer/painter.hpp @@ -158,6 +158,8 @@ class Painter : private util::noncopyable { mat4 nativeMatrix; mat4 extrudeMatrix; + std::array extrudeScale; + // used to composite images and flips the geometry upside down const mat4 flipMatrix = []{ mat4 flip; diff --git a/src/mbgl/renderer/painter_circle.cpp b/src/mbgl/renderer/painter_circle.cpp index d1258d21427..d748811e1a2 100644 --- a/src/mbgl/renderer/painter_circle.cpp +++ b/src/mbgl/renderer/painter_circle.cpp @@ -33,11 +33,12 @@ void Painter::renderCircle(CircleBucket& bucket, config.program = circleShader->getID(); circleShader->u_matrix = vtxMatrix; - circleShader->u_exmatrix = extrudeMatrix; + circleShader->u_extrude_scale = extrudeScale; + circleShader->u_devicepixelratio = frame.pixelRatio; circleShader->u_color = properties.circleColor; - circleShader->u_opacity = properties.circleOpacity; + circleShader->u_radius = properties.circleRadius; circleShader->u_blur = std::max(properties.circleBlur, antialiasing); - circleShader->u_size = properties.circleRadius; + circleShader->u_opacity = properties.circleOpacity; bucket.drawCircles(*circleShader, glObjectStore); } diff --git a/src/mbgl/shader/circle_shader.hpp b/src/mbgl/shader/circle_shader.hpp index 6cb484aeb23..db465f4197c 100644 --- a/src/mbgl/shader/circle_shader.hpp +++ b/src/mbgl/shader/circle_shader.hpp @@ -11,12 +11,13 @@ class CircleShader : public Shader { void bind(GLbyte *offset) final; - UniformMatrix<4> u_matrix = {"u_matrix", *this}; - UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this}; - Uniform> u_color = {"u_color", *this}; - Uniform u_opacity = {"u_opacity", *this}; - Uniform u_size = {"u_size", *this}; - Uniform u_blur = {"u_blur", *this}; + UniformMatrix<4> u_matrix = {"u_matrix", *this}; + Uniform> u_extrude_scale = {"u_extrude_scale", *this}; + Uniform u_devicepixelratio = {"u_devicepixelratio", *this}; + Uniform> u_color = {"u_color", *this}; + Uniform u_radius = {"u_radius", *this}; + Uniform u_blur = {"u_blur", *this}; + Uniform u_opacity = {"u_opacity", *this}; }; } // namespace mbgl