| 495 | } |
| 496 | |
| 497 | void 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 | |
| 535 | void RouteRenderer::RenderSubrouteMarkers(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng, |
| 536 | SubrouteInfo const & subrouteInfo, ScreenBase const & screen, |
nothing calls this directly
no test coverage detected