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

Method CacheMarkers

libs/drape_frontend/route_shape.cpp:553–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553drape_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
593void RouteShape::BatchGeometry(ref_ptr<dp::GraphicsContext> context, dp::RenderState const & state,
594 ref_ptr<void> geometry, uint32_t geomSize, ref_ptr<void> joinsGeometry,

Callers

nothing calls this directly

Calls 12

CreateRenderStateFunction · 0.85
GetBindingInfoFunction · 0.85
make_refFunction · 0.85
SetBatcherHashMethod · 0.80
InitStreamMethod · 0.80
InsertTriangleListMethod · 0.80
emptyMethod · 0.45
CenterMethod · 0.45
GetLimitRectMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected