Added ability to slide the camera on the x-axis

This commit is contained in:
JonasJan2 2024-05-24 15:24:52 +02:00
parent 420b982694
commit 296d35b69b
1 changed files with 7 additions and 1 deletions

View File

@ -58,7 +58,7 @@ const GLfloat pi = 3.14159f;
vec3 cameraPosition = {0.0f, 3.0f, 5.5f}; vec3 cameraPosition = {0.0f, 3.0f, 5.5f};
char* defaultModel = "../obj/earth.obj"; char* defaultModel = "../obj/monkey.obj";
char* model; char* model;
// input handler for camera movement // input handler for camera movement
@ -69,6 +69,12 @@ void handleInputs(double deltaTime) {
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) {
cameraPosition.z -= deltaTime * 10; cameraPosition.z -= deltaTime * 10;
} }
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) {
cameraPosition.x += deltaTime * 10;
}
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) {
cameraPosition.x -= deltaTime * 10;
}
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS) {
cameraPosition.y += deltaTime * 10; cameraPosition.y += deltaTime * 10;
} }