diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-20 16:38:04 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-30 16:28:32 +0300 |
commit | 61733c1b282cf9338de2d5bc6da7227d769b2d20 (patch) | |
tree | b2cda94bf8a023639cfd16a0bf227ad0630a35a1 /drape_frontend/route_renderer.cpp | |
parent | 568ab191f8ebaa186fb2a6bf959ce23fdeb6a74d (diff) |
Restored point-to-point graphics in drape
Diffstat (limited to 'drape_frontend/route_renderer.cpp')
-rw-r--r-- | drape_frontend/route_renderer.cpp | 76 |
1 files changed, 62 insertions, 14 deletions
diff --git a/drape_frontend/route_renderer.cpp b/drape_frontend/route_renderer.cpp index 9d75c2a7b3..857076eeee 100644 --- a/drape_frontend/route_renderer.cpp +++ b/drape_frontend/route_renderer.cpp @@ -219,24 +219,35 @@ void RouteRenderer::RenderRoute(ScreenBase const & screen, ref_ptr<dp::GpuProgra void RouteRenderer::RenderRouteSigns(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng, dp::UniformValuesStorage const & commonUniforms) { - if (!m_routeData) - return; + if (m_startRouteSign) + { + ASSERT(m_startRouteSign->m_isValid, ()); + RenderRouteSign(m_startRouteSign, screen, mng, commonUniforms); + } - // render end of route + if (m_finishRouteSign) { - dp::GLState const & state = m_routeData->m_endOfRouteSign.m_state; + ASSERT(m_finishRouteSign->m_isValid, ()); + RenderRouteSign(m_finishRouteSign, screen, mng, commonUniforms); + } +} - dp::UniformValuesStorage uniforms = commonUniforms; - uniforms.SetFloatValue("u_opacity", 1.0); +void RouteRenderer::RenderRouteSign(drape_ptr<RouteSignData> const & sign, ScreenBase const & screen, + ref_ptr<dp::GpuProgramManager> mng, + dp::UniformValuesStorage const & commonUniforms) +{ + dp::GLState const & state = sign->m_sign.m_state; - ref_ptr<dp::GpuProgram> program = mng->GetProgram(state.GetProgramIndex()); - program->Bind(); - dp::ApplyState(m_routeData->m_endOfRouteSign.m_state, program); - dp::ApplyUniforms(uniforms, program); + dp::UniformValuesStorage uniforms = commonUniforms; + uniforms.SetFloatValue("u_opacity", 1.0); - for (drape_ptr<dp::RenderBucket> const & bucket : m_routeData->m_endOfRouteSign.m_buckets) - bucket->Render(screen); - } + ref_ptr<dp::GpuProgram> program = mng->GetProgram(state.GetProgramIndex()); + program->Bind(); + dp::ApplyState(sign->m_sign.m_state, program); + dp::ApplyUniforms(uniforms, program); + + for (drape_ptr<dp::RenderBucket> const & bucket : sign->m_sign.m_buckets) + bucket->Render(screen); } void RouteRenderer::RenderArrow(ref_ptr<dp::GpuProgram> prg, drape_ptr<ArrowRenderProperty> const & property, @@ -284,13 +295,48 @@ void RouteRenderer::SetRouteData(drape_ptr<RouteData> && routeData, ref_ptr<dp:: m_routeData = move(routeData); BuildBuckets(m_routeData->m_route, mng); - BuildBuckets(m_routeData->m_endOfRouteSign, mng); for (drape_ptr<ArrowRenderProperty> const & arrow : m_routeData->m_arrows) BuildBuckets(arrow->m_arrow, mng); m_distanceFromBegin = 0.0; } +void RouteRenderer::SetRouteSign(drape_ptr<RouteSignData> && routeSignData, ref_ptr<dp::GpuProgramManager> mng) +{ + if (routeSignData->m_isStart) + { + if (!routeSignData->m_isValid) + { + m_startRouteSign.reset(); + return; + } + + m_startRouteSign = move(routeSignData); + BuildBuckets(m_startRouteSign->m_sign, mng); + } + else + { + if (!routeSignData->m_isValid) + { + m_finishRouteSign.reset(); + return; + } + + m_finishRouteSign = move(routeSignData); + BuildBuckets(m_finishRouteSign->m_sign, mng); + } +} + +drape_ptr<RouteSignData> const & RouteRenderer::GetStartPoint() const +{ + return m_startRouteSign; +} + +drape_ptr<RouteSignData> const & RouteRenderer::GetFinishPoint() const +{ + return m_finishRouteSign; +} + drape_ptr<RouteData> const & RouteRenderer::GetRouteData() const { return m_routeData; @@ -299,6 +345,8 @@ drape_ptr<RouteData> const & RouteRenderer::GetRouteData() const void RouteRenderer::Clear(bool keepDistanceFromBegin) { m_routeData.reset(); + m_startRouteSign.reset(); + m_finishRouteSign.reset(); m_arrowBorders.clear(); m_routeSegments.clear(); |