Fixed wrong paths and added an outDistance to RayVsAABB.
This commit is contained in:
@@ -32,6 +32,12 @@ bool RayAABBIntr(const Ray& ray, const AABB& box)
|
||||
}
|
||||
|
||||
bool RayVsAABB(const Ray& ray, const AABB& box)
|
||||
{
|
||||
float dummy;
|
||||
return RayVsAABB(ray, box, dummy);
|
||||
}
|
||||
|
||||
bool RayVsAABB(const Ray& ray, const AABB& box, float& outDistance)
|
||||
{
|
||||
glm::vec3 invdir = 1.0f / ray.Direction;
|
||||
|
||||
@@ -48,6 +54,7 @@ bool RayVsAABB(const Ray& ray, const AABB& box)
|
||||
if (tmax < 0 || tmin > tmax)
|
||||
return false;
|
||||
|
||||
outDistance = (tmin > 0) ? tmin : tmax;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user