diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-09-24 16:28:57 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:27:27 +0300 |
commit | 38928e0294c8ed4ebc09a0982689b709c30998c7 (patch) | |
tree | bc2d3ada37ac4e181bb1f07fe529d30db1c9c281 | |
parent | 4f5ea66f790ba87225fb85ece34b3561858e85f1 (diff) |
[core] simple depth shift for tile. We need that tiles with greater zoomScale get greater depth.
-rw-r--r-- | graphics/blitter.cpp | 22 | ||||
-rw-r--r-- | graphics/blitter.hpp | 4 | ||||
-rw-r--r-- | map/coverage_generator.cpp | 12 | ||||
-rw-r--r-- | map/yopme_render_policy.cpp | 3 |
4 files changed, 22 insertions, 19 deletions
diff --git a/graphics/blitter.cpp b/graphics/blitter.cpp index 6b6b7d9233..3d33be28ff 100644 --- a/graphics/blitter.cpp +++ b/graphics/blitter.cpp @@ -28,8 +28,7 @@ namespace graphics void Blitter::blit(BlitInfo const * blitInfo, size_t s, - bool isSubPixel, - double depth) + bool isSubPixel) { vector<m2::PointF> geomPts(4 * s); vector<m2::PointF> texPts(4 * s); @@ -68,15 +67,18 @@ namespace graphics gl::Vertex * pointsData = (gl::Vertex*)storage.m_vertices->data(); - for (size_t i = 0; i < s * 4; ++i) + for (size_t i = 0; i < s; ++i) { - pointsData[i].pt.x = geomPts[i].x; - pointsData[i].pt.y = geomPts[i].y; - pointsData[i].depth = depth; - pointsData[i].tex.x = texPts[i].x; - pointsData[i].tex.y = texPts[i].y; - pointsData[i].normal.x = 0; - pointsData[i].normal.y = 0; + for (size_t j = i * 4; j < (i + 1) * 4; ++j) + { + pointsData[j].pt.x = geomPts[j].x; + pointsData[j].pt.y = geomPts[j].y; + pointsData[j].depth = blitInfo[i].m_depth; + pointsData[j].tex.x = texPts[j].x; + pointsData[j].tex.y = texPts[j].y; + pointsData[j].normal.x = 0; + pointsData[j].normal.y = 0; + } // pointsData[i].color = graphics::Color(255, 255, 255, 255); } diff --git a/graphics/blitter.hpp b/graphics/blitter.hpp index b4fa7f45ba..d459791d99 100644 --- a/graphics/blitter.hpp +++ b/graphics/blitter.hpp @@ -28,6 +28,7 @@ namespace graphics math::Matrix<double, 3, 3> m_matrix; m2::RectI m_srcRect; m2::RectU m_texRect; + double m_depth; }; class Blitter : public GeometryBatcher @@ -54,8 +55,7 @@ namespace graphics void blit(BlitInfo const * blitInfo, size_t s, - bool isSubPixel, - double depth); + bool isSubPixel); /// @} }; } diff --git a/map/coverage_generator.cpp b/map/coverage_generator.cpp index 87d2e84780..6a29394171 100644 --- a/map/coverage_generator.cpp +++ b/map/coverage_generator.cpp @@ -480,13 +480,10 @@ bool CoverageGenerator::CacheCoverage(core::CommandsQueue::Environment const & e m_cacheScreen->setDisplayList(m_backCoverage->m_mainElements); vector<graphics::BlitInfo> infos; + infos.reserve(m_coverageInfo.m_tiles.size()); - for (CoverageInfo::TTileSet::const_iterator it = m_coverageInfo.m_tiles.begin(); - it != m_coverageInfo.m_tiles.end(); - ++it) + for (Tile const * tile : m_coverageInfo.m_tiles) { - Tile const * tile = *it; - size_t tileWidth = tile->m_renderTarget->width(); size_t tileHeight = tile->m_renderTarget->height(); @@ -496,12 +493,15 @@ bool CoverageGenerator::CacheCoverage(core::CommandsQueue::Environment const & e bi.m_srcRect = m2::RectI(0, 0, tileWidth - 2, tileHeight - 2); bi.m_texRect = m2::RectU(1, 1, tileWidth - 1, tileHeight - 1); bi.m_srcSurface = tile->m_renderTarget; + bi.m_depth = tile->m_rectInfo.m_tileScale * 100; infos.push_back(bi); } if (!infos.empty()) - m_cacheScreen->blit(&infos[0], infos.size(), true, graphics::minDepth); + m_cacheScreen->blit(infos.data(), infos.size(), true); + + m_cacheScreen->clear(graphics::Color(), false); math::Matrix<double, 3, 3> idM = math::Identity<double, 3>(); diff --git a/map/yopme_render_policy.cpp b/map/yopme_render_policy.cpp index 5003c76801..84ce6d1bbf 100644 --- a/map/yopme_render_policy.cpp +++ b/map/yopme_render_policy.cpp @@ -239,12 +239,13 @@ void YopmeRP::DrawFrame(shared_ptr<PaintEvent> const & e, ScreenBase const & s) info.m_srcRect = m2::RectI(0, 0, width, height); info.m_texRect = m2::RectU(0, 0, width, height); info.m_matrix = math::Identity<double, 3>(); + info.m_depth = minDepth; pScreen->beginFrame(); pScreen->clear(m_bgColor); pScreen->applyBlitStates(); - pScreen->blit(&info, 1, true, minDepth); + pScreen->blit(&info, 1, true); pScreen->clear(m_bgColor, false); if (m_drawMyPosition) |