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

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

#include "../defines.hpp"
#include "../resource_cache.hpp"

#include "clipper.hpp"

#include "../../base/threaded_list.hpp"

#include "../../std/shared_ptr.hpp"
#include "../../std/function.hpp"

namespace graphics
{
  struct Resource;

  namespace gl
  {
    class BaseTexture;

    class GeometryRenderer : public Clipper
    {
    public:

      typedef Clipper base_t;

      struct UploadData : public Command
      {
        vector<shared_ptr<Resource> > m_uploadQueue;
        shared_ptr<BaseTexture> m_texture;

        UploadData();
        UploadData(shared_ptr<Resource> const * styles,
                   size_t count,
                   shared_ptr<BaseTexture> const & texture);

        void perform();
        void cancel();
        void dump();
      };

      struct DrawGeometry : Command
      {
        shared_ptr<BaseTexture> m_texture;
        Storage m_storage;
        size_t m_indicesCount;
        size_t m_indicesOffs;
        EPrimitives m_primitiveType;
        VertexDecl * m_vertexDecl;
        shared_ptr<Program> m_program;

        void perform();
        void dump();
      };

      struct FreeStorage : public Command
      {
        TStoragePool * m_storagePool;
        Storage m_storage;

        void perform();
        void cancel();
      };

      struct FreeTexture : public Command
      {
        TTexturePool * m_texturePool;
        shared_ptr<BaseTexture> m_texture;

        void perform();
        void cancel();
        void dump();
      };

      struct UnlockStorage : public Command
      {
        Storage m_storage;

        void perform();
        void cancel();
      };

      struct DiscardStorage : public Command
      {
        Storage m_storage;

        void perform();
        void cancel();
      };

      struct ApplySharpStates : public Command
      {
        void perform();
      };

      struct ApplyStates : public Command
      {
        void perform();
      };

      struct ApplyBlitStates : public Command
      {
        void perform();
      };

      GeometryRenderer(base_t::Params const & params);

      void drawGeometry(shared_ptr<BaseTexture> const & texture,
                        Storage const & storage,
                        size_t indicesCount,
                        size_t indicesOffs,
                        EPrimitives primType);

      void uploadResources(shared_ptr<Resource> const * styles,
                           size_t count,
                           shared_ptr<BaseTexture> const & texture);

      void freeTexture(shared_ptr<BaseTexture> const & texture, TTexturePool * texturePool);
      void freeStorage(Storage const & storage, TStoragePool * storagePool);
      void unlockStorage(Storage const & storage);
      void discardStorage(Storage const & storage);

      void applySharpStates();
      void applyBlitStates();
      void applyStates();
    };
  }
}