From 101a20443ed8572fc4797754261c0af521c8ab22 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 27 Mar 2022 21:29:37 -0400 Subject: [PATCH] Fix Windows build FindGLM now properly searches newer glm packages which doesn't include a "include" folder. --- CMakeLists.txt | 2 +- cmake/FindGLM.cmake | 1 + src/scene.cpp | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92a5157..9c2e6fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ add_executable(raytracer src/main.cpp src/scene.cpp) target_include_directories(raytracer PUBLIC include PRIVATE ${GLM_INCLUDE_DIR}) -target_link_libraries(raytracer PUBLIC stb SDL2::Core imgui glad) +target_link_libraries(raytracer PUBLIC stb SDL2::Main imgui glad) set_target_properties(raytracer PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES diff --git a/cmake/FindGLM.cmake b/cmake/FindGLM.cmake index 036aff9..829f108 100644 --- a/cmake/FindGLM.cmake +++ b/cmake/FindGLM.cmake @@ -25,6 +25,7 @@ if (WIN32) PATHS $ENV{PROGRAMFILES}/include ${GLM_ROOT_DIR}/include + ${GLM_ROOT_DIR} DOC "The directory where glm/glm.hpp resides") else() # Find include files diff --git a/src/scene.cpp b/src/scene.cpp index fab7e2b..aeb4b55 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -1,6 +1,7 @@ #include "scene.h" #include +#include constexpr double pi = 3.14159265358979323846l; @@ -112,6 +113,8 @@ Node* find_hit_ray_search(Node& node, const Ray ray, std::vector*> out->push_back(&node); } } + + return nullptr; } template @@ -161,7 +164,7 @@ std::tuple orthogonal_system(const glm::vec3& v1) { glm::vec3 hemisphere(const double u1, const double u2) { const double r = sqrt(1.0 - u1 * u1); - const double phi = 2 * M_PI * u2; + const double phi = 2 * pi * u2; return glm::vec3(cos(phi) * r, sin(phi) * r, u1); }