ray: add ostream operator
This commit is contained in:
parent
d0bf00a9ac
commit
bb15548fb6
12
ray.cpp
12
ray.cpp
@ -121,6 +121,18 @@ ray<S,T>::at (T t) const
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <size_t S, typename T>
|
||||
std::ostream&
|
||||
util::operator<< (std::ostream &os, ray<S,T> 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>;
|
||||
|
4
ray.hpp
4
ray.hpp
@ -24,6 +24,8 @@
|
||||
#include "sphere.hpp"
|
||||
#include "vector.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace util {
|
||||
template <size_t S, typename T>
|
||||
struct ray {
|
||||
@ -45,6 +47,8 @@ namespace util {
|
||||
vector<S,T> direction;
|
||||
};
|
||||
|
||||
template <size_t S, typename T>
|
||||
std::ostream& operator<< (std::ostream&, ray<S,T>);
|
||||
|
||||
typedef ray<2,float> ray2f;
|
||||
typedef ray<3,float> ray3f;
|
||||
|
Loading…
Reference in New Issue
Block a user