| 551 | } |
| 552 | |
| 553 | drape_ptr<df::SubrouteMarkersData> RouteShape::CacheMarkers(ref_ptr<dp::GraphicsContext> context, |
| 554 | dp::DrapeID subrouteId, SubrouteConstPtr subroute, |
| 555 | int recacheId, ref_ptr<dp::TextureManager> textures) |
| 556 | { |
| 557 | if (subroute->m_markers.empty()) |
| 558 | return nullptr; |
| 559 | |
| 560 | auto markersData = make_unique_dp<df::SubrouteMarkersData>(); |
| 561 | markersData->m_subrouteId = subrouteId; |
| 562 | markersData->m_pivot = subroute->m_polyline.GetLimitRect().Center(); |
| 563 | markersData->m_recacheId = recacheId; |
| 564 | |
| 565 | MarkersGeometryBuffer geometry; |
| 566 | auto const depth = static_cast<float>(subroute->m_baseDepthIndex * rs::kDepthPerSubroute + rs::kMarkersDepth); |
| 567 | PrepareMarkersGeometry(subroute->m_markers, markersData->m_pivot, depth, geometry); |
| 568 | if (geometry.empty()) |
| 569 | return nullptr; |
| 570 | |
| 571 | auto state = CreateRenderState(gpu::Program::RouteMarker, DepthLayer::GeometryLayer); |
| 572 | |
| 573 | // Batching. |
| 574 | { |
| 575 | uint32_t constexpr kBatchSize = 200; |
| 576 | dp::Batcher batcher(kBatchSize, kBatchSize); |
| 577 | batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Routing)); |
| 578 | dp::SessionGuard guard(context, batcher, |
| 579 | [&markersData](dp::RenderState const & state, drape_ptr<dp::RenderBucket> && b) |
| 580 | { |
| 581 | markersData->m_renderProperty.m_buckets.push_back(std::move(b)); |
| 582 | markersData->m_renderProperty.m_state = state; |
| 583 | }); |
| 584 | |
| 585 | dp::AttributeProvider provider(1 /* stream count */, static_cast<uint32_t>(geometry.size())); |
| 586 | provider.InitStream(0 /* stream index */, MV::GetBindingInfo(), geometry.data()); |
| 587 | batcher.InsertTriangleList(context, state, make_ref(&provider)); |
| 588 | } |
| 589 | |
| 590 | return markersData; |
| 591 | } |
| 592 | |
| 593 | void RouteShape::BatchGeometry(ref_ptr<dp::GraphicsContext> context, dp::RenderState const & state, |
| 594 | ref_ptr<void> geometry, uint32_t geomSize, ref_ptr<void> joinsGeometry, |
nothing calls this directly
no test coverage detected