Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gps_track_shape.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 614068112b23bc5f6e4b13f4ea3ec8762a3ea0ab (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
#pragma once

#include "drape_frontend/map_shape.hpp"
#include "drape_frontend/shape_view_params.hpp"

#include "drape/glstate.hpp"
#include "drape/render_bucket.hpp"
#include "drape/utils/vertex_decl.hpp"
#include "drape/overlay_handle.hpp"
#include "drape/pointers.hpp"

#include "std/vector.hpp"

namespace dp
{
  class TextureManager;
}

namespace df
{

struct GpsTrackRenderData
{
  size_t m_pointsCount;

  dp::GLState m_state;
  drape_ptr<dp::RenderBucket> m_bucket;
  GpsTrackRenderData() : m_pointsCount(0), m_state(0, dp::GLState::OverlayLayer) {}
};

struct GpsTrackDynamicVertex
{
  using TPosition = glsl::vec3;
  using TColor = glsl::vec4;

  GpsTrackDynamicVertex() = default;
  GpsTrackDynamicVertex(TPosition const & pos, TColor const & color)
    : m_position(pos)
    , m_color(color)
  {}

  TPosition m_position;
  TColor m_color;
};

class GpsTrackHandle : public dp::OverlayHandle
{
  using TBase = dp::OverlayHandle;

public:
  GpsTrackHandle(size_t pointsCount);
  void GetAttributeMutation(ref_ptr<dp::AttributeBufferMutator> mutator) const override;
  bool Update(ScreenBase const & screen) override;
  m2::RectD GetPixelRect(ScreenBase const & screen, bool perspective) const override;
  void GetPixelShape(ScreenBase const & screen, bool perspective, Rects & rects) const override;
  bool IndexesRequired() const override;

  void Clear();
  void SetPoint(size_t index, m2::PointD const & position, float radius, dp::Color const & color);
  size_t GetPointsCount() const;

private:
  vector<GpsTrackDynamicVertex> m_buffer;
  mutable bool m_needUpdate;
};

class GpsTrackShape
{
public:
  static void Draw(ref_ptr<dp::TextureManager> texMng, GpsTrackRenderData & data);
};

} // namespace df