diff options
author | Aleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com> | 2019-07-19 10:16:14 +0300 |
---|---|---|
committer | Aleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com> | 2019-07-19 16:18:07 +0300 |
commit | b791a857920d9570b72d8acb0d7791267a113441 (patch) | |
tree | eedbdfb476e94db9eafb577e31c9882bd9ccb62a /src/mbgl/renderer/paint_parameters.cpp | |
parent | 5f38438074e5eefd5ce4ac95c1ed8f5d2216d233 (diff) | |
download | qtlocation-mapboxgl-b791a857920d9570b72d8acb0d7791267a113441.tar.gz |
[core][cp] Backport #15065 to oolong
Diffstat (limited to 'src/mbgl/renderer/paint_parameters.cpp')
-rw-r--r-- | src/mbgl/renderer/paint_parameters.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index badd60a53e..1d4eb412ed 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -19,10 +19,11 @@ TransformParameters::TransformParameters(const TransformState& state_) // 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. - state.getProjMatrix(nearClippedProjMatrix, 100); + // Calculate a second projection matrix with the near plane moved further, + // to a tenth of the far value, so as not to waste depth buffer precision on + // very close empty space, for layer types (fill-extrusion) that use the + // depth buffer to emulate real-world space. + state.getProjMatrix(nearClippedProjMatrix, 0.1 * state.getCameraToCenterDistance()); } PaintParameters::PaintParameters(gfx::Context& context_, @@ -70,6 +71,9 @@ mat4 PaintParameters::matrixForTile(const UnwrappedTileID& tileID, bool aligned) } gfx::DepthMode PaintParameters::depthModeForSublayer(uint8_t n, gfx::DepthMaskType mask) const { + if (currentLayer < opaquePassCutoff) { + return gfx::DepthMode::disabled(); + } float depth = depthRangeSize + ((1 + currentLayer) * numSublayers + n) * depthEpsilon; return gfx::DepthMode { gfx::DepthFunctionType::LessEqual, mask, { depth, depth } }; } |