-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaskTexturizer.h
58 lines (44 loc) · 1.08 KB
/
MaskTexturizer.h
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
#ifndef _MASKTEXTURIZER_H
#define _MASKTEXTURIZER_H
//Classic and Seasons
#include <lang/Object.h>
#include <math/float4.h>
#include <gr/Primitive.h>
#include <gr/Texture.h>
namespace internal
{
class ImageMask :
public lang::Object
{
public:
ImageMask();
void add(const math::float4 vertices[], const math::float4 imageUVs[], Sprite* mask);
lang::Ptr<gr::Primitive> createPrimitive(Context& context);
Texture* texture() const;
bool empty() const;
void clear();
private:
Texture* m_maskTexture;
std::vector<math::float4> m_verts;
std::vector<math::float4> m_imageUVs;
std::vector<math::float4> m_maskUVs;
};
}
class MaskTexturizer :
public lang::Object
{
public:
MaskTexturizer(Context& context);
void addMask(Texture& context, Sprite& mask, math::float2 dest);
void render();
void clear();
bool empty() const;
private:
ImageMask& getMask(gr::Texture& texture);
gr::Context& m_context;
lang::Ptr<gr::Shader> m_shader;
bool m_isFreezing;
std::map<gr::Texture*, internal::ImageMask*> m_tex2mask;
std::deque<lang::Ptr<internal::ImageMask>> m_masks;
};
#endif