-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgrid.h
66 lines (46 loc) · 1.03 KB
/
grid.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
// grid.h
#ifndef GRID_H
#define GRID_H
#include <GL/glew.h>
#include "camera.h"
#include "utils.h"
class Grid
{
private:
static const int GRID_WIDTH;
static const int GRID_HEIGHT;
static const int GRID_NB_INDICES;
static const float GRID_WORLD_SIZE;
static const float GRID_Y_FLOOR;
static const float GRID_Y_DISTO;
struct Vertex
{
GLfloat pos[3];
GLfloat col[3];
};
Vertex* m_grid_vertices;
GLuint* m_grid_indices;
float* m_grid_temp_buffer;
float m_time_offset;
// Shader IDs
GLuint m_id_vert_grid;
GLuint m_id_frag_grid;
GLuint m_id_prog_grid;
// Shader uniforms
GLint m_id_uniform_mvp;
// VBO/IBO
GLuint m_id_ibo_grid;
GLuint m_id_vbo_grid;
Camera m_camera;
Color m_color;
public:
Grid();
bool init(float time_offset, const Color& color);
void shut();
const Color& getColor() const {return m_color;}
const Camera& getCamera() const {return m_camera;}
Camera& getCamera() {return m_camera;}
void update(double elapsed, double t);
void draw(const float mvp_matrix[16]);
};
#endif // GRID_H