Use std::pair instead of std::tuple in orthogonal_system
This commit is contained in:
parent
e799e33846
commit
eaa992bdbc
1 changed files with 3 additions and 3 deletions
|
@ -160,8 +160,8 @@ std::optional<HitResult> test_scene_octree(const Ray ray, const Scene& scene) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods adapated from https://users.cg.tuwien.ac.at/zsolnai/gfx/smallpaint/
|
// methods adapted from https://users.cg.tuwien.ac.at/zsolnai/gfx/smallpaint/
|
||||||
std::tuple<glm::vec3, glm::vec3> orthogonal_system(const glm::vec3& v1) {
|
std::pair<glm::vec3, glm::vec3> orthogonal_system(const glm::vec3& v1) {
|
||||||
glm::vec3 v2;
|
glm::vec3 v2;
|
||||||
if (glm::abs(v1.x) > glm::abs(v1.y)) {
|
if (glm::abs(v1.x) > glm::abs(v1.y)) {
|
||||||
// project to the y = 0 plane and construct a normalized orthogonal vector in this plane
|
// 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 r = sqrt(1.0 - u1 * u1);
|
||||||
const double phi = 2 * pi * u2;
|
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) {
|
glm::vec3 reflect(const glm::vec3& I, const glm::vec3& N) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue