From 6c1349b526c1d1985b6f8a70cef511bdc33e3246 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Mon, 7 Nov 2022 14:57:45 +0100 Subject: [PATCH] Refactor --- headers/renderer.hpp | 3 +++ src/main.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/headers/renderer.hpp b/headers/renderer.hpp index ba190ad..c83ac7b 100644 --- a/headers/renderer.hpp +++ b/headers/renderer.hpp @@ -18,6 +18,8 @@ #define NEAR_PLANE 0.1f #define FAR_PLANE 100.0f +#define CAM_SPEED 0.05f + namespace Renderer { class Object { public: @@ -58,6 +60,7 @@ namespace Renderer { glm::mat4 view = glm::mat4(1.0f); private: GLFWwindow* window; + // glm::vec3 front = glm::vec3(0.0f, 0.0f, -1.0f); }; diff --git a/src/main.cpp b/src/main.cpp index 05611b7..2498556 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -177,12 +177,12 @@ int main() { // scene.camera.setRotation(glm::vec3(gVal * 5, 5.0f * gVal, gVal * 20.0f)); // scene.camera.translate(glm::vec3(0.0f, 0.0f, 0.02f + gVal/100.0f)); scene.camera.pointAt(glm::vec3(0.0f, 0.0f, 0.0f)); - scene.camera.setPosition(glm::vec3(cos(time)*10.0f, 0.0f, gVal*10.0f)); + float radius = 10.0f; + scene.camera.setPosition(glm::vec3(cos(time) * radius, 0.0f, sin(time) * radius)); // Move the objects & stuff float rotang = time; - ro.rotate(glm::vec3(0.0f, 0.0f, gVal)); - + ro.rotate(glm::vec3(gVal, 0.0f, gVal)); ro2.setPosition(glm::vec3(0.0f, gVal * 2.0f, 1.0f + gVal*5.0f)); // Render new frame