blob: c3098f5dde189f28c21bd97e494ba7f409d81d3c (
plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#pragma once
#include "base/thread.hpp"
#ifdef DRAW_INFO
#include "base/timer.hpp"
#include "std/vector.hpp"
#include "std/numeric.hpp"
#endif
#include "drape_frontend/base_renderer.hpp"
#include "drape_frontend/threads_commutator.hpp"
#include "drape_frontend/tile_info.hpp"
#include "drape_frontend/tile_tree.hpp"
#include "drape_frontend/backend_renderer.hpp"
#include "drape_frontend/render_group.hpp"
#include "drape_frontend/my_position.hpp"
#include "drape_gui/layer_render.hpp"
#include "drape/pointers.hpp"
#include "drape/glstate.hpp"
#include "drape/vertex_array_buffer.hpp"
#include "drape/gpu_program_manager.hpp"
#include "drape/overlay_tree.hpp"
#include "drape/uniform_values_storage.hpp"
#include "geometry/screenbase.hpp"
#include "std/map.hpp"
namespace dp { class RenderBucket; }
namespace df
{
class FrontendRenderer : public BaseRenderer
{
public:
FrontendRenderer(dp::RefPointer<ThreadsCommutator> commutator,
dp::RefPointer<dp::OGLContextFactory> oglcontextfactory,
dp::RefPointer<dp::TextureManager> textureManager,
Viewport viewport);
~FrontendRenderer() override;
#ifdef DRAW_INFO
double m_tpf;
double m_fps;
my::Timer m_timer;
double m_frameStartTime;
vector<double> m_tpfs;
int m_drawedFrames;
void BeforeDrawFrame();
void AfterDrawFrame();
#endif
void SetModelView(ScreenBase const & screen);
protected:
virtual void AcceptMessage(dp::RefPointer<Message> message);
unique_ptr<threads::IRoutine> CreateRoutine() override;
private:
void RenderScene();
void RefreshProjection();
void RefreshModelView();
void ResolveTileKeys();
void ResolveTileKeys(int tileScale);
int GetCurrentZoomLevel() const;
private:
class Routine : public threads::IRoutine
{
public:
Routine(FrontendRenderer & renderer);
// threads::IRoutine overrides:
void Do() override;
private:
FrontendRenderer & m_renderer;
};
void ReleaseResources();
private:
void DeleteRenderData();
// it applies new model-view matrix to the scene (this matrix will be used on next frame)
void UpdateScene();
void AddToRenderGroup(vector<unique_ptr<RenderGroup>> & groups,
dp::GLState const & state,
dp::MasterPointer<dp::RenderBucket> & renderBucket,
TileKey const & newTile);
void OnAddRenderGroup(TileKey const & tileKey, dp::GLState const & state,
dp::MasterPointer<dp::RenderBucket> & renderBucket);
void OnDeferRenderGroup(TileKey const & tileKey, dp::GLState const & state,
dp::MasterPointer<dp::RenderBucket> & renderBucket);
void OnActivateTile(TileKey const & tileKey);
void OnRemoveTile(TileKey const & tileKey);
private:
dp::RefPointer<dp::TextureManager> m_textureManager;
dp::MasterPointer<dp::GpuProgramManager> m_gpuProgramManager;
private:
vector<unique_ptr<RenderGroup>> m_renderGroups;
vector<unique_ptr<RenderGroup>> m_deferredRenderGroups;
vector<unique_ptr<UserMarkRenderGroup>> m_userMarkRenderGroups;
set<TileKey> m_userMarkVisibility;
dp::MasterPointer<gui::LayerRenderer> m_guiRenderer;
dp::MasterPointer<MyPosition> m_myPositionMark;
dp::UniformValuesStorage m_generalUniforms;
Viewport m_viewport;
ScreenBase m_view;
unique_ptr<TileTree> m_tileTree;
ScreenBase m_newView;
mutex m_modelViewMutex;
dp::OverlayTree m_overlayTree;
};
} // namespace df
|