From 76b3e8535216c8429b2153c0be819fea853d425a Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Fri, 7 Jan 2022 23:09:38 +0100 Subject: [PATCH 1/7] fix unused exception parameter: print it in exception message --- includes/learnopengl/shader.h | 2 +- includes/learnopengl/shader_m.h | 2 +- includes/learnopengl/shader_s.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/learnopengl/shader.h b/includes/learnopengl/shader.h index a60870f..1ac9dbe 100644 --- a/includes/learnopengl/shader.h +++ b/includes/learnopengl/shader.h @@ -55,7 +55,7 @@ public: } catch (std::ifstream::failure& e) { - std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; + std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ: " << e.what() << std::endl; } const char* vShaderCode = vertexCode.c_str(); const char * fShaderCode = fragmentCode.c_str(); diff --git a/includes/learnopengl/shader_m.h b/includes/learnopengl/shader_m.h index c321ec1..b554064 100644 --- a/includes/learnopengl/shader_m.h +++ b/includes/learnopengl/shader_m.h @@ -43,7 +43,7 @@ public: } catch (std::ifstream::failure& e) { - std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; + std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ: " << e.what() << std::endl; } const char* vShaderCode = vertexCode.c_str(); const char * fShaderCode = fragmentCode.c_str(); diff --git a/includes/learnopengl/shader_s.h b/includes/learnopengl/shader_s.h index 484e0ec..80565a8 100644 --- a/includes/learnopengl/shader_s.h +++ b/includes/learnopengl/shader_s.h @@ -42,7 +42,7 @@ public: } catch (std::ifstream::failure& e) { - std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; + std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ: " << e.what() << std::endl; } const char* vShaderCode = vertexCode.c_str(); const char * fShaderCode = fragmentCode.c_str(); From 2ad7b99766ac1a100575df99c10f5da3be1702f2 Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Fri, 7 Jan 2022 23:10:29 +0100 Subject: [PATCH 2/7] fix warnings: "cl : Command line warning D9002 : ignoring unknown option" They were caused by the VS compiler not understanding the "-std=c++11" option. The old style CMake way of setting C++11 version was replaced with the new one which is crossplatform/compiler and fixes the warning. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df20636..292d9f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,10 @@ cmake_policy(VERSION 3.0) project (LearnOpenGL) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS ON) + IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) @@ -15,8 +19,6 @@ endif(WIN32) link_directories(${CMAKE_SOURCE_DIR}/lib) -list(APPEND CMAKE_CXX_FLAGS "-std=c++11") - # find the required packages find_package(GLM REQUIRED) message(STATUS "GLM included at ${GLM_INCLUDE_DIR}") From 47a6664845795c1719316ed1ad101c35260d6faf Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Fri, 7 Jan 2022 23:10:47 +0100 Subject: [PATCH 3/7] fix warning: getenv not secure Just silence the warning. Yes, the Right Thing to do would be to use the newer and safer ways instead of getenv, but silencing it is simpler and suffices for this project's needs :) --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 292d9f4..e4b7002 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ message(STATUS "Found ASSIMP in ${ASSIMP_INCLUDE_DIR}") if(WIN32) set(LIBS glfw3 opengl32 assimp freetype irrKlang) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) elseif(UNIX AND NOT APPLE) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") find_package(OpenGL REQUIRED) From 72f3e3715006bbbb735d33953913fee48e60b8d7 Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Fri, 7 Jan 2022 23:13:19 +0100 Subject: [PATCH 4/7] fix narrowing conversions (eg double to float, size_t to GLsizei) --- includes/learnopengl/mesh.h | 2 +- .../3.1.shaders_uniform/shaders_uniform.cpp | 4 +-- .../transformations_exercise2.cpp | 2 +- .../7.1.camera_circle/camera_circle.cpp | 4 +-- .../camera_keyboard_dt.cpp | 4 +-- .../camera_mouse_zoom.cpp | 9 ++++-- .../7.4.camera_class/camera_class.cpp | 9 ++++-- src/2.lighting/1.colors/colors.cpp | 9 ++++-- .../basic_lighting_diffuse.cpp | 9 ++++-- .../basic_lighting_specular.cpp | 8 +++-- src/2.lighting/3.1.materials/materials.cpp | 15 ++++++---- .../materials_exercise1.cpp | 8 +++-- .../lighting_maps_diffuse.cpp | 9 ++++-- .../lighting_maps_specular.cpp | 9 ++++-- .../lighting_maps_exercise4.cpp | 9 ++++-- .../light_casters_directional.cpp | 8 +++-- .../light_casters_point.cpp | 9 ++++-- .../light_casters_spot.cpp | 9 ++++-- .../light_casters_spot_soft.cpp | 9 ++++-- .../6.multiple_lights/multiple_lights.cpp | 29 ++++++++++--------- .../1.model_loading/model_loading.cpp | 9 ++++-- .../1.1.depth_testing/depth_testing.cpp | 9 ++++-- .../depth_testing_view.cpp | 9 ++++-- .../10.2.asteroids/asteroids.cpp | 15 ++++++---- .../asteroids_instanced.cpp | 17 ++++++----- .../anti_aliasing_msaa.cpp | 8 +++-- .../anti_aliasing_offscreen.cpp | 8 +++-- .../2.stencil_testing/stencil_testing.cpp | 11 ++++--- .../3.1.blending_discard/blending_discard.cpp | 8 +++-- .../3.2.blending_sort/blending_sorted.cpp | 8 +++-- .../5.1.framebuffers/framebuffers.cpp | 8 +++-- .../framebuffers_exercise1.cpp | 8 +++-- .../6.1.cubemaps_skybox/cubemaps_skybox.cpp | 8 +++-- .../cubemaps_environment_mapping.cpp | 8 +++-- .../8.advanced_glsl_ubo/advanced_glsl_ubo.cpp | 6 ++-- .../geometry_shader_exploding.cpp | 10 ++++--- .../normal_visualization.cpp | 8 +++-- .../1.advanced_lighting/advanced_lighting.cpp | 8 +++-- .../2.gamma_correction/gamma_correction.cpp | 8 +++-- .../shadow_mapping_depth.cpp | 9 ++++-- .../shadow_mapping_base.cpp | 8 +++-- .../3.1.3.shadow_mapping/shadow_mapping.cpp | 8 +++-- .../3.2.1.point_shadows/point_shadows.cpp | 10 ++++--- .../point_shadows_soft.cpp | 10 ++++--- .../4.normal_mapping/normal_mapping.cpp | 8 +++-- .../5.1.parallax_mapping/parallax_mapping.cpp | 10 ++++--- .../steep_parallax_mapping.cpp | 10 ++++--- .../parallax_occlusion_mapping.cpp | 10 ++++--- src/5.advanced_lighting/6.hdr/hdr.cpp | 8 +++-- src/5.advanced_lighting/7.bloom/bloom.cpp | 8 +++-- .../8.1.deferred_shading/deferred_shading.cpp | 24 ++++++++------- .../deferred_shading_volumes.cpp | 26 +++++++++-------- src/5.advanced_lighting/9.ssao/ssao.cpp | 14 +++++---- src/6.pbr/1.1.lighting/lighting.cpp | 15 ++++++---- .../lighting_textured.cpp | 15 ++++++---- .../ibl_irradiance_conversion.cpp | 15 ++++++---- .../2.1.2.ibl_irradiance/ibl_irradiance.cpp | 15 ++++++---- src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp | 19 +++++++----- .../ibl_specular_textured.cpp | 19 +++++++----- 59 files changed, 371 insertions(+), 238 deletions(-) diff --git a/includes/learnopengl/mesh.h b/includes/learnopengl/mesh.h index 36943a3..2287d0f 100644 --- a/includes/learnopengl/mesh.h +++ b/includes/learnopengl/mesh.h @@ -87,7 +87,7 @@ public: // draw mesh glBindVertexArray(VAO); - glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, 0); glBindVertexArray(0); // always good practice to set everything back to defaults once configured. 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 dde5a32..21c08c9 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 @@ -146,8 +146,8 @@ int main() glUseProgram(shaderProgram); // update shader uniform - float timeValue = glfwGetTime(); - float greenValue = sin(timeValue) / 2.0f + 0.5f; + auto timeValue = glfwGetTime(); + auto greenValue = static_cast(sin(timeValue) / 2.0 + 0.5); int vertexColorLocation = glGetUniformLocation(shaderProgram, "ourColor"); glUniform4f(vertexColorLocation, 0.0f, greenValue, 0.0f, 1.0f); diff --git a/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp b/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp index e499e4e..6343d11 100644 --- a/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp +++ b/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp @@ -184,7 +184,7 @@ int main() // --------------------- transform = glm::mat4(1.0f); // reset it to identity matrix transform = glm::translate(transform, glm::vec3(-0.5f, 0.5f, 0.0f)); - float scaleAmount = sin(glfwGetTime()); + auto scaleAmount = static_cast(sin(glfwGetTime())); transform = glm::scale(transform, glm::vec3(scaleAmount, scaleAmount, scaleAmount)); glUniformMatrix4fv(transformLoc, 1, GL_FALSE, &transform[0][0]); // this time take the matrix value array's first element as its memory pointer value diff --git a/src/1.getting_started/7.1.camera_circle/camera_circle.cpp b/src/1.getting_started/7.1.camera_circle/camera_circle.cpp index 1883540..a868227 100644 --- a/src/1.getting_started/7.1.camera_circle/camera_circle.cpp +++ b/src/1.getting_started/7.1.camera_circle/camera_circle.cpp @@ -222,8 +222,8 @@ int main() // camera/view transformation glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first float radius = 10.0f; - float camX = sin(glfwGetTime()) * radius; - float camZ = cos(glfwGetTime()) * radius; + auto camX = static_cast(sin(glfwGetTime()) * radius); + auto camZ = static_cast(cos(glfwGetTime()) * radius); view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); ourShader.setMat4("view", view); diff --git a/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp b/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp index ea2df0f..5a23faa 100644 --- a/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp +++ b/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp @@ -212,7 +212,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -276,7 +276,7 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; + auto cameraSpeed = static_cast(2.5 * deltaTime); if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) cameraPos += cameraSpeed * cameraFront; if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) diff --git a/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp b/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp index 195bc6c..8c717b7 100644 --- a/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp +++ b/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp @@ -221,7 +221,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -289,7 +289,7 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - float cameraSpeed = 2.5 * deltaTime; + auto cameraSpeed = static_cast(2.5 * deltaTime); if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) cameraPos += cameraSpeed * cameraFront; if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -311,8 +311,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; diff --git a/src/1.getting_started/7.4.camera_class/camera_class.cpp b/src/1.getting_started/7.4.camera_class/camera_class.cpp index e4c8376..f405899 100644 --- a/src/1.getting_started/7.4.camera_class/camera_class.cpp +++ b/src/1.getting_started/7.4.camera_class/camera_class.cpp @@ -216,7 +216,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -306,8 +306,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -328,5 +331,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } \ No newline at end of file diff --git a/src/2.lighting/1.colors/colors.cpp b/src/2.lighting/1.colors/colors.cpp index 92f3fa9..384e69b 100644 --- a/src/2.lighting/1.colors/colors.cpp +++ b/src/2.lighting/1.colors/colors.cpp @@ -157,7 +157,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -250,8 +250,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -272,5 +275,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } \ No newline at end of file diff --git a/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp b/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp index ec844cf..b8b519b 100644 --- a/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp +++ b/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -254,8 +254,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -276,5 +279,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } \ No newline at end of file diff --git a/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp b/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp index fa85a4e..bc50fcc 100644 --- a/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp +++ b/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -255,8 +255,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -277,5 +279,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } \ No newline at end of file diff --git a/src/2.lighting/3.1.materials/materials.cpp b/src/2.lighting/3.1.materials/materials.cpp index 5ec0f53..33d5da9 100644 --- a/src/2.lighting/3.1.materials/materials.cpp +++ b/src/2.lighting/3.1.materials/materials.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -180,9 +180,9 @@ int main() // light properties glm::vec3 lightColor; - lightColor.x = sin(glfwGetTime() * 2.0f); - lightColor.y = sin(glfwGetTime() * 0.7f); - lightColor.z = sin(glfwGetTime() * 1.3f); + lightColor.x = static_cast(sin(glfwGetTime() * 2.0)); + lightColor.y = static_cast(sin(glfwGetTime() * 0.7)); + lightColor.z = static_cast(sin(glfwGetTime() * 1.3)); glm::vec3 diffuseColor = lightColor * glm::vec3(0.5f); // decrease the influence glm::vec3 ambientColor = diffuseColor * glm::vec3(0.2f); // low influence lightingShader.setVec3("light.ambient", ambientColor); @@ -270,8 +270,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -292,5 +295,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } \ No newline at end of file diff --git a/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp b/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp index c5601f0..ea09d1a 100644 --- a/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp +++ b/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -264,8 +264,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -286,5 +288,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } 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 dc73bb7..ed2f1ea 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 @@ -170,7 +170,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -276,8 +276,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -298,7 +301,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp b/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp index c529e7c..11fa264 100644 --- a/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp +++ b/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp @@ -172,7 +172,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -279,8 +279,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -301,7 +304,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp b/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp index 998f853..f0816b9 100644 --- a/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp +++ b/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp @@ -174,7 +174,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -285,8 +285,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -307,7 +310,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp b/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp index 8609582..fba512f 100644 --- a/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp +++ b/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp @@ -182,7 +182,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -304,8 +304,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -326,7 +328,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp b/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp index 680a76e..90b529a 100644 --- a/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp +++ b/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp @@ -185,7 +185,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -305,8 +305,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -327,7 +330,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp b/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp index cbfce0c..47a057d 100644 --- a/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp +++ b/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp @@ -182,7 +182,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -306,8 +306,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -328,7 +331,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp b/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp index 0b53102..89195d2 100644 --- a/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp +++ b/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp @@ -182,7 +182,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -306,8 +306,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -328,7 +331,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/6.multiple_lights/multiple_lights.cpp b/src/2.lighting/6.multiple_lights/multiple_lights.cpp index 77fd3c9..9689bf0 100644 --- a/src/2.lighting/6.multiple_lights/multiple_lights.cpp +++ b/src/2.lighting/6.multiple_lights/multiple_lights.cpp @@ -192,7 +192,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -227,32 +227,32 @@ int main() lightingShader.setVec3("pointLights[0].diffuse", 0.8f, 0.8f, 0.8f); lightingShader.setVec3("pointLights[0].specular", 1.0f, 1.0f, 1.0f); lightingShader.setFloat("pointLights[0].constant", 1.0f); - lightingShader.setFloat("pointLights[0].linear", 0.09); - lightingShader.setFloat("pointLights[0].quadratic", 0.032); + lightingShader.setFloat("pointLights[0].linear", 0.09f); + lightingShader.setFloat("pointLights[0].quadratic", 0.032f); // point light 2 lightingShader.setVec3("pointLights[1].position", pointLightPositions[1]); lightingShader.setVec3("pointLights[1].ambient", 0.05f, 0.05f, 0.05f); lightingShader.setVec3("pointLights[1].diffuse", 0.8f, 0.8f, 0.8f); lightingShader.setVec3("pointLights[1].specular", 1.0f, 1.0f, 1.0f); lightingShader.setFloat("pointLights[1].constant", 1.0f); - lightingShader.setFloat("pointLights[1].linear", 0.09); - lightingShader.setFloat("pointLights[1].quadratic", 0.032); + lightingShader.setFloat("pointLights[1].linear", 0.09f); + lightingShader.setFloat("pointLights[1].quadratic", 0.032f); // point light 3 lightingShader.setVec3("pointLights[2].position", pointLightPositions[2]); lightingShader.setVec3("pointLights[2].ambient", 0.05f, 0.05f, 0.05f); lightingShader.setVec3("pointLights[2].diffuse", 0.8f, 0.8f, 0.8f); lightingShader.setVec3("pointLights[2].specular", 1.0f, 1.0f, 1.0f); lightingShader.setFloat("pointLights[2].constant", 1.0f); - lightingShader.setFloat("pointLights[2].linear", 0.09); - lightingShader.setFloat("pointLights[2].quadratic", 0.032); + lightingShader.setFloat("pointLights[2].linear", 0.09f); + lightingShader.setFloat("pointLights[2].quadratic", 0.032f); // point light 4 lightingShader.setVec3("pointLights[3].position", pointLightPositions[3]); lightingShader.setVec3("pointLights[3].ambient", 0.05f, 0.05f, 0.05f); lightingShader.setVec3("pointLights[3].diffuse", 0.8f, 0.8f, 0.8f); lightingShader.setVec3("pointLights[3].specular", 1.0f, 1.0f, 1.0f); lightingShader.setFloat("pointLights[3].constant", 1.0f); - lightingShader.setFloat("pointLights[3].linear", 0.09); - lightingShader.setFloat("pointLights[3].quadratic", 0.032); + lightingShader.setFloat("pointLights[3].linear", 0.09f); + lightingShader.setFloat("pointLights[3].quadratic", 0.032f); // spotLight lightingShader.setVec3("spotLight.position", camera.Position); lightingShader.setVec3("spotLight.direction", camera.Front); @@ -260,8 +260,8 @@ int main() lightingShader.setVec3("spotLight.diffuse", 1.0f, 1.0f, 1.0f); lightingShader.setVec3("spotLight.specular", 1.0f, 1.0f, 1.0f); lightingShader.setFloat("spotLight.constant", 1.0f); - lightingShader.setFloat("spotLight.linear", 0.09); - lightingShader.setFloat("spotLight.quadratic", 0.032); + lightingShader.setFloat("spotLight.linear", 0.09f); + lightingShader.setFloat("spotLight.quadratic", 0.032f); lightingShader.setFloat("spotLight.cutOff", glm::cos(glm::radians(12.5f))); lightingShader.setFloat("spotLight.outerCutOff", glm::cos(glm::radians(15.0f))); @@ -359,8 +359,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -381,7 +384,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/3.model_loading/1.model_loading/model_loading.cpp b/src/3.model_loading/1.model_loading/model_loading.cpp index 330d118..c66cff8 100644 --- a/src/3.model_loading/1.model_loading/model_loading.cpp +++ b/src/3.model_loading/1.model_loading/model_loading.cpp @@ -94,7 +94,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -164,8 +164,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -186,5 +189,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp b/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp index 575a22a..5a94de2 100644 --- a/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp +++ b/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp @@ -177,7 +177,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -259,8 +259,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -281,7 +284,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp b/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp index a8b47bf..666d508 100644 --- a/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp +++ b/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp @@ -177,7 +177,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -259,8 +259,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -281,7 +284,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp b/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp index d3d7343..0848dd0 100644 --- a/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp +++ b/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp @@ -88,7 +88,7 @@ int main() unsigned int amount = 1000; glm::mat4* modelMatrices; modelMatrices = new glm::mat4[amount]; - srand(glfwGetTime()); // initialize random seed + srand(static_cast(glfwGetTime())); // initialize random seed float radius = 50.0; float offset = 2.5f; for (unsigned int i = 0; i < amount; i++) @@ -105,11 +105,11 @@ int main() model = glm::translate(model, glm::vec3(x, y, z)); // 2. scale: Scale between 0.05 and 0.25f - float scale = (rand() % 20) / 100.0f + 0.05; + float scale = static_cast((rand() % 20) / 100.0 + 0.05); model = glm::scale(model, glm::vec3(scale)); // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector - float rotAngle = (rand() % 360); + float rotAngle = static_cast((rand() % 360)); model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f)); // 4. now add to list of matrices @@ -122,7 +122,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -194,8 +194,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -216,5 +219,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp b/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp index 45fed0f..1950198 100644 --- a/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp +++ b/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp @@ -89,7 +89,7 @@ int main() unsigned int amount = 100000; glm::mat4* modelMatrices; modelMatrices = new glm::mat4[amount]; - srand(glfwGetTime()); // initialize random seed + srand(static_cast(glfwGetTime())); // initialize random seed float radius = 150.0; float offset = 25.0f; for (unsigned int i = 0; i < amount; i++) @@ -106,11 +106,11 @@ int main() model = glm::translate(model, glm::vec3(x, y, z)); // 2. scale: Scale between 0.05 and 0.25f - float scale = (rand() % 20) / 100.0f + 0.05; + auto scale = static_cast((rand() % 20) / 100.0 + 0.05); model = glm::scale(model, glm::vec3(scale)); // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector - float rotAngle = (rand() % 360); + auto rotAngle = static_cast((rand() % 360)); model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f)); // 4. now add to list of matrices @@ -156,7 +156,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -194,7 +194,7 @@ int main() for (unsigned int i = 0; i < rock.meshes.size(); i++) { glBindVertexArray(rock.meshes[i].VAO); - glDrawElementsInstanced(GL_TRIANGLES, rock.meshes[i].indices.size(), GL_UNSIGNED_INT, 0, amount); + glDrawElementsInstanced(GL_TRIANGLES, static_cast(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount); glBindVertexArray(0); } @@ -236,8 +236,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -258,5 +261,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp b/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp index 8243bfe..db5854a 100644 --- a/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp +++ b/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp @@ -141,7 +141,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -202,8 +202,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -224,5 +226,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp b/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp index bcaccaa..0f6d003 100644 --- a/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp +++ b/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp @@ -209,7 +209,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -294,8 +294,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -316,5 +318,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp b/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp index 5cfd90e..805e12d 100644 --- a/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp +++ b/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp @@ -181,7 +181,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -239,7 +239,7 @@ int main() glStencilMask(0x00); glDisable(GL_DEPTH_TEST); shaderSingleColor.use(); - float scale = 1.1; + float scale = 1.1f; // cubes glBindVertexArray(cubeVAO); glBindTexture(GL_TEXTURE_2D, cubeTexture); @@ -303,8 +303,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -325,7 +328,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp b/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp index 160f28d..9dbd2c0 100644 --- a/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp +++ b/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp @@ -208,7 +208,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -302,8 +302,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -324,7 +326,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp b/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp index 1f1d880..a8b5c0b 100644 --- a/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp +++ b/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp @@ -210,7 +210,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -313,8 +313,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -335,7 +337,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp b/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp index 8b187cf..3aa9b7c 100644 --- a/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp +++ b/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp @@ -226,7 +226,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -329,8 +329,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -351,7 +353,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp index c6d30d5..85c71c7 100644 --- a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp +++ b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp @@ -226,7 +226,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -361,8 +361,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -383,7 +385,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp b/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp index 0e88d9a..9b0ae08 100644 --- a/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp +++ b/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp @@ -222,7 +222,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -309,8 +309,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -331,7 +333,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp b/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp index 24a1a49..8c0ca0a 100644 --- a/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp +++ b/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp @@ -220,7 +220,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -308,8 +308,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -330,7 +332,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp b/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp index 4d90e6d..dce90ea 100644 --- a/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp +++ b/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp @@ -168,7 +168,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -257,8 +257,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; diff --git a/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp b/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp index 76f474c..95fe367 100644 --- a/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp +++ b/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp @@ -88,7 +88,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -111,7 +111,7 @@ int main() shader.setMat4("model", model); // add time component to geometry shader in the form of a uniform - shader.setFloat("time", glfwGetTime()); + shader.setFloat("time", static_cast(glfwGetTime())); // draw model nanosuit.Draw(shader); @@ -154,8 +154,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -176,5 +178,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp b/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp index 104f1db..cca63bc 100644 --- a/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp +++ b/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp @@ -90,7 +90,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -161,8 +161,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -183,5 +185,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp b/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp index 05d1c88..d456294 100644 --- a/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp +++ b/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp @@ -129,7 +129,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -213,8 +213,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -235,7 +237,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp b/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp index f792ac4..9a61383 100644 --- a/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp +++ b/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp @@ -141,7 +141,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -226,8 +226,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -248,7 +250,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp b/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp index 5e74679..a8886fc 100644 --- a/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp +++ b/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp @@ -154,7 +154,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -378,8 +378,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -400,7 +403,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from 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 80cf117..6aaa8f7 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 @@ -158,7 +158,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -402,8 +402,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -424,7 +426,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp b/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp index 8bae330..cdd1150 100644 --- a/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp +++ b/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -409,8 +409,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -431,7 +433,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp b/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp index 6996e24..dcc5fd9 100644 --- a/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp +++ b/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp @@ -129,7 +129,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -138,7 +138,7 @@ int main() processInput(window); // move light position over time - lightPos.z = sin(glfwGetTime() * 0.5) * 3.0; + lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0); // render // ------ @@ -356,8 +356,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -378,7 +380,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp b/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp index a789d16..88ec9a4 100644 --- a/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp +++ b/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp @@ -129,7 +129,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -138,7 +138,7 @@ int main() processInput(window); // move light position over time - lightPos.z = sin(glfwGetTime() * 0.5) * 3.0; + lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0); // render // ------ @@ -356,8 +356,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -378,7 +380,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp b/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp index 583c9a8..a689077 100644 --- a/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp +++ b/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp @@ -101,7 +101,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -269,8 +269,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -291,7 +293,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp b/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp index 1ae27d6..09b1078 100644 --- a/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp +++ b/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp @@ -23,7 +23,7 @@ void renderQuad(); // settings const unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; -float heightScale = 0.1; +float heightScale = 0.1f; // camera Camera camera(glm::vec3(0.0f, 0.0f, 3.0f)); @@ -107,7 +107,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -298,8 +298,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -320,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp b/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp index 108fe92..72970f9 100644 --- a/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp +++ b/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp @@ -23,7 +23,7 @@ void renderQuad(); // settings const unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; -float heightScale = 0.1; +float heightScale = 0.1f; // camera Camera camera(glm::vec3(0.0f, 0.0f, 3.0f)); @@ -107,7 +107,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -298,8 +298,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -320,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp b/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp index 25280dd..43f5708 100644 --- a/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp +++ b/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp @@ -23,7 +23,7 @@ void renderQuad(); // settings const unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; -float heightScale = 0.1; +float heightScale = 0.1f; // camera Camera camera(glm::vec3(0.0f, 0.0f, 3.0f)); @@ -107,7 +107,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -298,8 +298,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -320,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/6.hdr/hdr.cpp b/src/5.advanced_lighting/6.hdr/hdr.cpp index b5ab168..e48ca83 100644 --- a/src/5.advanced_lighting/6.hdr/hdr.cpp +++ b/src/5.advanced_lighting/6.hdr/hdr.cpp @@ -141,7 +141,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -359,8 +359,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -381,7 +383,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/7.bloom/bloom.cpp b/src/5.advanced_lighting/7.bloom/bloom.cpp index 24d7e47..5e1132b 100644 --- a/src/5.advanced_lighting/7.bloom/bloom.cpp +++ b/src/5.advanced_lighting/7.bloom/bloom.cpp @@ -177,7 +177,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -467,8 +467,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -489,7 +491,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file 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 8b18b54..cc37ef4 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 @@ -150,14 +150,14 @@ int main() for (unsigned int i = 0; i < NR_LIGHTS; i++) { // calculate slightly random offsets - float xPos = ((rand() % 100) / 100.0) * 6.0 - 3.0; - float yPos = ((rand() % 100) / 100.0) * 6.0 - 4.0; - float zPos = ((rand() % 100) / 100.0) * 6.0 - 3.0; + float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); + float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0); + float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); lightPositions.push_back(glm::vec3(xPos, yPos, zPos)); // also calculate random color - float rColor = ((rand() % 100) / 200.0f) + 0.5; // between 0.5 and 1.0 - float gColor = ((rand() % 100) / 200.0f) + 0.5; // between 0.5 and 1.0 - float bColor = ((rand() % 100) / 200.0f) + 0.5; // between 0.5 and 1.0 + float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 + float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 + float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 lightColors.push_back(glm::vec3(rColor, gColor, bColor)); } @@ -174,7 +174,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -223,8 +223,8 @@ 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 linear = 0.7; - const float quadratic = 1.8; + const float linear = 0.7f; + const float quadratic = 1.8f; shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Linear", linear); shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Quadratic", quadratic); } @@ -403,8 +403,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -425,5 +427,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp b/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp index c932861..1a2b986 100644 --- a/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp +++ b/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp @@ -150,14 +150,14 @@ int main() for (unsigned int i = 0; i < NR_LIGHTS; i++) { // calculate slightly random offsets - float xPos = ((rand() % 100) / 100.0) * 6.0 - 3.0; - float yPos = ((rand() % 100) / 100.0) * 6.0 - 4.0; - float zPos = ((rand() % 100) / 100.0) * 6.0 - 3.0; + float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); + float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0); + float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); lightPositions.push_back(glm::vec3(xPos, yPos, zPos)); // also calculate random color - float rColor = ((rand() % 100) / 200.0f) + 0.5; // between 0.5 and 1.0 - float gColor = ((rand() % 100) / 200.0f) + 0.5; // between 0.5 and 1.0 - float bColor = ((rand() % 100) / 200.0f) + 0.5; // between 0.5 and 1.0 + float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) + float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) + float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) lightColors.push_back(glm::vec3(rColor, gColor, bColor)); } @@ -174,7 +174,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -223,9 +223,9 @@ 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; + const float constant = 1.0f; // note that we don't send this to the shader, we assume it is always 1.0 (in our case) + const float linear = 0.7f; + const float quadratic = 1.8f; shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Linear", linear); shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Quadratic", quadratic); // then calculate radius of light volume/sphere @@ -408,8 +408,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -430,5 +432,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/5.advanced_lighting/9.ssao/ssao.cpp b/src/5.advanced_lighting/9.ssao/ssao.cpp index 6f32510..ac7920d 100644 --- a/src/5.advanced_lighting/9.ssao/ssao.cpp +++ b/src/5.advanced_lighting/9.ssao/ssao.cpp @@ -173,7 +173,7 @@ int main() glm::vec3 sample(randomFloats(generator) * 2.0 - 1.0, randomFloats(generator) * 2.0 - 1.0, randomFloats(generator)); sample = glm::normalize(sample); sample *= randomFloats(generator); - float scale = float(i) / 64.0; + float scale = float(i) / 64.0f; // scale samples s.t. they're more aligned to center of kernel scale = lerp(0.1f, 1.0f, scale * scale); @@ -222,7 +222,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -302,8 +302,8 @@ int main() shaderLightingPass.setVec3("light.Position", lightPosView); shaderLightingPass.setVec3("light.Color", lightColor); // Update attenuation parameters - const float linear = 0.09; - const float quadratic = 0.032; + const float linear = 0.09f; + const float quadratic = 0.032f; shaderLightingPass.setFloat("light.Linear", linear); shaderLightingPass.setFloat("light.Quadratic", quadratic); glActiveTexture(GL_TEXTURE0); @@ -462,8 +462,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -484,5 +486,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/6.pbr/1.1.lighting/lighting.cpp b/src/6.pbr/1.1.lighting/lighting.cpp index a749a61..9259500 100644 --- a/src/6.pbr/1.1.lighting/lighting.cpp +++ b/src/6.pbr/1.1.lighting/lighting.cpp @@ -115,7 +115,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -213,8 +213,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -235,13 +238,13 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -unsigned int indexCount; +GLsizei indexCount; void renderSphere() { if (sphereVAO == 0) @@ -259,7 +262,7 @@ void renderSphere() const unsigned int X_SEGMENTS = 64; const unsigned int Y_SEGMENTS = 64; - const float PI = 3.14159265359; + const float PI = 3.14159265359f; for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { for (unsigned int y = 0; y <= Y_SEGMENTS; ++y) @@ -297,7 +300,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = indices.size(); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 0424ec0..e0bbd56 100644 --- a/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp +++ b/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp @@ -120,7 +120,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -224,8 +224,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -246,13 +249,13 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -unsigned int indexCount; +GLsizei indexCount; void renderSphere() { if (sphereVAO == 0) @@ -270,7 +273,7 @@ void renderSphere() const unsigned int X_SEGMENTS = 64; const unsigned int Y_SEGMENTS = 64; - const float PI = 3.14159265359; + const float PI = 3.14159265359f; for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { for (unsigned int y = 0; y <= Y_SEGMENTS; ++y) @@ -308,7 +311,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = indices.size(); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 bf704ac..097867b 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 @@ -214,7 +214,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -329,8 +329,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -351,13 +354,13 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -unsigned int indexCount; +GLsizei indexCount; void renderSphere() { if (sphereVAO == 0) @@ -375,7 +378,7 @@ void renderSphere() const unsigned int X_SEGMENTS = 64; const unsigned int Y_SEGMENTS = 64; - const float PI = 3.14159265359; + const float PI = 3.14159265359f; for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { for (unsigned int y = 0; y <= Y_SEGMENTS; ++y) @@ -413,7 +416,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = indices.size(); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 0b1d269..80060a5 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 @@ -255,7 +255,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -369,8 +369,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -391,13 +394,13 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -unsigned int indexCount; +GLsizei indexCount; void renderSphere() { if (sphereVAO == 0) @@ -415,7 +418,7 @@ void renderSphere() const unsigned int X_SEGMENTS = 64; const unsigned int Y_SEGMENTS = 64; - const float PI = 3.14159265359; + const float PI = 3.14159265359f; for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { for (unsigned int y = 0; y <= Y_SEGMENTS; ++y) @@ -453,7 +456,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = indices.size(); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 00816b3..fa543af 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 @@ -277,8 +277,8 @@ int main() for (unsigned int mip = 0; mip < maxMipLevels; ++mip) { // reisze framebuffer according to mip-level size. - unsigned int mipWidth = 128 * std::pow(0.5, mip); - unsigned int mipHeight = 128 * std::pow(0.5, mip); + unsigned int mipWidth = static_cast(128 * std::pow(0.5, mip)); + unsigned int mipHeight = static_cast(128 * std::pow(0.5, mip)); glBindRenderbuffer(GL_RENDERBUFFER, captureRBO); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight); glViewport(0, 0, mipWidth, mipHeight); @@ -343,7 +343,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -467,8 +467,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -489,13 +492,13 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -unsigned int indexCount; +GLsizei indexCount; void renderSphere() { if (sphereVAO == 0) @@ -513,7 +516,7 @@ void renderSphere() const unsigned int X_SEGMENTS = 64; const unsigned int Y_SEGMENTS = 64; - const float PI = 3.14159265359; + const float PI = 3.14159265359f; for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { for (unsigned int y = 0; y <= Y_SEGMENTS; ++y) @@ -551,7 +554,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = indices.size(); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 002d740..23c1bf4 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 @@ -314,8 +314,8 @@ int main() for (unsigned int mip = 0; mip < maxMipLevels; ++mip) { // reisze framebuffer according to mip-level size. - unsigned int mipWidth = 128 * std::pow(0.5, mip); - unsigned int mipHeight = 128 * std::pow(0.5, mip); + unsigned int mipWidth = static_cast(128 * std::pow(0.5, mip)); + unsigned int mipHeight = static_cast(128 * std::pow(0.5, mip)); glBindRenderbuffer(GL_RENDERBUFFER, captureRBO); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight); glViewport(0, 0, mipWidth, mipHeight); @@ -380,7 +380,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = glfwGetTime(); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -567,8 +567,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // glfw: whenever the mouse moves, this callback is called // ------------------------------------------------------- -void mouse_callback(GLFWwindow* window, double xpos, double ypos) +void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { + auto xpos = static_cast(xposIn); + auto ypos = static_cast(yposIn); + if (firstMouse) { lastX = xpos; @@ -589,13 +592,13 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(yoffset); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -unsigned int indexCount; +GLsizei indexCount; void renderSphere() { if (sphereVAO == 0) @@ -613,7 +616,7 @@ void renderSphere() const unsigned int X_SEGMENTS = 64; const unsigned int Y_SEGMENTS = 64; - const float PI = 3.14159265359; + const float PI = 3.14159265359f; for (unsigned int x = 0; x <= X_SEGMENTS; ++x) { for (unsigned int y = 0; y <= Y_SEGMENTS; ++y) @@ -651,7 +654,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = indices.size(); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) From da279c2fd92737714a6d77d955638852d1b1e60c Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Fri, 7 Jan 2022 23:41:05 +0100 Subject: [PATCH 5/7] fix warning LNK4099 added linker option to silence VS warning LNK4099. Again, ignoring this message is not the Right Thing to do, but in my opinion is good enough for this project and better than having a ton of warning messages hiding potentially useful ones. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4b7002..9efbc39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,6 +198,9 @@ foreach(CHAPTER ${CHAPTERS}) set(NAME "${CHAPTER}__${DEMO}") add_executable(${NAME} ${SOURCE}) target_link_libraries(${NAME} ${LIBS}) + if(MSVC) + target_link_options(${NAME} PUBLIC /ignore:4099) + endif(MSVC) if(WIN32) set_target_properties(${NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CHAPTER}") set_target_properties(${NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CHAPTER}/Debug") From 1be7d8ab3eeeb3756457604a755a18a7a66a9e9a Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Sat, 8 Jan 2022 00:09:52 +0100 Subject: [PATCH 6/7] update list of packages required to build on debian and ubuntu in Readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0153cd..f90d93c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Keep in mind the supplied libraries were generated with a specific compiler vers ## Linux building First make sure you have CMake, Git, and GCC by typing as root (sudo) `apt-get install g++ cmake git` and then get the required packages: -Using root (sudo) and type `apt-get install libsoil-dev libglm-dev libassimp-dev libglew-dev libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev` . +Using root (sudo) and type `apt-get install libsoil-dev libglm-dev libassimp-dev libglew-dev libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev libfreetype-dev libgl1-mesa-dev xorg-dev` . Next, run CMake (preferably CMake-gui). The source directory is LearnOpenGL and specify the build directory as LearnOpenGL/build. Creating the build directory within LearnOpenGL is important for linking to the resource files (it also will be ignored by Git). Hit configure and specify your compiler files (Unix Makefiles are recommended), resolve any missing directories or libraries, and then hit generate. Navigate to the build directory (`cd LearnOpenGL/build`) and type `make` in the terminal. This should generate the executables in the respective chapter folders. Note that CodeBlocks or other IDEs may have issues running the programs due to problems finding the shader and resource files, however it should still be able to generate the exectuables. To work around this problem it is possible to set an environment variable to tell the tutorials where the resource files can be found. The environment variable is named LOGL_ROOT_PATH and may be set to the path to the root of the LearnOpenGL directory tree. For example: From 93be6f82abd75a70a2d2537902376c0b8f7d2b40 Mon Sep 17 00:00:00 2001 From: "N. Pattakos" Date: Mon, 10 Jan 2022 00:45:44 +0100 Subject: [PATCH 7/7] update merge request as requested by JoeyDeVries: no auto or GLtypes --- includes/learnopengl/mesh.h | 2 +- .../3.1.shaders_uniform/shaders_uniform.cpp | 4 ++-- .../transformations_exercise2.cpp | 2 +- .../7.1.camera_circle/camera_circle.cpp | 4 ++-- .../camera_keyboard_dt.cpp | 4 ++-- .../camera_mouse_zoom.cpp | 8 ++++---- .../7.4.camera_class/camera_class.cpp | 10 +++++----- src/2.lighting/1.colors/colors.cpp | 10 +++++----- .../basic_lighting_diffuse.cpp | 10 +++++----- .../basic_lighting_specular.cpp | 10 +++++----- src/2.lighting/3.1.materials/materials.cpp | 16 +++++++-------- .../materials_exercise1.cpp | 8 ++++---- .../lighting_maps_diffuse.cpp | 8 ++++---- .../lighting_maps_specular.cpp | 8 ++++---- .../lighting_maps_exercise4.cpp | 8 ++++---- .../light_casters_directional.cpp | 8 ++++---- .../light_casters_point.cpp | 8 ++++---- .../light_casters_spot.cpp | 8 ++++---- .../light_casters_spot_soft.cpp | 8 ++++---- .../6.multiple_lights/multiple_lights.cpp | 8 ++++---- .../1.model_loading/model_loading.cpp | 8 ++++---- .../1.1.depth_testing/depth_testing.cpp | 8 ++++---- .../depth_testing_view.cpp | 8 ++++---- .../10.2.asteroids/asteroids.cpp | 12 +++++------ .../asteroids_instanced.cpp | 14 ++++++------- .../anti_aliasing_msaa.cpp | 8 ++++---- .../anti_aliasing_offscreen.cpp | 8 ++++---- .../2.stencil_testing/stencil_testing.cpp | 8 ++++---- .../3.1.blending_discard/blending_discard.cpp | 8 ++++---- .../3.2.blending_sort/blending_sorted.cpp | 8 ++++---- .../5.1.framebuffers/framebuffers.cpp | 8 ++++---- .../framebuffers_exercise1.cpp | 8 ++++---- .../6.1.cubemaps_skybox/cubemaps_skybox.cpp | 8 ++++---- .../cubemaps_environment_mapping.cpp | 8 ++++---- .../8.advanced_glsl_ubo/advanced_glsl_ubo.cpp | 6 +++--- .../geometry_shader_exploding.cpp | 10 +++++----- .../normal_visualization.cpp | 8 ++++---- .../1.advanced_lighting/advanced_lighting.cpp | 8 ++++---- .../2.gamma_correction/gamma_correction.cpp | 8 ++++---- .../shadow_mapping_depth.cpp | 8 ++++---- .../shadow_mapping_base.cpp | 8 ++++---- .../3.1.3.shadow_mapping/shadow_mapping.cpp | 8 ++++---- .../3.2.1.point_shadows/point_shadows.cpp | 10 +++++----- .../point_shadows_soft.cpp | 10 +++++----- .../4.normal_mapping/normal_mapping.cpp | 8 ++++---- .../5.1.parallax_mapping/parallax_mapping.cpp | 8 ++++---- .../steep_parallax_mapping.cpp | 8 ++++---- .../parallax_occlusion_mapping.cpp | 8 ++++---- src/5.advanced_lighting/6.hdr/hdr.cpp | 8 ++++---- src/5.advanced_lighting/7.bloom/bloom.cpp | 8 ++++---- .../8.1.deferred_shading/deferred_shading.cpp | 20 +++++++++---------- .../deferred_shading_volumes.cpp | 20 +++++++++---------- src/5.advanced_lighting/9.ssao/ssao.cpp | 8 ++++---- src/6.pbr/1.1.lighting/lighting.cpp | 12 +++++------ .../lighting_textured.cpp | 12 +++++------ .../ibl_irradiance_conversion.cpp | 10 +++++----- .../2.1.2.ibl_irradiance/ibl_irradiance.cpp | 12 +++++------ src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp | 12 +++++------ .../ibl_specular_textured.cpp | 8 ++++---- 59 files changed, 260 insertions(+), 260 deletions(-) diff --git a/includes/learnopengl/mesh.h b/includes/learnopengl/mesh.h index 2287d0f..803f489 100644 --- a/includes/learnopengl/mesh.h +++ b/includes/learnopengl/mesh.h @@ -87,7 +87,7 @@ public: // draw mesh glBindVertexArray(VAO); - glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, 0); glBindVertexArray(0); // always good practice to set everything back to defaults once configured. 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 21c08c9..afaafde 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 @@ -146,8 +146,8 @@ int main() glUseProgram(shaderProgram); // update shader uniform - auto timeValue = glfwGetTime(); - auto greenValue = static_cast(sin(timeValue) / 2.0 + 0.5); + double timeValue = glfwGetTime(); + float greenValue = static_cast(sin(timeValue) / 2.0 + 0.5); int vertexColorLocation = glGetUniformLocation(shaderProgram, "ourColor"); glUniform4f(vertexColorLocation, 0.0f, greenValue, 0.0f, 1.0f); diff --git a/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp b/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp index 6343d11..de32483 100644 --- a/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp +++ b/src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp @@ -184,7 +184,7 @@ int main() // --------------------- transform = glm::mat4(1.0f); // reset it to identity matrix transform = glm::translate(transform, glm::vec3(-0.5f, 0.5f, 0.0f)); - auto scaleAmount = static_cast(sin(glfwGetTime())); + float scaleAmount = static_cast(sin(glfwGetTime())); transform = glm::scale(transform, glm::vec3(scaleAmount, scaleAmount, scaleAmount)); glUniformMatrix4fv(transformLoc, 1, GL_FALSE, &transform[0][0]); // this time take the matrix value array's first element as its memory pointer value diff --git a/src/1.getting_started/7.1.camera_circle/camera_circle.cpp b/src/1.getting_started/7.1.camera_circle/camera_circle.cpp index a868227..1b79f31 100644 --- a/src/1.getting_started/7.1.camera_circle/camera_circle.cpp +++ b/src/1.getting_started/7.1.camera_circle/camera_circle.cpp @@ -222,8 +222,8 @@ int main() // camera/view transformation glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first float radius = 10.0f; - auto camX = static_cast(sin(glfwGetTime()) * radius); - auto camZ = static_cast(cos(glfwGetTime()) * radius); + float camX = static_cast(sin(glfwGetTime()) * radius); + float camZ = static_cast(cos(glfwGetTime()) * radius); view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); ourShader.setMat4("view", view); diff --git a/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp b/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp index 5a23faa..45c6fc9 100644 --- a/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp +++ b/src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp @@ -212,7 +212,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -276,7 +276,7 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - auto cameraSpeed = static_cast(2.5 * deltaTime); + float cameraSpeed = static_cast(2.5 * deltaTime); if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) cameraPos += cameraSpeed * cameraFront; if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) diff --git a/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp b/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp index 8c717b7..6d556fa 100644 --- a/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp +++ b/src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp @@ -221,7 +221,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -289,7 +289,7 @@ void processInput(GLFWwindow *window) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - auto cameraSpeed = static_cast(2.5 * deltaTime); + float cameraSpeed = static_cast(2.5 * deltaTime); if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) cameraPos += cameraSpeed * cameraFront; if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) @@ -313,8 +313,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { diff --git a/src/1.getting_started/7.4.camera_class/camera_class.cpp b/src/1.getting_started/7.4.camera_class/camera_class.cpp index f405899..93d60ce 100644 --- a/src/1.getting_started/7.4.camera_class/camera_class.cpp +++ b/src/1.getting_started/7.4.camera_class/camera_class.cpp @@ -216,7 +216,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -308,8 +308,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -331,5 +331,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); -} \ No newline at end of file + camera.ProcessMouseScroll(static_cast(yoffset)); +} diff --git a/src/2.lighting/1.colors/colors.cpp b/src/2.lighting/1.colors/colors.cpp index 384e69b..0597909 100644 --- a/src/2.lighting/1.colors/colors.cpp +++ b/src/2.lighting/1.colors/colors.cpp @@ -157,7 +157,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -252,8 +252,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -275,5 +275,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); -} \ No newline at end of file + camera.ProcessMouseScroll(static_cast(yoffset)); +} diff --git a/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp b/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp index b8b519b..99a1f71 100644 --- a/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp +++ b/src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -256,8 +256,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -279,5 +279,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); -} \ No newline at end of file + camera.ProcessMouseScroll(static_cast(yoffset)); +} diff --git a/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp b/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp index bc50fcc..ffe2342 100644 --- a/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp +++ b/src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -257,8 +257,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -279,5 +279,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); -} \ No newline at end of file + camera.ProcessMouseScroll(static_cast(yoffset)); +} diff --git a/src/2.lighting/3.1.materials/materials.cpp b/src/2.lighting/3.1.materials/materials.cpp index 33d5da9..82de7e1 100644 --- a/src/2.lighting/3.1.materials/materials.cpp +++ b/src/2.lighting/3.1.materials/materials.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -180,9 +180,9 @@ int main() // light properties glm::vec3 lightColor; - lightColor.x = static_cast(sin(glfwGetTime() * 2.0)); - lightColor.y = static_cast(sin(glfwGetTime() * 0.7)); - lightColor.z = static_cast(sin(glfwGetTime() * 1.3)); + lightColor.x = static_cast(sin(glfwGetTime() * 2.0)); + lightColor.y = static_cast(sin(glfwGetTime() * 0.7)); + lightColor.z = static_cast(sin(glfwGetTime() * 1.3)); glm::vec3 diffuseColor = lightColor * glm::vec3(0.5f); // decrease the influence glm::vec3 ambientColor = diffuseColor * glm::vec3(0.2f); // low influence lightingShader.setVec3("light.ambient", ambientColor); @@ -272,8 +272,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -295,5 +295,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); -} \ No newline at end of file + camera.ProcessMouseScroll(static_cast(yoffset)); +} diff --git a/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp b/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp index ea09d1a..7b1c0b0 100644 --- a/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp +++ b/src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -266,8 +266,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -288,5 +288,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } 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 ed2f1ea..4f4b412 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 @@ -170,7 +170,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -278,8 +278,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -301,7 +301,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp b/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp index 11fa264..a7f04e8 100644 --- a/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp +++ b/src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp @@ -172,7 +172,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -281,8 +281,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -304,7 +304,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp b/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp index f0816b9..dc0d755 100644 --- a/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp +++ b/src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp @@ -174,7 +174,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -287,8 +287,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -310,7 +310,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp b/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp index fba512f..5655313 100644 --- a/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp +++ b/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp @@ -182,7 +182,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -306,8 +306,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -328,7 +328,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp b/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp index 90b529a..7d65b24 100644 --- a/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp +++ b/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp @@ -185,7 +185,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -307,8 +307,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -330,7 +330,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp b/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp index 47a057d..6503df9 100644 --- a/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp +++ b/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp @@ -182,7 +182,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -308,8 +308,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -331,7 +331,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp b/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp index 89195d2..416943e 100644 --- a/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp +++ b/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp @@ -182,7 +182,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -308,8 +308,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -331,7 +331,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/2.lighting/6.multiple_lights/multiple_lights.cpp b/src/2.lighting/6.multiple_lights/multiple_lights.cpp index 9689bf0..6a7c73c 100644 --- a/src/2.lighting/6.multiple_lights/multiple_lights.cpp +++ b/src/2.lighting/6.multiple_lights/multiple_lights.cpp @@ -192,7 +192,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -361,8 +361,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -384,7 +384,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/3.model_loading/1.model_loading/model_loading.cpp b/src/3.model_loading/1.model_loading/model_loading.cpp index c66cff8..bc41ef8 100644 --- a/src/3.model_loading/1.model_loading/model_loading.cpp +++ b/src/3.model_loading/1.model_loading/model_loading.cpp @@ -94,7 +94,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -166,8 +166,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -189,5 +189,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp b/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp index 5a94de2..a7c7210 100644 --- a/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp +++ b/src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp @@ -177,7 +177,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -261,8 +261,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -284,7 +284,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp b/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp index 666d508..d6b4ad0 100644 --- a/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp +++ b/src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp @@ -177,7 +177,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -261,8 +261,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -284,7 +284,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp b/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp index 0848dd0..fa34d68 100644 --- a/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp +++ b/src/4.advanced_opengl/10.2.asteroids/asteroids.cpp @@ -105,11 +105,11 @@ int main() model = glm::translate(model, glm::vec3(x, y, z)); // 2. scale: Scale between 0.05 and 0.25f - float scale = static_cast((rand() % 20) / 100.0 + 0.05); + float scale = static_cast((rand() % 20) / 100.0 + 0.05); model = glm::scale(model, glm::vec3(scale)); // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector - float rotAngle = static_cast((rand() % 360)); + float rotAngle = static_cast((rand() % 360)); model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f)); // 4. now add to list of matrices @@ -122,7 +122,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -196,8 +196,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -219,5 +219,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp b/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp index 1950198..1eeca2c 100644 --- a/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp +++ b/src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp @@ -106,11 +106,11 @@ int main() model = glm::translate(model, glm::vec3(x, y, z)); // 2. scale: Scale between 0.05 and 0.25f - auto scale = static_cast((rand() % 20) / 100.0 + 0.05); + float scale = static_cast((rand() % 20) / 100.0 + 0.05); model = glm::scale(model, glm::vec3(scale)); // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector - auto rotAngle = static_cast((rand() % 360)); + float rotAngle = static_cast((rand() % 360)); model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f)); // 4. now add to list of matrices @@ -156,7 +156,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -194,7 +194,7 @@ int main() for (unsigned int i = 0; i < rock.meshes.size(); i++) { glBindVertexArray(rock.meshes[i].VAO); - glDrawElementsInstanced(GL_TRIANGLES, static_cast(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount); + glDrawElementsInstanced(GL_TRIANGLES, static_cast(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount); glBindVertexArray(0); } @@ -238,8 +238,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -261,5 +261,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp b/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp index db5854a..8c1eb38 100644 --- a/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp +++ b/src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp @@ -141,7 +141,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -204,8 +204,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -226,5 +226,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp b/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp index 0f6d003..6056bbc 100644 --- a/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp +++ b/src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp @@ -209,7 +209,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -296,8 +296,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -318,5 +318,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp b/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp index 805e12d..9176e73 100644 --- a/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp +++ b/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp @@ -181,7 +181,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -305,8 +305,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -328,7 +328,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp b/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp index 9dbd2c0..0d8d7be 100644 --- a/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp +++ b/src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp @@ -208,7 +208,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -304,8 +304,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -326,7 +326,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp b/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp index a8b5c0b..1fbb1c1 100644 --- a/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp +++ b/src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp @@ -210,7 +210,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -315,8 +315,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -337,7 +337,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp b/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp index 3aa9b7c..9f39226 100644 --- a/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp +++ b/src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp @@ -226,7 +226,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -331,8 +331,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -353,7 +353,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp index 85c71c7..16f43aa 100644 --- a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp +++ b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp @@ -226,7 +226,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -363,8 +363,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -385,7 +385,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp b/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp index 9b0ae08..88a8def 100644 --- a/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp +++ b/src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp @@ -222,7 +222,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -311,8 +311,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -333,7 +333,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp b/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp index 8c0ca0a..8ca9ddc 100644 --- a/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp +++ b/src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp @@ -220,7 +220,7 @@ int main() { // per-frame time logic // -------------------- - float currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -310,8 +310,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -332,7 +332,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp b/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp index dce90ea..9d5f74d 100644 --- a/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp +++ b/src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp @@ -168,7 +168,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -259,8 +259,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; diff --git a/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp b/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp index 95fe367..f735cff 100644 --- a/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp +++ b/src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp @@ -88,7 +88,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -111,7 +111,7 @@ int main() shader.setMat4("model", model); // add time component to geometry shader in the form of a uniform - shader.setFloat("time", static_cast(glfwGetTime())); + shader.setFloat("time", static_cast(glfwGetTime())); // draw model nanosuit.Draw(shader); @@ -156,8 +156,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -178,5 +178,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp b/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp index cca63bc..4a968cf 100644 --- a/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp +++ b/src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp @@ -90,7 +90,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -163,8 +163,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -185,5 +185,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp b/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp index d456294..3227425 100644 --- a/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp +++ b/src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp @@ -129,7 +129,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -215,8 +215,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -237,7 +237,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp b/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp index 9a61383..44d93a6 100644 --- a/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp +++ b/src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp @@ -141,7 +141,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -228,8 +228,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -250,7 +250,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp b/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp index a8886fc..c30867e 100644 --- a/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp +++ b/src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp @@ -154,7 +154,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -380,8 +380,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -403,7 +403,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from 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 6aaa8f7..5873ca8 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 @@ -158,7 +158,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -404,8 +404,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -426,7 +426,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp b/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp index cdd1150..a201fa9 100644 --- a/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp +++ b/src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp @@ -160,7 +160,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -411,8 +411,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -433,7 +433,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp b/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp index dcc5fd9..387becb 100644 --- a/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp +++ b/src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp @@ -129,7 +129,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -138,7 +138,7 @@ int main() processInput(window); // move light position over time - lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0); + lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0); // render // ------ @@ -358,8 +358,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -380,7 +380,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp b/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp index 88ec9a4..2a51384 100644 --- a/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp +++ b/src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp @@ -129,7 +129,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -138,7 +138,7 @@ int main() processInput(window); // move light position over time - lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0); + lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0); // render // ------ @@ -358,8 +358,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -380,7 +380,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp b/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp index a689077..14326db 100644 --- a/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp +++ b/src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp @@ -101,7 +101,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -271,8 +271,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -293,7 +293,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp b/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp index 09b1078..db8882a 100644 --- a/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp +++ b/src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp @@ -107,7 +107,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -300,8 +300,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -322,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp b/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp index 72970f9..958dbfa 100644 --- a/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp +++ b/src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp @@ -107,7 +107,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -300,8 +300,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -322,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp b/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp index 43f5708..e2439d0 100644 --- a/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp +++ b/src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp @@ -107,7 +107,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -300,8 +300,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -322,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/6.hdr/hdr.cpp b/src/5.advanced_lighting/6.hdr/hdr.cpp index e48ca83..0f63afe 100644 --- a/src/5.advanced_lighting/6.hdr/hdr.cpp +++ b/src/5.advanced_lighting/6.hdr/hdr.cpp @@ -141,7 +141,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -361,8 +361,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -383,7 +383,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file diff --git a/src/5.advanced_lighting/7.bloom/bloom.cpp b/src/5.advanced_lighting/7.bloom/bloom.cpp index 5e1132b..a8b6527 100644 --- a/src/5.advanced_lighting/7.bloom/bloom.cpp +++ b/src/5.advanced_lighting/7.bloom/bloom.cpp @@ -177,7 +177,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -469,8 +469,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -491,7 +491,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // utility function for loading a 2D texture from file 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 cc37ef4..13d6e10 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 @@ -150,14 +150,14 @@ int main() for (unsigned int i = 0; i < NR_LIGHTS; i++) { // calculate slightly random offsets - float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); - float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0); - float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); + float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); + float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0); + float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); lightPositions.push_back(glm::vec3(xPos, yPos, zPos)); // also calculate random color - float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 - float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 - float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 + float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 + float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 + float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0 lightColors.push_back(glm::vec3(rColor, gColor, bColor)); } @@ -174,7 +174,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -405,8 +405,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -427,5 +427,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp b/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp index 1a2b986..68692f2 100644 --- a/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp +++ b/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp @@ -150,14 +150,14 @@ int main() for (unsigned int i = 0; i < NR_LIGHTS; i++) { // calculate slightly random offsets - float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); - float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0); - float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); + float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); + float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0); + float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0); lightPositions.push_back(glm::vec3(xPos, yPos, zPos)); // also calculate random color - float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) - float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) - float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) + float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) + float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) + float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.) lightColors.push_back(glm::vec3(rColor, gColor, bColor)); } @@ -174,7 +174,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + auto currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -410,8 +410,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -432,5 +432,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/5.advanced_lighting/9.ssao/ssao.cpp b/src/5.advanced_lighting/9.ssao/ssao.cpp index ac7920d..08ac98e 100644 --- a/src/5.advanced_lighting/9.ssao/ssao.cpp +++ b/src/5.advanced_lighting/9.ssao/ssao.cpp @@ -222,7 +222,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -464,8 +464,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { lastX = xpos; @@ -486,5 +486,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } diff --git a/src/6.pbr/1.1.lighting/lighting.cpp b/src/6.pbr/1.1.lighting/lighting.cpp index 9259500..e24f8c9 100644 --- a/src/6.pbr/1.1.lighting/lighting.cpp +++ b/src/6.pbr/1.1.lighting/lighting.cpp @@ -115,7 +115,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -215,8 +215,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -238,13 +238,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -GLsizei indexCount; +unsigned int indexCount; void renderSphere() { if (sphereVAO == 0) @@ -300,7 +300,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = static_cast(indices.size()); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 e0bbd56..b64b00f 100644 --- a/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp +++ b/src/6.pbr/1.2.lighting_textured/lighting_textured.cpp @@ -120,7 +120,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -226,8 +226,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -249,13 +249,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -GLsizei indexCount; +unsigned int indexCount; void renderSphere() { if (sphereVAO == 0) @@ -311,7 +311,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = static_cast(indices.size()); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 097867b..de2ce95 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 @@ -214,7 +214,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -331,8 +331,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -360,7 +360,7 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -GLsizei indexCount; +unsigned int indexCount; void renderSphere() { if (sphereVAO == 0) @@ -416,7 +416,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = static_cast(indices.size()); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 80060a5..38cf5a4 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 @@ -255,7 +255,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -371,8 +371,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -394,13 +394,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -GLsizei indexCount; +unsigned int indexCount; void renderSphere() { if (sphereVAO == 0) @@ -456,7 +456,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = static_cast(indices.size()); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 fa543af..1e5f62d 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 @@ -343,7 +343,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -469,8 +469,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -492,13 +492,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere // ------------------------------------------------- unsigned int sphereVAO = 0; -GLsizei indexCount; +unsigned int indexCount; void renderSphere() { if (sphereVAO == 0) @@ -554,7 +554,7 @@ void renderSphere() } oddRow = !oddRow; } - indexCount = static_cast(indices.size()); + indexCount = static_cast(indices.size()); std::vector data; for (unsigned int i = 0; i < positions.size(); ++i) 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 23c1bf4..bdd36d2 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 @@ -380,7 +380,7 @@ int main() { // per-frame time logic // -------------------- - auto currentFrame = static_cast(glfwGetTime()); + float currentFrame = static_cast(glfwGetTime()); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; @@ -569,8 +569,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // ------------------------------------------------------- void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) { - auto xpos = static_cast(xposIn); - auto ypos = static_cast(yposIn); + float xpos = static_cast(xposIn); + float ypos = static_cast(yposIn); if (firstMouse) { @@ -592,7 +592,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn) // ---------------------------------------------------------------------- void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { - camera.ProcessMouseScroll(static_cast(yoffset)); + camera.ProcessMouseScroll(static_cast(yoffset)); } // renders (and builds at first invocation) a sphere