-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIsland.h
95 lines (80 loc) · 1.44 KB
/
Island.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef ISLAND_H
#define ISLAND_H
#include <stdlib.h>
#include <string>
#include <GL/glew.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
#include "shader.h"
#include "sh_matrix.h"
#include "cubemap.h"
typedef struct {
float x;
float y;
float z;
} vertex;
typedef struct {
float x;
float y;
float z;
} normal;
typedef struct {
float u;
float v;
} uv;
typedef struct {
float r;
float g;
float b;
float a;
} colour;
typedef struct {
float height;
} height;
typedef struct {
vertex* verts;
GLuint* indices;
uv* uvs;
colour* colours;
height* heights;
normal* normals;
unsigned int resolution;
unsigned int num_verts;
unsigned int index_count;
} grid;
class Island
{
public:
Island (const char* heightMap,
float scalex,
float scaley,
float scalez,
float posx,
float posy,
float posz);
virtual ~Island();
GLuint vao;
GLuint vbo;
GLuint tex_cube;
glm::mat4 viewMatrix;
glm::mat4 projectionMatrix;
glm::vec3 cameraPosition;
float timer;
float boxScale;
float yPlane;
void render();
void updateView(glm::mat4 viewMatrix);
void updateProjection(glm::mat4 projectionMatrix);
void updatePosition(glm::vec3 cameraPosition);
GLuint progID;
private:
grid createSquareGrid(char* fileInput);
};
extern Island theIsland;
#endif