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

Method CachePointPosition

libs/drape_frontend/my_position.cpp:236–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236void MyPosition::CachePointPosition(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> mng)
237{
238 int constexpr kSymbolsCount = 1;
239 dp::TextureManager::SymbolRegion pointSymbol;
240 mng->GetSymbolRegion("current-position", pointSymbol);
241
242 auto state = CreateRenderState(gpu::Program::MyPosition, DepthLayer::OverlayLayer);
243 state.SetDepthTestEnabled(false);
244 state.SetColorTexture(pointSymbol.GetTexture());
245 state.SetTextureIndex(pointSymbol.GetTextureIndex());
246
247 dp::TextureManager::SymbolRegion * symbols[kSymbolsCount] = {&pointSymbol};
248 EMyPositionPart partIndices[kSymbolsCount] = {MyPositionPoint};
249 {
250 dp::Batcher batcher(kSymbolsCount * dp::Batcher::IndexPerQuad, kSymbolsCount * dp::Batcher::VertexPerQuad);
251 batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Default));
252 dp::SessionGuard guard(context, batcher, [this](dp::RenderState const & state, drape_ptr<dp::RenderBucket> && b)
253 {
254 drape_ptr<dp::RenderBucket> bucket = std::move(b);
255 ASSERT(bucket->GetOverlayHandlesCount() == 0, ());
256
257 m_nodes.emplace_back(state, bucket->MoveBuffer());
258 });
259
260 auto const partIndex = m_nodes.size();
261 for (int i = 0; i < kSymbolsCount; i++)
262 {
263 m_parts[partIndices[i]].second = partIndex;
264 CacheSymbol(context, *symbols[i], state, batcher, partIndices[i]);
265 }
266 }
267}
268
269void MyPosition::RenderPart(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng,
270 gpu::ShapesProgramParams const & params, EMyPositionPart part)

Callers

nothing calls this directly

Calls 12

CreateRenderStateFunction · 0.85
ASSERTFunction · 0.85
GetSymbolRegionMethod · 0.80
SetColorTextureMethod · 0.80
SetBatcherHashMethod · 0.80
SetDepthTestEnabledMethod · 0.45
GetTextureMethod · 0.45
SetTextureIndexMethod · 0.45
GetTextureIndexMethod · 0.45
emplace_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected