fix: planets

This commit is contained in:
s464971 2024-02-04 14:01:03 +01:00
parent d150694eff
commit 0f36340eab
2 changed files with 9 additions and 9 deletions

View File

@ -63,7 +63,7 @@
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@ -112,7 +112,7 @@ void processInput(GLFWwindow* window)
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true); glfwSetWindowShouldClose(window, true);
float cameraSpeed = 0.1f * deltaTime * 30; float cameraSpeed = 0.1f * deltaTime * 20;
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
spaceshipPos += cameraSpeed * spaceshipDir; spaceshipPos += cameraSpeed * spaceshipDir;
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
@ -242,7 +242,7 @@ void renderScene(GLFWwindow* window) {
drawSkybox(cubeContext, glm::translate(cameraPos), texture::cube); drawSkybox(cubeContext, glm::translate(cameraPos), texture::cube);
//desired objects go here //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 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir)); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
@ -263,11 +263,11 @@ void renderScene(GLFWwindow* window) {
* glm::scale(glm::vec3(0.005f)), * glm::scale(glm::vec3(0.005f)),
texture::ship_albedo, texture::ship_normal, texture::ship_ao, texture::ship_roughness, texture::ship_metallic); 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 / 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 / 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 / 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 / 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 / 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, -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::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::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 / 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); 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 //desired objects end here
@ -301,7 +301,7 @@ void init(GLFWwindow* window)
loadModelToContext("./models/sphere.obj", planetContext); loadModelToContext("./models/sphere.obj", planetContext);
loadModelToContext("./models/station.obj", stationContext); loadModelToContext("./models/station.max", stationContext);
loadModelToContext("./models/cube.obj", cubeContext); loadModelToContext("./models/cube.obj", cubeContext);