diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-01-22 14:46:13 -0800 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-01-24 17:02:18 -0800 |
commit | fcc3808c83102d272006c33fb25f9c0307b466c5 (patch) | |
tree | f4357e542bd037f0312135453c2a9a14cbf34def /src/mbgl/renderer/paint_parameters.cpp | |
parent | d511f74ce45b8d18c376e7c3d806819cbe438627 (diff) | |
download | qtlocation-mapboxgl-fcc3808c83102d272006c33fb25f9c0307b466c5.tar.gz |
[core] align raster imagery rendering to pixel rid to avoid blurriness
Diffstat (limited to 'src/mbgl/renderer/paint_parameters.cpp')
-rw-r--r-- | src/mbgl/renderer/paint_parameters.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index 58dd5597a5..a7f621eb61 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -35,6 +35,10 @@ PaintParameters::PaintParameters(gl::Context& context_, // Update the default matrices to the current viewport dimensions. state.getProjMatrix(projMatrix); + // Also compute a projection matrix that aligns with the current pixel grid, taking into account + // odd viewport sizes. + state.getProjMatrix(alignedProjMatrix, 1, true); + // Calculate a second projection matrix with the near plane clipped to 100 so as // not to waste lots of depth buffer precision on very close empty space, for layer // types (fill-extrusion) that use the depth buffer to emulate real-world space. @@ -47,10 +51,10 @@ PaintParameters::PaintParameters(gl::Context& context_, } } -mat4 PaintParameters::matrixForTile(const UnwrappedTileID& tileID) { +mat4 PaintParameters::matrixForTile(const UnwrappedTileID& tileID, bool aligned) const { mat4 matrix; state.matrixFor(matrix, tileID); - matrix::multiply(matrix, projMatrix, matrix); + matrix::multiply(matrix, aligned ? alignedProjMatrix : projMatrix, matrix); return matrix; } |