summaryrefslogtreecommitdiffstats
path: root/src/render/backend/triangleboundingvolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/backend/triangleboundingvolume.cpp')
-rw-r--r--src/render/backend/triangleboundingvolume.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/render/backend/triangleboundingvolume.cpp b/src/render/backend/triangleboundingvolume.cpp
index 80a23572c..ca2d26897 100644
--- a/src/render/backend/triangleboundingvolume.cpp
+++ b/src/render/backend/triangleboundingvolume.cpp
@@ -112,15 +112,18 @@ Qt3DCore::QNodeId TriangleBoundingVolume::id() const
return m_id;
}
-bool TriangleBoundingVolume::intersects(const RayCasting::QRay3D &ray, QVector3D *q) const
+bool TriangleBoundingVolume::intersects(const RayCasting::QRay3D &ray, QVector3D *q, QVector3D *uvw) const
{
float t = 0.0f;
- QVector3D uvw;
- const bool intersected = intersectsSegmentTriangle(ray, m_c, m_b, m_a, uvw, t);
-
- if (intersected && q != nullptr)
- *q = ray.point(t * ray.distance());
-
+ QVector3D uvwr;
+ const float intersected = intersectsSegmentTriangle(ray, m_c, m_b, m_a, uvwr, t);
+
+ if (intersected) {
+ if (q != nullptr)
+ *q = ray.point(t);
+ if (uvw != nullptr)
+ *uvw = uvwr;
+ }
return intersected;
}