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

Method BatchGeometry

libs/drape_frontend/route_shape.cpp:593–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,
595 uint32_t joinsGeomSize, m2::RectD const & boundingBox,
596 dp::BindingInfo const & bindingInfo, RouteRenderProperty & property)
597{
598 auto verticesCount = geomSize + joinsGeomSize;
599 if (verticesCount == 0)
600 return;
601
602 uint32_t constexpr kMinBatchSize = 100;
603 uint32_t constexpr kMaxBatchSize = 65000;
604 uint32_t constexpr kIndicesScalar = 2;
605
606 verticesCount = math::Clamp(verticesCount, kMinBatchSize, kMaxBatchSize);
607 auto const indicesCount = math::Clamp(verticesCount * kIndicesScalar, kMinBatchSize, kMaxBatchSize);
608
609 dp::Batcher batcher(indicesCount, verticesCount);
610 batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Routing));
611 dp::SessionGuard guard(context, batcher,
612 [&property, &boundingBox](dp::RenderState const & state, drape_ptr<dp::RenderBucket> && b)
613 {
614 property.m_buckets.push_back(std::move(b));
615 property.m_boundingBoxes.push_back(boundingBox);
616 property.m_state = state;
617 });
618
619 if (geomSize != 0)
620 {
621 dp::AttributeProvider provider(1 /* stream count */, geomSize);
622 provider.InitStream(0 /* stream index */, bindingInfo, geometry);
623 batcher.InsertListOfStrip(context, state, make_ref(&provider), 4);
624 }
625
626 if (joinsGeomSize != 0)
627 {
628 dp::AttributeProvider joinsProvider(1 /* stream count */, joinsGeomSize);
629 joinsProvider.InitStream(0 /* stream index */, bindingInfo, joinsGeometry);
630 batcher.InsertTriangleList(context, state, make_ref(&joinsProvider));
631 }
632}
633} // namespace df

Callers

nothing calls this directly

Calls 7

ClampFunction · 0.85
make_refFunction · 0.85
SetBatcherHashMethod · 0.80
InitStreamMethod · 0.80
InsertListOfStripMethod · 0.80
InsertTriangleListMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected