Fixed debug rendering in 3D

This commit is contained in:
r.kuznetsov 2016-01-08 18:11:38 +03:00
parent f05167a61d
commit 97e33564da
2 changed files with 12 additions and 2 deletions

View file

@ -12,8 +12,10 @@ namespace
m2::PointF PixelPointToScreenSpace(ScreenBase const & screen, m2::PointF const & pt)
{
float const szX = static_cast<float>(screen.PixelRect().SizeX());
float const szY = static_cast<float>(screen.PixelRect().SizeY());
float const szX = static_cast<float>(screen.isPerspective() ? screen.PixelRectIn3d().SizeX() :
screen.PixelRect().SizeX());
float const szY = static_cast<float>(screen.isPerspective() ? screen.PixelRectIn3d().SizeY() :
screen.PixelRect().SizeY());
return m2::PointF(pt.x / szX - 0.5f, -pt.y / szY + 0.5f) * 2.0f;
}

View file

@ -109,10 +109,18 @@ void RenderBucket::RenderDebug(ScreenBase const & screen) const
{
for (auto const & handle : m_overlay)
{
if (!screen.PixelRect().IsIntersect(handle->GetPixelRect(screen, false)))
continue;
OverlayHandle::Rects rects;
handle->GetExtendedPixelShape(screen, rects);
for (auto const & rect : rects)
{
if (screen.isPerspective() && !screen.PixelRectIn3d().IsIntersect(m2::RectD(rect)))
continue;
DebugRectRenderer::Instance().DrawRect(screen, rect);
}
}
}
#endif