blob: e86e152530bc32bbdae847ec460c172a79afd0cd (
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
|
#pragma once
#include "drape/debug_renderer.hpp"
#include "drape/gpu_program.hpp"
#include "drape/mesh_object.hpp"
#include "drape/render_state.hpp"
#include "shaders/program_params.hpp"
#include "geometry/rect2d.hpp"
#include "geometry/screenbase.hpp"
#include <vector>
namespace df
{
class DebugRectRenderer : public dp::DebugRenderer
{
using Base = dp::MeshObject;
public:
DebugRectRenderer(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
ref_ptr<gpu::ProgramParamsSetter> paramsSetter);
void SetEnabled(bool enabled);
bool IsEnabled() const override;
void DrawRect(ref_ptr<dp::GraphicsContext> context, ScreenBase const & screen,
m2::RectF const & rect, dp::Color const & color) override;
void DrawArrow(ref_ptr<dp::GraphicsContext> context, ScreenBase const & screen,
dp::OverlayTree::DisplacementData const & data) override;
void FinishRendering();
private:
void SetArrow(ref_ptr<dp::GraphicsContext> context, m2::PointF const & arrowStart,
m2::PointF const & arrowEnd, ScreenBase const & screen);
void SetRect(ref_ptr<dp::GraphicsContext> context, m2::RectF const & rect,
ScreenBase const & screen);
std::vector<drape_ptr<dp::MeshObject>> m_rectMeshes;
std::vector<drape_ptr<dp::MeshObject>> m_arrowMeshes;
size_t m_currentRectMesh = 0;
size_t m_currentArrowMesh = 0;
ref_ptr<dp::GpuProgram> m_program;
ref_ptr<gpu::ProgramParamsSetter> m_paramsSetter;
dp::RenderState m_state;
bool m_isEnabled = false;
};
} // namespace df
|