diff --git a/ray.cpp b/ray.cpp index dcc3cb71..23218c35 100644 --- a/ray.cpp +++ b/ray.cpp @@ -121,6 +121,18 @@ ray::at (T t) const } +/////////////////////////////////////////////////////////////////////////////// +template +std::ostream& +util::operator<< (std::ostream &os, ray r) +{ + return os << "ray(" << r.origin << ',' << r.direction << ')'; +} + +template std::ostream& util::operator<< (std::ostream&, ray<3,float>); +template std::ostream& util::operator<< (std::ostream&, ray<3,double>); + + /////////////////////////////////////////////////////////////////////////////// template struct util::ray<2,float>; template struct util::ray<3,float>; diff --git a/ray.hpp b/ray.hpp index 4e4af2ff..ac95cabf 100644 --- a/ray.hpp +++ b/ray.hpp @@ -24,6 +24,8 @@ #include "sphere.hpp" #include "vector.hpp" +#include + namespace util { template struct ray { @@ -45,6 +47,8 @@ namespace util { vector direction; }; + template + std::ostream& operator<< (std::ostream&, ray); typedef ray<2,float> ray2f; typedef ray<3,float> ray3f;