1
Fork 0

Fix Windows build

FindGLM now properly searches newer glm packages which
doesn't include a "include" folder.
This commit is contained in:
Joshua Goins 2022-03-27 21:29:37 -04:00
parent 0d89859176
commit 101a20443e
3 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -1,6 +1,7 @@
#include "scene.h"
#include <glm/gtx/perpendicular.hpp>
#include <functional>
constexpr double pi = 3.14159265358979323846l;
@ -112,6 +113,8 @@ Node<T>* find_hit_ray_search(Node<T>& node, const Ray ray, std::vector<Node<T>*>
out->push_back(&node);
}
}
return nullptr;
}
template<typename T>
@ -161,7 +164,7 @@ std::tuple<glm::vec3, glm::vec3> 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);
}