diff --git a/includes/learnopengl/shader.h b/includes/learnopengl/shader.h index 42f00e6..a60870f 100644 --- a/includes/learnopengl/shader.h +++ b/includes/learnopengl/shader.h @@ -53,7 +53,7 @@ public: geometryCode = gShaderStream.str(); } } - catch (std::ifstream::failure e) + catch (std::ifstream::failure& e) { std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; } @@ -188,4 +188,4 @@ private: } } }; -#endif \ No newline at end of file +#endif diff --git a/includes/learnopengl/shader_m.h b/includes/learnopengl/shader_m.h index 70b2427..c321ec1 100644 --- a/includes/learnopengl/shader_m.h +++ b/includes/learnopengl/shader_m.h @@ -41,7 +41,7 @@ public: vertexCode = vShaderStream.str(); fragmentCode = fShaderStream.str(); } - catch (std::ifstream::failure e) + catch (std::ifstream::failure& e) { std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; } @@ -162,4 +162,4 @@ private: } } }; -#endif \ No newline at end of file +#endif diff --git a/includes/learnopengl/shader_s.h b/includes/learnopengl/shader_s.h index b24267b..484e0ec 100644 --- a/includes/learnopengl/shader_s.h +++ b/includes/learnopengl/shader_s.h @@ -40,7 +40,7 @@ public: vertexCode = vShaderStream.str(); fragmentCode = fShaderStream.str(); } - catch (std::ifstream::failure e) + catch (std::ifstream::failure& e) { std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; } @@ -118,4 +118,4 @@ private: } } }; -#endif \ No newline at end of file +#endif diff --git a/src/1.getting_started/3.1.shaders_uniform/shaders_uniform.cpp b/src/1.getting_started/3.1.shaders_uniform/shaders_uniform.cpp index aaea260..9858a23 100644 --- a/src/1.getting_started/3.1.shaders_uniform/shaders_uniform.cpp +++ b/src/1.getting_started/3.1.shaders_uniform/shaders_uniform.cpp @@ -41,7 +41,7 @@ int main() // glfw window creation // -------------------- - GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL); + GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; diff --git a/src/2.lighting/4.1.lighting_maps_diffuse_map/lighting_maps_diffuse.cpp b/src/2.lighting/4.1.lighting_maps_diffuse_map/lighting_maps_diffuse.cpp index 490638f..e5eaa63 100644 --- a/src/2.lighting/4.1.lighting_maps_diffuse_map/lighting_maps_diffuse.cpp +++ b/src/2.lighting/4.1.lighting_maps_diffuse_map/lighting_maps_diffuse.cpp @@ -338,4 +338,4 @@ unsigned int loadTexture(char const * path) } return textureID; -} \ No newline at end of file +} diff --git a/src/5.advanced_lighting/3.1.2.shadow_mapping_base/shadow_mapping_base.cpp b/src/5.advanced_lighting/3.1.2.shadow_mapping_base/shadow_mapping_base.cpp index 1f645bf..4078d4a 100644 --- a/src/5.advanced_lighting/3.1.2.shadow_mapping_base/shadow_mapping_base.cpp +++ b/src/5.advanced_lighting/3.1.2.shadow_mapping_base/shadow_mapping_base.cpp @@ -380,7 +380,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) diff --git a/src/5.advanced_lighting/8.1.deferred_shading/deferred_shading.cpp b/src/5.advanced_lighting/8.1.deferred_shading/deferred_shading.cpp index 06ebe06..3c805d1 100644 --- a/src/5.advanced_lighting/8.1.deferred_shading/deferred_shading.cpp +++ b/src/5.advanced_lighting/8.1.deferred_shading/deferred_shading.cpp @@ -220,7 +220,6 @@ int main() shaderLightingPass.setVec3("lights[" + std::to_string(i) + "].Position", lightPositions[i]); shaderLightingPass.setVec3("lights[" + std::to_string(i) + "].Color", lightColors[i]); // update attenuation parameters and calculate radius - const float constant = 1.0; // note that we don't send this to the shader, we assume it is always 1.0 (in our case) const float linear = 0.7; const float quadratic = 1.8; shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Linear", linear); diff --git a/src/5.advanced_lighting/9.ssao/ssao.cpp b/src/5.advanced_lighting/9.ssao/ssao.cpp index d8b5e05..567c0d9 100644 --- a/src/5.advanced_lighting/9.ssao/ssao.cpp +++ b/src/5.advanced_lighting/9.ssao/ssao.cpp @@ -302,7 +302,6 @@ int main() shaderLightingPass.setVec3("light.Position", lightPosView); shaderLightingPass.setVec3("light.Color", lightColor); // Update attenuation parameters - const float constant = 1.0; // note that we don't send this to the shader, we assume it is always 1.0 (in our case) const float linear = 0.09; const float quadratic = 0.032; shaderLightingPass.setFloat("light.Linear", linear); diff --git a/src/6.pbr/1.1.lighting/lighting.cpp b/src/6.pbr/1.1.lighting/lighting.cpp index 00ff462..17c27fb 100644 --- a/src/6.pbr/1.1.lighting/lighting.cpp +++ b/src/6.pbr/1.1.lighting/lighting.cpp @@ -191,7 +191,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -278,11 +277,11 @@ void renderSphere() } bool oddRow = false; - for (int y = 0; y < Y_SEGMENTS; ++y) + for (unsigned int y = 0; y < Y_SEGMENTS; ++y) { if (!oddRow) // even rows: y == 0, y == 2; and so on { - for (int x = 0; x <= X_SEGMENTS; ++x) + for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { indices.push_back(y * (X_SEGMENTS + 1) + x); indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); @@ -290,7 +289,7 @@ void renderSphere() } else { - for (int x = X_SEGMENTS; x >= 0; --x) + for (unsigned int x = X_SEGMENTS; x >= 0; --x) { indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); indices.push_back(y * (X_SEGMENTS + 1) + x); @@ -301,7 +300,7 @@ void renderSphere() indexCount = indices.size(); std::vector data; - for (int i = 0; i < positions.size(); ++i) + for (unsigned int i = 0; i < positions.size(); ++i) { data.push_back(positions[i].x); data.push_back(positions[i].y); diff --git a/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp b/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp index 510f7d0..ce1a211 100644 --- a/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp +++ b/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp @@ -202,7 +202,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -289,11 +288,11 @@ void renderSphere() } bool oddRow = false; - for (int y = 0; y < Y_SEGMENTS; ++y) + for (unsigned int y = 0; y < Y_SEGMENTS; ++y) { if (!oddRow) // even rows: y == 0, y == 2; and so on { - for (int x = 0; x <= X_SEGMENTS; ++x) + for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { indices.push_back(y * (X_SEGMENTS + 1) + x); indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); @@ -301,7 +300,7 @@ void renderSphere() } else { - for (int x = X_SEGMENTS; x >= 0; --x) + for (unsigned int x = X_SEGMENTS; x >= 0; --x) { indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); indices.push_back(y * (X_SEGMENTS + 1) + x); @@ -312,7 +311,7 @@ void renderSphere() indexCount = indices.size(); std::vector data; - for (int i = 0; i < positions.size(); ++i) + for (std::size_t i = 0; i < positions.size(); ++i) { data.push_back(positions[i].x); data.push_back(positions[i].y); diff --git a/src/6.pbr/2.1.1.ibl_irradiance_conversion/ibl_irradiance_conversion.cpp b/src/6.pbr/2.1.1.ibl_irradiance_conversion/ibl_irradiance_conversion.cpp index 6e5db49..4db3d23 100644 --- a/src/6.pbr/2.1.1.ibl_irradiance_conversion/ibl_irradiance_conversion.cpp +++ b/src/6.pbr/2.1.1.ibl_irradiance_conversion/ibl_irradiance_conversion.cpp @@ -307,7 +307,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -394,11 +393,11 @@ void renderSphere() } bool oddRow = false; - for (int y = 0; y < Y_SEGMENTS; ++y) + for (unsigned int y = 0; y < Y_SEGMENTS; ++y) { if (!oddRow) // even rows: y == 0, y == 2; and so on { - for (int x = 0; x <= X_SEGMENTS; ++x) + for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { indices.push_back(y * (X_SEGMENTS + 1) + x); indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); @@ -406,7 +405,7 @@ void renderSphere() } else { - for (int x = X_SEGMENTS; x >= 0; --x) + for (unsigned int x = X_SEGMENTS; x >= 0; --x) { indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); indices.push_back(y * (X_SEGMENTS + 1) + x); @@ -417,7 +416,7 @@ void renderSphere() indexCount = indices.size(); std::vector data; - for (int i = 0; i < positions.size(); ++i) + for (unsigned int i = 0; i < positions.size(); ++i) { data.push_back(positions[i].x); data.push_back(positions[i].y); diff --git a/src/6.pbr/2.1.2.ibl_irradiance/ibl_irradiance.cpp b/src/6.pbr/2.1.2.ibl_irradiance/ibl_irradiance.cpp index 4353739..f9b6a5b 100644 --- a/src/6.pbr/2.1.2.ibl_irradiance/ibl_irradiance.cpp +++ b/src/6.pbr/2.1.2.ibl_irradiance/ibl_irradiance.cpp @@ -347,7 +347,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -434,11 +433,11 @@ void renderSphere() } bool oddRow = false; - for (int y = 0; y < Y_SEGMENTS; ++y) + for (unsigned int y = 0; y < Y_SEGMENTS; ++y) { if (!oddRow) // even rows: y == 0, y == 2; and so on { - for (int x = 0; x <= X_SEGMENTS; ++x) + for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { indices.push_back(y * (X_SEGMENTS + 1) + x); indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); @@ -446,7 +445,7 @@ void renderSphere() } else { - for (int x = X_SEGMENTS; x >= 0; --x) + for (unsigned int x = X_SEGMENTS; x >= 0; --x) { indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); indices.push_back(y * (X_SEGMENTS + 1) + x); @@ -457,7 +456,7 @@ void renderSphere() indexCount = indices.size(); std::vector data; - for (int i = 0; i < positions.size(); ++i) + for (std::size_t i = 0; i < positions.size(); ++i) { data.push_back(positions[i].x); data.push_back(positions[i].y); diff --git a/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp b/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp index ebbaf9c..da8556e 100644 --- a/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp +++ b/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp @@ -445,7 +445,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -532,11 +531,11 @@ void renderSphere() } bool oddRow = false; - for (int y = 0; y < Y_SEGMENTS; ++y) + for (unsigned int y = 0; y < Y_SEGMENTS; ++y) { if (!oddRow) // even rows: y == 0, y == 2; and so on { - for (int x = 0; x <= X_SEGMENTS; ++x) + for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { indices.push_back(y * (X_SEGMENTS + 1) + x); indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); @@ -544,7 +543,7 @@ void renderSphere() } else { - for (int x = X_SEGMENTS; x >= 0; --x) + for (unsigned int x = X_SEGMENTS; x >= 0; --x) { indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); indices.push_back(y * (X_SEGMENTS + 1) + x); @@ -555,7 +554,7 @@ void renderSphere() indexCount = indices.size(); std::vector data; - for (int i = 0; i < positions.size(); ++i) + for (std::size_t i = 0; i < positions.size(); ++i) { data.push_back(positions[i].x); data.push_back(positions[i].y); diff --git a/src/6.pbr/2.2.2.ibl_specular_textured/ibl_specular_textured.cpp b/src/6.pbr/2.2.2.ibl_specular_textured/ibl_specular_textured.cpp index a15c8d3..d406592 100644 --- a/src/6.pbr/2.2.2.ibl_specular_textured/ibl_specular_textured.cpp +++ b/src/6.pbr/2.2.2.ibl_specular_textured/ibl_specular_textured.cpp @@ -156,9 +156,6 @@ int main() glm::vec3(300.0f, 300.0f, 300.0f), glm::vec3(300.0f, 300.0f, 300.0f) }; - int nrRows = 7; - int nrColumns = 7; - float spacing = 2.5; // pbr: setup framebuffer // ---------------------- @@ -548,7 +545,6 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) camera.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -635,11 +631,11 @@ void renderSphere() } bool oddRow = false; - for (int y = 0; y < Y_SEGMENTS; ++y) + for (unsigned int y = 0; y < Y_SEGMENTS; ++y) { if (!oddRow) // even rows: y == 0, y == 2; and so on { - for (int x = 0; x <= X_SEGMENTS; ++x) + for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { indices.push_back(y * (X_SEGMENTS + 1) + x); indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); @@ -647,7 +643,7 @@ void renderSphere() } else { - for (int x = X_SEGMENTS; x >= 0; --x) + for (unsigned int x = X_SEGMENTS; x >= 0; --x) { indices.push_back((y + 1) * (X_SEGMENTS + 1) + x); indices.push_back(y * (X_SEGMENTS + 1) + x); @@ -658,7 +654,7 @@ void renderSphere() indexCount = indices.size(); std::vector data; - for (int i = 0; i < positions.size(); ++i) + for (unsigned int i = 0; i < positions.size(); ++i) { data.push_back(positions[i].x); data.push_back(positions[i].y);