-
Notifications
You must be signed in to change notification settings - Fork 8
/
r_billboard.h
80 lines (60 loc) · 1.33 KB
/
r_billboard.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef R_BILLBOARD_HDR
#define R_BILLBOARD_HDR
#include "r_geom.h"
#include "r_texture.h"
#include "r_method.h"
#include "r_stats.h"
#include "m_vec.h"
namespace u {
struct string;
}
namespace m {
struct mat4;
}
namespace r {
struct pipeline;
struct billboardMethod : method {
billboardMethod();
bool init();
void setVP(const m::mat4 &vp);
void setColorTextureUnit(int unit);
private:
uniform *m_VP;
uniform *m_colorMap;
};
struct billboard : geom {
billboard();
~billboard();
bool load(const u::string &billboardTexture);
bool upload();
void render(const pipeline &pl, float size);
enum {
kSide = 1 << 1,
kUp = 1 << 2,
kHighlight = 1<< 3
};
void add(const m::vec3 &position,
int flags = kSide | kUp,
const m::vec3 &optionalSide = m::vec3::origin,
const m::vec3 &optionalUp = m::vec3::origin);
size_t memory() const;
private:
struct vertex {
m::vec3 position;
m::vec2 coordinate;
};
struct entry {
m::vec3 position;
int flags;
m::vec3 side;
m::vec3 up;
};
u::vector<entry> m_entries;
u::vector<vertex> m_vertices;
u::vector<GLuint> m_indices;
texture2D m_texture;
billboardMethod m_method;
r::stat *m_stats;
};
}
#endif