forked from organicmaps/organicmaps
[core] simple depth shift for tile. We need that tiles with greater zoomScale get greater depth.
This commit is contained in:
parent
4f5ea66f79
commit
38928e0294
4 changed files with 22 additions and 19 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
/// @}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue