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

Method Draw

libs/drape_frontend/circles_pack_shape.cpp:144–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void CirclesPackShape::Draw(ref_ptr<dp::GraphicsContext> context, CirclesPackRenderData & data)
145{
146 ASSERT_NOT_EQUAL(data.m_pointsCount, 0, ());
147
148 uint32_t constexpr kVerticesInPoint = dp::Batcher::VertexPerQuad;
149 uint32_t constexpr kIndicesInPoint = dp::Batcher::IndexPerQuad;
150
151 std::vector<CirclesPackStaticVertex> staticVertexData;
152 staticVertexData.reserve(data.m_pointsCount * kVerticesInPoint);
153 static_assert(kVerticesInPoint == 4, "According to the loop below");
154 for (size_t i = 0; i < data.m_pointsCount; ++i)
155 {
156 staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(-1.0f, 1.0f, 1.0f));
157 staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(-1.0f, -1.0f, 1.0f));
158 staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(1.0f, 1.0f, 1.0f));
159 staticVertexData.emplace_back(CirclesPackStaticVertex::TNormal(1.0f, -1.0f, 1.0f));
160 }
161
162 std::vector<CirclesPackDynamicVertex> dynamicVertexData;
163 dynamicVertexData.resize(data.m_pointsCount * kVerticesInPoint);
164
165 dp::Batcher batcher(data.m_pointsCount * kIndicesInPoint, data.m_pointsCount * kVerticesInPoint);
166 batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Overlay));
167 dp::SessionGuard guard(context, batcher, [&data](dp::RenderState const & state, drape_ptr<dp::RenderBucket> && b)
168 {
169 data.m_bucket = std::move(b);
170 data.m_state = state;
171 });
172
173 drape_ptr<dp::OverlayHandle> handle = make_unique_dp<CirclesPackHandle>(data.m_pointsCount);
174
175 dp::AttributeProvider provider(2 /* stream count */, static_cast<uint32_t>(staticVertexData.size()));
176 provider.InitStream(0 /* stream index */, GetCirclesPackStaticBindingInfo(), make_ref(staticVertexData.data()));
177 provider.InitStream(1 /* stream index */, GetCirclesPackDynamicBindingInfo(), make_ref(dynamicVertexData.data()));
178 batcher.InsertListOfStrip(context, GetCirclesPackState(), make_ref(&provider), std::move(handle), kVerticesInPoint);
179
180 context->Flush();
181}
182} // namespace df

Callers

nothing calls this directly

Calls 11

make_refFunction · 0.85
GetCirclesPackStateFunction · 0.85
SetBatcherHashMethod · 0.80
InitStreamMethod · 0.80
InsertListOfStripMethod · 0.80
reserveMethod · 0.45
emplace_backMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected