summaryrefslogtreecommitdiff
path: root/lib/ray.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-02-24 00:27:49 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-02-24 00:27:49 +0000
commit744e6ad2fb88671800e39db33d08b2cd451c8338 (patch)
tree563da22ef0240131fe0540e9ccc3fed5d10fc9a2 /lib/ray.h
parentSimplify vector addition/subtraction with differnt types (diff)
parentFirst cut of terrain deformation (diff)
downloadilt-744e6ad2fb88671800e39db33d08b2cd451c8338.tar.bz2
ilt-744e6ad2fb88671800e39db33d08b2cd451c8338.tar.xz
ilt-744e6ad2fb88671800e39db33d08b2cd451c8338.zip
Psycho-rebased branch deform-terrain on top of main
Diffstat (limited to 'lib/ray.h')
-rw-r--r--lib/ray.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ray.h b/lib/ray.h
index e1f43c3..67fdd12 100644
--- a/lib/ray.h
+++ b/lib/ray.h
@@ -47,11 +47,11 @@ public:
RelativeDistance & distance) const
{
if constexpr (std::is_floating_point_v<typename PositionType::value_type>) {
- return glm::intersectRayTriangle(start, direction, t0, t1, t2, bary, distance);
+ return glm::intersectRayTriangle(start, direction, t0, t1, t2, bary, distance) && distance >= 0.F;
}
else {
const RelativePosition3D t0r = t0 - start, t1r = t1 - start, t2r = t2 - start;
- return glm::intersectRayTriangle({}, direction, t0r, t1r, t2r, bary, distance);
+ return glm::intersectRayTriangle({}, direction, t0r, t1r, t2r, bary, distance) && distance >= 0.F;
}
}