X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FRay.hh;h=5a693d29be996da95d2065b3e617ad971971a6cc;hp=15e1d9dbec71d726a9aa0e54034c4114cf9e3bd4;hb=b357615aba1dbde81e3c6999366604e6001010a7;hpb=2d77fb5fb3480f522658f30af6addd5146530517 diff --git a/src/Moof/Ray.hh b/src/Moof/Ray.hh index 15e1d9d..5a693d2 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 @@ -65,6 +70,7 @@ struct Ray : public Drawable void draw(Scalar alpha = 0.0) const { Vector end = point + 1000.0 * direction; + // TODO this is kinda cheesy Mf::Texture::resetBind(); glBegin(GL_LINES); @@ -77,7 +83,6 @@ struct Ray : public Drawable { direction.normalize(); } - };