summaryrefslogtreecommitdiff
path: root/lib/ray.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 13:51:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 14:14:13 +0000
commit7fba471728f2216d7e3b7900297fc3b3531e286c (patch)
tree5caef3b2efc23aefccb215ec9005cd8e7d2e91b8 /lib/ray.h
parentFix todo for handling a terrain walk from outside the mesh (diff)
parentModel positions as integers (diff)
downloadilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.bz2
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.xz
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.zip
Merge branch 'ints' into terrain
Conflicts fix, compiles, some test failures remain. Trees not added, possibility of OM invalid handle assertion failures, normals broken due to integer overflow in Newell's method.
Diffstat (limited to 'lib/ray.h')
-rw-r--r--lib/ray.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/ray.h b/lib/ray.h
index 9bf47af..bc70c74 100644
--- a/lib/ray.h
+++ b/lib/ray.h
@@ -1,17 +1,20 @@
#pragma once
+#include "config/types.h"
#include <glm/glm.hpp>
#include <span>
class Ray {
public:
- Ray(glm::vec3 start, glm::vec3 direction) : start {start}, direction {direction} { }
+#ifndef __cpp_aggregate_paren_init
+ Ray(Position3D start, Direction3D direction) : start {start}, direction {direction} { }
+#endif
- static Ray fromPoints(glm::vec3, glm::vec3);
+ static Ray fromPoints(Position3D, Position3D);
- glm::vec3 start;
- glm::vec3 direction;
+ Position3D start;
+ Direction3D direction;
- float distanceToLine(const glm::vec3 & a, const glm::vec3 & b) const;
- bool passesCloseToEdges(const std::span<const glm::vec3> positions, float distance) const;
+ [[nodiscard]] float distanceToLine(const Position3D & a, const Position3D & b) const;
+ [[nodiscard]] bool passesCloseToEdges(const std::span<const Position3D> positions, float distance) const;
};