1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#pragma once
#include "drape_frontend/gui/layer_render.hpp"
#include "drape_frontend/base_renderer.hpp"
#include "drape_frontend/map_data_provider.hpp"
#include "drape_frontend/overlay_batcher.hpp"
#include "drape_frontend/requested_tiles.hpp"
#include "drape_frontend/viewport.hpp"
#include "drape/pointers.hpp"
namespace dp
{
class OGLContextFactory;
class TextureManager;
}
namespace df
{
class Message;
class BatchersPool;
class ReadManager;
class RouteBuilder;
class BackendRenderer : public BaseRenderer
{
public:
using TUpdateCurrentCountryFn = function<void (m2::PointD const &, int)>;
struct Params : BaseRenderer::Params
{
Params(ref_ptr<ThreadsCommutator> commutator, ref_ptr<dp::OGLContextFactory> factory,
ref_ptr<dp::TextureManager> texMng, MapDataProvider const & model,
TUpdateCurrentCountryFn const & updateCurrentCountryFn,
ref_ptr<RequestedTiles> requestedTiles, bool allow3dBuildings)
: BaseRenderer::Params(commutator, factory, texMng)
, m_model(model)
, m_updateCurrentCountryFn(updateCurrentCountryFn)
, m_requestedTiles(requestedTiles)
, m_allow3dBuildings(allow3dBuildings)
{}
MapDataProvider const & m_model;
TUpdateCurrentCountryFn m_updateCurrentCountryFn;
ref_ptr<RequestedTiles> m_requestedTiles;
bool m_allow3dBuildings;
};
BackendRenderer(Params const & params);
~BackendRenderer() override;
void Teardown();
protected:
unique_ptr<threads::IRoutine> CreateRoutine() override;
void OnContextCreate() override;
void OnContextDestroy() override;
private:
void RecacheGui(gui::TWidgetsInitInfo const & initInfo, bool needResetOldGui);
void RecacheChoosePositionMark();
void RecacheMapShapes();
#ifdef RENRER_DEBUG_INFO_LABELS
void RecacheDebugLabels();
#endif
void AcceptMessage(ref_ptr<Message> message) override;
class Routine : public threads::IRoutine
{
public:
Routine(BackendRenderer & renderer);
void Do() override;
private:
BackendRenderer & m_renderer;
};
void ReleaseResources();
void InitGLDependentResource();
void FlushGeometry(drape_ptr<Message> && message);
void CleanupOverlays(TileKey const & tileKey);
MapDataProvider m_model;
drape_ptr<BatchersPool> m_batchersPool;
drape_ptr<ReadManager> m_readManager;
drape_ptr<RouteBuilder> m_routeBuilder;
gui::LayerCacher m_guiCacher;
ref_ptr<RequestedTiles> m_requestedTiles;
TOverlaysRenderData m_overlays;
TUpdateCurrentCountryFn m_updateCurrentCountryFn;
#ifdef DEBUG
bool m_isTeardowned;
#endif
};
} // namespace df
|