1
Fork 0

Use std::pair instead of std::tuple in orthogonal_system

This commit is contained in:
Joshua Goins 2024-09-25 10:31:07 +02:00
parent e799e33846
commit eaa992bdbc

View file

@ -160,8 +160,8 @@ std::optional<HitResult> test_scene_octree(const Ray ray, const Scene& scene) {
return {};
}
// methods adapated from https://users.cg.tuwien.ac.at/zsolnai/gfx/smallpaint/
std::tuple<glm::vec3, glm::vec3> orthogonal_system(const glm::vec3& v1) {
// methods adapted from https://users.cg.tuwien.ac.at/zsolnai/gfx/smallpaint/
std::pair<glm::vec3, glm::vec3> orthogonal_system(const glm::vec3& v1) {
glm::vec3 v2;
if (glm::abs(v1.x) > glm::abs(v1.y)) {
// project to the y = 0 plane and construct a normalized orthogonal vector in this plane
@ -180,7 +180,7 @@ glm::vec3 hemisphere(const double u1, const double u2) {
const double r = sqrt(1.0 - u1 * u1);
const double phi = 2 * pi * u2;
return glm::vec3(cos(phi) * r, sin(phi) * r, u1);
return {cos(phi) * r, sin(phi) * r, u1};
}
glm::vec3 reflect(const glm::vec3& I, const glm::vec3& N) {