forked from mapsme/omim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexture.hpp
84 lines (63 loc) · 1.66 KB
/
texture.hpp
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
#pragma once
#include "drape/pointers.hpp"
#include "drape/glconstants.hpp"
#include "drape/drape_global.hpp"
#include "drape/hw_texture.hpp"
#include "geometry/rect2d.hpp"
#include "std/cstdint.hpp"
#include "std/function.hpp"
namespace dp
{
class Texture
{
public:
enum ResourceType
{
Symbol,
Glyph,
StipplePen,
Color,
UniformValue
};
class Key
{
public:
virtual ~Key() {}
virtual ResourceType GetType() const = 0;
};
class ResourceInfo
{
public:
ResourceInfo(m2::RectF const & texRect);
virtual ~ResourceInfo() {}
virtual ResourceType GetType() const = 0;
m2::RectF const & GetTexRect() const;
private:
m2::RectF m_texRect;
};
Texture();
virtual ~Texture();
virtual ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) = 0;
virtual void UpdateState() {}
virtual bool HasAsyncRoutines() const { return false; }
virtual bool HasEnoughSpace(uint32_t newKeysCount) const { return true; }
using Params = HWTexture::Params;
void Create(Params const & params);
void Create(Params const & params, ref_ptr<void> data);
void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data);
TextureFormat GetFormat() const;
uint32_t GetWidth() const;
uint32_t GetHeight() const;
float GetS(uint32_t x) const;
float GetT(uint32_t y) const;
void Bind() const;
// Texture must be bound before calling this method.
void SetFilter(glConst filter);
static uint32_t GetMaxTextureSize();
protected:
void Destroy();
bool AllocateTexture(ref_ptr<HWTextureAllocator> allocator);
private:
drape_ptr<HWTexture> m_hwTexture;
};
} // namespace dp