MCPcopy Create free account
hub / github.com/comaps/comaps / RenderSubrouteArrows

Method RenderSubrouteArrows

libs/drape_frontend/route_renderer.cpp:497–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497void RouteRenderer::RenderSubrouteArrows(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng,
498 SubrouteInfo const & subrouteInfo, ScreenBase const & screen,
499 FrameValues const & frameValues)
500{
501 if (subrouteInfo.m_arrowsData == nullptr || subrouteInfo.m_arrowsData->m_renderProperty.m_buckets.empty() ||
502 m_hiddenSubroutes.find(subrouteInfo.m_subrouteId) != m_hiddenSubroutes.end())
503 {
504 return;
505 }
506
507 dp::RenderState const & state = subrouteInfo.m_arrowsData->m_renderProperty.m_state;
508 float const currentHalfWidth = GetCurrentHalfWidth(subrouteInfo);
509
510 // Set up parameters.
511 gpu::RouteProgramParams params;
512 frameValues.SetTo(params);
513 math::Matrix<float, 4, 4> mv = screen.GetModelView(subrouteInfo.m_arrowsData->m_pivot, kShapeCoordScalar);
514 params.m_modelView = glsl::make_mat4(mv.m_data);
515 auto const arrowHalfWidth = static_cast<float>(currentHalfWidth * kArrowHeightFactor);
516 params.m_arrowHalfWidth = arrowHalfWidth;
517
518 // Adjust arrow color depending on route type and subroute distance
519 params.m_maskColor =
520 glsl::ToVec4(GetArrowMaskColor(subrouteInfo.m_subroute->m_routeType, subrouteInfo.m_subroute->m_baseDistance));
521
522 ref_ptr<dp::GpuProgram> prg = mng->GetProgram(gpu::Program::RouteArrow);
523 prg->Bind();
524 dp::ApplyState(context, prg, state);
525 mng->GetParamsSetter()->Apply(context, prg, params);
526
527 auto const & clipRect = screen.ClipRect();
528 CHECK_EQUAL(subrouteInfo.m_arrowsData->m_renderProperty.m_buckets.size(),
529 subrouteInfo.m_arrowsData->m_renderProperty.m_boundingBoxes.size(), ());
530 for (size_t i = 0; i < subrouteInfo.m_arrowsData->m_renderProperty.m_buckets.size(); ++i)
531 if (subrouteInfo.m_arrowsData->m_renderProperty.m_boundingBoxes[i].IsIntersect(clipRect))
532 subrouteInfo.m_arrowsData->m_renderProperty.m_buckets[i]->Render(context, state.GetDrawAsLine());
533}
534
535void RouteRenderer::RenderSubrouteMarkers(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng,
536 SubrouteInfo const & subrouteInfo, ScreenBase const & screen,

Callers

nothing calls this directly

Calls 15

GetCurrentHalfWidthFunction · 0.85
ToVec4Function · 0.85
ApplyStateFunction · 0.85
SetToMethod · 0.80
GetModelViewMethod · 0.80
GetParamsSetterMethod · 0.80
GetDrawAsLineMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetProgramMethod · 0.45
BindMethod · 0.45

Tested by

no test coverage detected