forked from graphitemaster/neothyne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
r_billboard.h
58 lines (42 loc) · 958 Bytes
/
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
#ifndef R_BILLBOARD_HDR
#define R_BILLBOARD_HDR
#include "r_geom.h"
#include "r_texture.h"
#include "r_method.h"
#include "u_vector.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:
GLuint m_VPLocation;
GLuint m_colorMapLocation;
};
struct billboard : geom {
bool load(const u::string &billboardTexture);
bool upload();
void render(const pipeline &pl, float size);
// you must add all positions for this billboard before calling `upload'
void add(const m::vec3 &position);
private:
struct vertex {
m::vec3 p;
float u, v;
};
u::vector<m::vec3> m_positions;
u::vector<vertex> m_vertices;
texture2D m_texture;
billboardMethod m_method;
};
}
#endif