-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.cpp
More file actions
24 lines (21 loc) · 935 Bytes
/
Model.cpp
File metadata and controls
24 lines (21 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "Model.h"
Model::Model() {
ModelMatrix = glm::mat4(1.0f);
}
void Model::Matrix(Shader& shader, const char* uniform) {
glUniformMatrix4fv(glGetUniformLocation(shader.ID, uniform), 1, GL_FALSE, glm::value_ptr(ModelMatrix));
}
void Model::Inputs(GLFWwindow *window) {
if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS) {
ModelMatrix = glm::rotate(ModelMatrix, glm::radians(1.0f), glm::vec3(1.0f, 0.0f, 0.0f));
}
if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS) {
ModelMatrix = glm::rotate(ModelMatrix, glm::radians(-1.0f), glm::vec3(1.0f, 0.0f, 0.0f));
}
if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS) {
ModelMatrix = glm::rotate(ModelMatrix, glm::radians(1.0f), glm::vec3(0.0f, 1.0f, 0.0f));
}
if (glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_PRESS) {
ModelMatrix = glm::rotate(ModelMatrix, glm::radians(-1.0f), glm::vec3(0.0f, 1.0f, 0.0f));
}
}