From 0f36340eab1207f4d4ff5ec2464a868b795ecb22 Mon Sep 17 00:00:00 2001 From: s464971 Date: Sun, 4 Feb 2024 14:01:03 +0100 Subject: [PATCH] fix: planets --- cw_8/grk-cw8.vcxproj | 2 +- cw_8/src/projekt.hpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cw_8/grk-cw8.vcxproj b/cw_8/grk-cw8.vcxproj index 59c1664..ea3d83b 100644 --- a/cw_8/grk-cw8.vcxproj +++ b/cw_8/grk-cw8.vcxproj @@ -63,7 +63,7 @@ false true Unicode - v143 + v142 diff --git a/cw_8/src/projekt.hpp b/cw_8/src/projekt.hpp index 79b9c9b..9aab8ab 100644 --- a/cw_8/src/projekt.hpp +++ b/cw_8/src/projekt.hpp @@ -112,7 +112,7 @@ void processInput(GLFWwindow* window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 0.1f * deltaTime * 30; + float cameraSpeed = 0.1f * deltaTime * 20; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) spaceshipPos += cameraSpeed * spaceshipDir; if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -242,7 +242,7 @@ void renderScene(GLFWwindow* window) { drawSkybox(cubeContext, glm::translate(cameraPos), texture::cube); //desired objects go here - drawObjectSun(sunContext, glm::scale(glm::vec3(0.1f)) * glm::eulerAngleY(time / 10)); + drawObjectSun(sunContext, glm::scale(glm::vec3(0.1f))); glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f))); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir)); @@ -263,11 +263,11 @@ void renderScene(GLFWwindow* window) { * glm::scale(glm::vec3(0.005f)), texture::ship_albedo, texture::ship_normal, texture::ship_ao, texture::ship_roughness, texture::ship_metallic); - drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(-0.5f * time), texture::planet_albedo, texture::planet_normal, texture::planet_ao, texture::planet_roughness, texture::planet_metallic); - drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(-4.f, 0, 0)) * glm::eulerAngleY(-0.5f * time), texture::mars_albedo, texture::mars_normal, texture::mars_ao, texture::mars_roughness, texture::mars_metallic); - drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, 4.f)) * glm::eulerAngleY(-0.5f * time), texture::jupiter_albedo, texture::jupiter_normal, texture::jupiter_ao, texture::jupiter_roughness, texture::jupiter_metallic); - drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -4.f)) * glm::eulerAngleY(-0.5f * time), texture::earth_albedo, texture::earth_normal, texture::earth_ao, texture::earth_roughness, texture::earth_metallic); - drawObjectPBR(planetContext, glm::translate(glm::vec3(4.f, 0, 4.f)) * glm::eulerAngleY(-0.5f * time), texture::moon_albedo, texture::moon_normal, texture::moon_ao, texture::moon_roughness, texture::moon_metallic); + drawObjectPBR(planetContext, glm::eulerAngleY(time / 4) * glm::translate(glm::vec3(6.f, 0, 0)) * glm::eulerAngleY(-0.7f * time) * glm::scale(glm::vec3(0.4f)), texture::planet_albedo, texture::planet_normal, texture::planet_ao, texture::planet_roughness, texture::planet_metallic); + drawObjectPBR(planetContext, glm::eulerAngleY(time / 5) * glm::translate(glm::vec3(-7.f, 0, 0)) * glm::eulerAngleY(-0.3f * time) * glm::scale(glm::vec3(0.2f)), texture::mars_albedo, texture::mars_normal, texture::mars_ao, texture::mars_roughness, texture::mars_metallic); + drawObjectPBR(planetContext, glm::eulerAngleY(time / 7) * glm::translate(glm::vec3(0, 0, 8.f)) * glm::eulerAngleY(-2.0f * time) * glm::scale(glm::vec3(0.3f)), texture::jupiter_albedo, texture::jupiter_normal, texture::jupiter_ao, texture::jupiter_roughness, texture::jupiter_metallic); + drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY(-1.5f * time) * glm::scale(glm::vec3(0.1f)), texture::earth_albedo, texture::earth_normal, texture::earth_ao, texture::earth_roughness, texture::earth_metallic); + drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY( 2.f * time) * glm::translate(glm::vec3(0.4f, 0, 0.4f)) * glm::eulerAngleY(-0.5f * time) * glm::scale(glm::vec3(0.04f)), texture::moon_albedo, texture::moon_normal, texture::moon_ao, texture::moon_roughness, texture::moon_metallic); drawObjectPBR(stationContext, glm::translate(glm::vec3(0.f, 3.f, 0.f)) * glm::scale(glm::vec3(0.1f)) * glm::eulerAngleY(time), texture::station_albedo, texture::station_normal, texture::station_ao, texture::station_roughness, texture::station_metallic); //desired objects end here @@ -301,7 +301,7 @@ void init(GLFWwindow* window) loadModelToContext("./models/sphere.obj", planetContext); - loadModelToContext("./models/station.obj", stationContext); + loadModelToContext("./models/station.max", stationContext); loadModelToContext("./models/cube.obj", cubeContext);