X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FRay.hh;h=23ebd7655924ea9a6819fecd1ca3354f51e56c33;hp=15e1d9dbec71d726a9aa0e54034c4114cf9e3bd4;hb=7f3984f3f9524f5b6813e01ceb2fe576dadff94e;hpb=99ac607f489023a7aa17bfb046113b0e4a65dab6 diff --git a/src/Moof/Ray.hh b/src/Moof/Ray.hh index 15e1d9d..23ebd76 100644 --- a/src/Moof/Ray.hh +++ b/src/Moof/Ray.hh @@ -53,8 +53,13 @@ struct Ray : public Drawable struct Intersection { - Vector point; // nearest point of intersection + Scalar distance; // distance from the origin to the nearest point Vector normal; // surface normal at intersection point + + bool operator < (const Intersection& rhs) + { + return distance < rhs.distance; + } }; void solve(Vector& p, Scalar t) const @@ -77,7 +82,6 @@ struct Ray : public Drawable { direction.normalize(); } - };