]> git.localhorst.tv Git - blank.git/blobdiff - src/geometry/geometry.cpp
make Intersection() repeatable for normal
[blank.git] / src / geometry / geometry.cpp
index 5db29c8c3ad8488ccb655f3d71b15bcae7c2942c..6ff26cad40b928b761a62630f9538d467c3c6348 100644 (file)
@@ -109,14 +109,14 @@ bool Intersection(
                glm::vec3 min_all(glm::min(t1, t2));
                if (min_all.x > min_all.y) {
                        if (min_all.x > min_all.z) {
-                               normal->x = t2.x < t1.x ? 1 : -1;
+                               *normal = glm::vec3(t2.x < t1.x ? 1 : -1, 0, 0);
                        } else {
-                               normal->z = t2.z < t1.z ? 1 : -1;
+                               *normal = glm::vec3(0, 0, t2.z < t1.z ? 1 : -1);
                        }
                } else if (min_all.y > min_all.z) {
-                       normal->y = t2.y < t1.y ? 1 : -1;
+                       *normal = glm::vec3(0, t2.y < t1.y ? 1 : -1, 0);
                } else {
-                       normal->z = t2.z < t1.z ? 1 : -1;
+                       *normal = glm::vec3(0, 0, t2.z < t1.z ? 1 : -1);
                }
        }
        return true;