-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.h
More file actions
78 lines (54 loc) · 1.49 KB
/
Application.h
File metadata and controls
78 lines (54 loc) · 1.49 KB
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
#pragma once
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// project includes
#include "Camera.h"
#include "Mesh.h"
class Application
{
public:
Application();
~Application();
// static variables for callback function
// window
static const GLuint WIDTH = 800;
static const GLuint HEIGHT = 600;
static int SCREEN_WIDTH, SCREEN_HEIGHT;
// Camera
static Camera camera;
static double lastX;
static double lastY;
static bool firstMouse;
static bool keys[1024];
static bool pauseSimulation;
// get and set methods
GLFWwindow* getWindow() { return m_window; }
Shader getShader() { return m_shader; }
// allocate shader to application
void setShader(const Shader &shader) {
m_shader = shader;
m_shader.Use();
}
// Function prototypes
//static void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mode);
//void scrollCallback(GLFWwindow *window, double xOffset, double yOffset);
//void mouseCallback(GLFWwindow *window, double xPos, double yPos);
void doMovement(GLfloat deltaTime);
int initRender();
// other functions
void clear();
void draw(const Mesh &mesh);
void display();
void terminate(){ glfwTerminate(); }
private:
// view and projection matrices
glm::mat4 m_view = glm::mat4(1.0f);
glm::mat4 m_projection = glm::mat4(1.0f);
// default shader used for anything the application needs to draw that doesn't have a shader (such as lines)
Shader m_shader;
// window
GLFWwindow* m_window = NULL;
};