diff --git a/grk-cw9.vcxproj b/grk-cw9.vcxproj index e790112..be4b7fa 100644 --- a/grk-cw9.vcxproj +++ b/grk-cw9.vcxproj @@ -41,14 +41,14 @@ - - + + {5BACD057-4B83-4CB6-A367-40A10BCE2149} Win32Proj grk-cw9 - 10.0.19041.0 + 10.0 grk-cw9 diff --git a/grk-cw9.vcxproj.filters b/grk-cw9.vcxproj.filters index a2b8ba9..46378a4 100644 --- a/grk-cw9.vcxproj.filters +++ b/grk-cw9.vcxproj.filters @@ -103,10 +103,10 @@ Shader Files - + Shader Files - + Shader Files diff --git a/shaders/shader_9_1.frag b/shaders/shader_9_1.frag index c7bc4ae..fb14418 100644 --- a/shaders/shader_9_1.frag +++ b/shaders/shader_9_1.frag @@ -4,9 +4,6 @@ float AMBIENT = 0.03; float PI = 3.14; uniform sampler2D depthMap; -//uniform sampler2D depthMaplamp; -uniform sampler2D depthMapflash; - uniform vec3 cameraPos; @@ -38,11 +35,11 @@ in vec3 viewDirTS; in vec3 lightDirTS; in vec3 spotlightDirTS; in vec3 sunDirTS; -in vec4 sunSpacePos; -in vec4 lampSpacePos; -in vec4 flashSpacePos; in vec3 test; + +in vec4 sunSpacePos; + float calculateShadow() { vec4 lightSpacePosNormalized = (0.5*sunSpacePos / (sunSpacePos.w)) + 0.5; @@ -52,14 +49,6 @@ float calculateShadow() return (0.5*(diff)/abs(diff))+0.5; } -float calculateShadowOtherLigths(vec4 ligthSpacePos, sampler2D ligthDepthMap) -{ - vec4 lightSpacePosNormalized = (0.5*ligthSpacePos / (ligthSpacePos.w)) + 0.5; - float closestDepth = texture2D(ligthDepthMap, lightSpacePosNormalized.xy).x; - float diff = (0.001+closestDepth) - lightSpacePosNormalized.z;//lightSpacePosNormalized.z; - - return (0.5*(diff)/abs(diff))+0.5; -} float DistributionGGX(vec3 normal, vec3 H, float roughness){ float a = roughness*roughness; float a2 = a*a; @@ -145,13 +134,13 @@ void main() float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1); attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2); - ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor*calculateShadowOtherLigths(flashSpacePos, depthMapflash),normal,viewDir); + ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir); //sun - ilumination=ilumination+PBRLight(sunDir,sunColor*calculateShadow(),normal,viewDir); + ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir) * calculateShadow(); outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1); - //outColor = (0.5*sunSpacePos / (sunSpacePos.w+0.0001)) + 0.5; + //outColor = vec4(roughness,metallic,0,1); //outColor = vec4(test; } diff --git a/shaders/shader_9_1.vert b/shaders/shader_9_1.vert index 814168f..05cfbb2 100644 --- a/shaders/shader_9_1.vert +++ b/shaders/shader_9_1.vert @@ -8,6 +8,10 @@ layout(location = 4) in vec3 vertexBitangent; uniform mat4 transformation; uniform mat4 modelMatrix; +uniform mat4 LightVP; + +out vec3 vecNormal; +out vec3 worldPos; uniform vec3 lightPos; uniform vec3 spotlightPos; @@ -18,17 +22,8 @@ out vec3 viewDirTS; out vec3 lightDirTS; out vec3 spotlightDirTS; out vec3 sunDirTS; -out vec3 worldPos; -out vec3 vecNormal; + out vec4 sunSpacePos; -out vec4 lampSpacePos; -out vec4 flashSpacePos; - - - -uniform mat4 LightVP; -uniform mat4 LightVPlamp; -uniform mat4 LightVPflash; void main() { @@ -49,7 +44,4 @@ void main() sunDirTS = TBN*sunDir; sunSpacePos=LightVP*modelMatrix*vec4(vertexPosition,1); - lampSpacePos=LightVPlamp*modelMatrix*vec4(vertexPosition,1); - flashSpacePos=LightVPflash*modelMatrix*vec4(vertexPosition,1); - } diff --git a/shaders/programDepth.frag b/shaders/shader_depth.frag similarity index 100% rename from shaders/programDepth.frag rename to shaders/shader_depth.frag diff --git a/shaders/programDepth.vert b/shaders/shader_depth.vert similarity index 100% rename from shaders/programDepth.vert rename to shaders/shader_depth.vert diff --git a/shaders/test.frag b/shaders/test.frag index 404c2c6..adbdf59 100644 --- a/shaders/test.frag +++ b/shaders/test.frag @@ -3,7 +3,8 @@ out vec4 FragColor; in vec2 tc; -uniform sampler2D depthMap; +uniform sampler2D +; void main() { diff --git a/src/ex_9_1.hpp b/src/ex_9_1.hpp index 60375f5..b3b6d7c 100644 --- a/src/ex_9_1.hpp +++ b/src/ex_9_1.hpp @@ -36,19 +36,15 @@ namespace models { Core::RenderContext testContext; } -GLuint depthMapFBOsun; -GLuint depthMapFBOlamp; -GLuint depthMapFBOflash; -GLuint depthMapsun; -GLuint depthMaplamp; -GLuint depthMapflash; +GLuint depthMapFBO; +GLuint depthMap; GLuint program; GLuint programSun; -GLuint programTest; GLuint programTex; GLuint programDepth; + Core::Shader_Loader shaderLoader; Core::RenderContext shipContext; @@ -79,11 +75,20 @@ glm::vec3 spotlightColor = glm::vec3(0.4, 0.4, 0.9)*3; float spotlightPhi = 3.14 / 4; -glm::mat4 lightVPsun; -glm::mat4 lightVPlamp; -glm::mat4 lightVPflash; +float lastTime = -1.f; +float deltaTime = 0.f; +void updateDeltaTime(float time) { + if (lastTime < 0) { + lastTime = time; + return; + } + + deltaTime = time - lastTime; + if (deltaTime > 0.1) deltaTime = 0.1; + lastTime = time; +} glm::mat4 createCameraMatrix() { glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f))); @@ -120,24 +125,6 @@ glm::mat4 createPerspectiveMatrix() return perspectiveMatrix; } -glm::mat4 createPerspectiveMatrixC(float n, float f) -{ - - glm::mat4 perspectiveMatrix; - float a1 = glm::min(aspectRatio, 1.f); - float a2 = glm::min(1 / aspectRatio, 1.f); - perspectiveMatrix = glm::mat4({ - 1,0.,0.,0., - 0.,aspectRatio,0.,0., - 0.,0.,(f + n) / (n - f),2 * f * n / (n - f), - 0.,0.,-1.,0., - }); - - - perspectiveMatrix = glm::transpose(perspectiveMatrix); - - return perspectiveMatrix; -} void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic) { @@ -166,47 +153,24 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec glUniform3f(glGetUniformLocation(program, "spotlightColor"), spotlightColor.x, spotlightColor.y, spotlightColor.z); glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spotlightPhi); - - glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVPsun); - //glUniformMatrix4fv(glGetUniformLocation(program, "LightVPlamp"), 1, GL_FALSE, (float*)&lightVPlamp); - glUniformMatrix4fv(glGetUniformLocation(program, "LightVPflash"), 1, GL_FALSE, (float*)&lightVPflash); - - - //glUniform1i(glGetUniformLocation(program, "depthMap"), depthMap); - //glActiveTexture(GL_TEXTURE0); - //glBindTexture(GL_TEXTURE_2D, depthMap); - //void Core::SetActiveTexture(GLuint textureID, const char* shaderVariableName, GLuint programID, int textureUnit) - //{ - //glUniform1i(glGetUniformLocation(programID, shaderVariableName), textureUnit); - //glActiveTexture(GL_TEXTURE0 + textureUnit); - //glBindTexture(GL_TEXTURE_2D, textureID); - //} - glUniform1i(glGetUniformLocation(program, "depthMapflash"), 1); - glActiveTexture(GL_TEXTURE0+1); - glBindTexture(GL_TEXTURE_2D, depthMapflash); - //glActiveTexture(GL_TEXTURE0 + 1); - //glBindTexture(GL_TEXTURE_2D, depthMaplamp); - glUniform1i(glGetUniformLocation(program, "depthMap"), 2); - glActiveTexture(GL_TEXTURE0 + 2); - glBindTexture(GL_TEXTURE_2D, depthMapsun); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, depthMap); + + glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); + glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVP); Core::DrawContext(context); } - void drawObjectDepth(Core::RenderContext& RenderContext, glm::mat4 viewProjection, glm::mat4 modelMatrix) { - glUniformMatrix4fv(glGetUniformLocation(programDepth, "viewProjectionMatrix"), 1, GL_FALSE, (float*)&viewProjection); glUniformMatrix4fv(glGetUniformLocation(programDepth, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix); Core::DrawContext(RenderContext); } -void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) { - float time = glfwGetTime(); - glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); - //uzupelnij o renderowanie glebokosci do tekstury - glUseProgram(programDepth); +void renderShadowapSun() { + float time = glfwGetTime(); //ustawianie przestrzeni rysowania glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); //bindowanie FBO @@ -216,37 +180,46 @@ void renderShadowapSun(GLuint depthMapFBO, glm::mat4 lightVP) { //ustawianie programu glUseProgram(programDepth); - - drawObjectDepth(sphereContext, lightVP, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f))); - + glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); + drawObjectDepth(sphereContext, + lightVP, + glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f))); drawObjectDepth(sphereContext, - lightVP, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f))); - - drawObjectDepth(models::bedContext, lightVP, glm::mat4()); - drawObjectDepth(models::chairContext, lightVP, glm::mat4()); - drawObjectDepth(models::deskContext, lightVP, glm::mat4()); - drawObjectDepth(models::doorContext, lightVP, glm::mat4()); - drawObjectDepth(models::drawerContext, lightVP, glm::mat4()); - drawObjectDepth(models::marbleBustContext, lightVP, glm::mat4()); - drawObjectDepth(models::materaceContext, lightVP, glm::mat4()); - drawObjectDepth(models::pencilsContext, lightVP, glm::mat4()); - drawObjectDepth(models::planeContext, lightVP, glm::mat4()); - drawObjectDepth(models::roomContext, lightVP, glm::mat4()); - drawObjectDepth(models::windowContext, lightVP, glm::mat4()); - - 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::mat4 specshipCameraRotrationMatrix = glm::mat4({ - spaceshipSide.x,spaceshipSide.y,spaceshipSide.z,0, - spaceshipUp.x,spaceshipUp.y,spaceshipUp.z ,0, - -spaceshipDir.x,-spaceshipDir.y,-spaceshipDir.z,0, - 0.,0.,0.,1., - }); - drawObjectDepth(shipContext, lightVP, - glm::translate(spaceshipPos)* specshipCameraRotrationMatrix* glm::eulerAngleY(glm::pi())* glm::scale(glm::vec3(0.03f))); - - - + lightVP, + glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f))); + drawObjectDepth(models::bedContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::chairContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::deskContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::doorContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::drawerContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::marbleBustContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::materaceContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::pencilsContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::planeContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::roomContext, + lightVP, + glm::mat4()); + drawObjectDepth(models::windowContext, + lightVP, + glm::mat4()); glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -258,14 +231,8 @@ void renderScene(GLFWwindow* window) glClearColor(0.4f, 0.4f, 0.8f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); float time = glfwGetTime(); - - lightVPsun = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); - lightVPlamp = createPerspectiveMatrixC(0.5, 30) * glm::lookAt(pointlightPos, glm::vec3(0, -1, 0), glm::vec3(0, 1, 0)); - lightVPflash = createPerspectiveMatrixC(0.05, 20) * glm::lookAt(spotlightPos, spotlightConeDir, glm::vec3(0, 1, 0)); - - renderShadowapSun(depthMapFBOsun, lightVPsun); - renderShadowapSun(depthMapFBOlamp, lightVPlamp); - renderShadowapSun(depthMapFBOflash, lightVPflash); + updateDeltaTime(time); + renderShadowapSun(); //space lamp glUseProgram(programSun); @@ -278,11 +245,17 @@ void renderScene(GLFWwindow* window) glUseProgram(program); - drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0); + drawObjectPBR(sphereContext, + glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)) + ,glm::vec3(0.2, 0.7, 0.3), + 0.3, + 0.0); drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)), - glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0); + glm::vec3(0.5, 0.5, 0.5), + 0.7, + 0.0); drawObjectPBR(models::bedContext, glm::mat4(), glm::vec3(0.03f, 0.03f, 0.03f), 0.2f, 0.0f); drawObjectPBR(models::chairContext, glm::mat4(), glm::vec3(0.195239f, 0.37728f, 0.8f), 0.4f, 0.0f); @@ -319,15 +292,6 @@ void renderScene(GLFWwindow* window) spotlightPos = spaceshipPos + 0.2 * spaceshipDir; spotlightConeDir = spaceshipDir; - - - ////test depth buffer - //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - //glUseProgram(programTest); - //glActiveTexture(GL_TEXTURE0); - //glBindTexture(GL_TEXTURE_2D, depthMaplamp); - //Core::DrawContext(models::testContext); - glUseProgram(0); glfwSwapBuffers(window); } @@ -351,12 +315,11 @@ void loadModelToContext(std::string path, Core::RenderContext& context) context.initFromAssimpMesh(scene->mMeshes[0]); } -void initDepthMap() -{ - glGenFramebuffers(1, &depthMapFBOsun); +void initDepthMap() { + glGenFramebuffers(1, &depthMapFBO); - glGenTextures(1, &depthMapsun); - glBindTexture(GL_TEXTURE_2D, depthMapsun); + glGenTextures(1, &depthMap); + glBindTexture(GL_TEXTURE_2D, depthMap); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -364,51 +327,14 @@ void initDepthMap() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBOsun); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMapsun, 0); - glDrawBuffer(GL_NONE); - glReadBuffer(GL_NONE); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - - - glGenFramebuffers(1, &depthMapFBOlamp); - - glGenTextures(1, &depthMaplamp); - glBindTexture(GL_TEXTURE_2D, depthMaplamp); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, - SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - - glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBOlamp); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMaplamp, 0); - glDrawBuffer(GL_NONE); - glReadBuffer(GL_NONE); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - - - glGenFramebuffers(1, &depthMapFBOflash); - - glGenTextures(1, &depthMapflash); - glBindTexture(GL_TEXTURE_2D, depthMapflash); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, - SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - - glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBOflash); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMapflash, 0); + glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0); glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); glBindFramebuffer(GL_FRAMEBUFFER, 0); } + void init(GLFWwindow* window) { glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); @@ -416,9 +342,8 @@ void init(GLFWwindow* window) glEnable(GL_DEPTH_TEST); program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag"); - programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag"); programSun = shaderLoader.CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag"); - programDepth = shaderLoader.CreateProgram("shaders/programDepth.vert", "shaders/programDepth.frag"); + programDepth = shaderLoader.CreateProgram("shaders/shader_depth.vert", "shaders/shader_depth.frag"); loadModelToContext("./models/sphere.obj", sphereContext); loadModelToContext("./models/spaceship.obj", shipContext); @@ -437,7 +362,6 @@ void init(GLFWwindow* window) loadModelToContext("./models/spaceship.obj", models::spaceshipContext); loadModelToContext("./models/sphere.obj", models::sphereContext); loadModelToContext("./models/window.obj", models::windowContext); - loadModelToContext("./models/test.obj", models::testContext); } @@ -451,8 +375,8 @@ void processInput(GLFWwindow* window) { glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f,1.f,0.f))); glm::vec3 spaceshipUp = glm::vec3(0.f, 1.f, 0.f); - float angleSpeed = 0.005f; - float moveSpeed = 0.005f; + float angleSpeed = 0.05f * deltaTime * 60; + float moveSpeed = 0.05f * deltaTime * 60; if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { glfwSetWindowShouldClose(window, true); } @@ -477,9 +401,9 @@ void processInput(GLFWwindow* window) cameraDir = spaceshipDir; if (glfwGetKey(window, GLFW_KEY_1) == GLFW_PRESS) - exposition -= 0.005; + exposition -= 0.05; if (glfwGetKey(window, GLFW_KEY_2) == GLFW_PRESS) - exposition += 0.005; + exposition += 0.05; if (glfwGetKey(window, GLFW_KEY_3) == GLFW_PRESS) { printf("spaceshipPos = glm::vec3(%ff, %ff, %ff);\n", spaceshipPos.x, spaceshipPos.y, spaceshipPos.z);