-
Notifications
You must be signed in to change notification settings - Fork 8
/
r_vignette.h
55 lines (41 loc) · 1015 Bytes
/
r_vignette.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
#ifndef R_VIGNETTE_HDR
#define R_VIGNETTE_HDR
#include "r_common.h"
#include "r_method.h"
namespace r {
struct vignetteMethod : method {
vignetteMethod();
bool init(const u::initializer_list<const char *> &defines = { });
void setWVP(const m::mat4 &wvp);
void setColorTextureUnit(int unit);
void setPerspective(const m::perspective &perspective);
void setProperties(float radius, float softness, float opacity);
private:
uniform *m_WVP;
uniform *m_colorMap;
uniform *m_screenSize;
uniform *m_properties;
};
inline vignetteMethod::vignetteMethod()
: m_WVP(nullptr)
, m_colorMap(nullptr)
, m_screenSize(nullptr)
, m_properties(nullptr)
{
}
struct vignette {
vignette();
~vignette();
bool init(const m::perspective &p);
void update(const m::perspective &p);
void bindWriting();
GLuint texture() const;
private:
void destroy();
GLuint m_fbo;
GLuint m_texture;
size_t m_width;
size_t m_height;
};
}
#endif