diff --git a/src/object.cc b/src/object.cc index 8e3fde4..1c09bfa 100644 --- a/src/object.cc +++ b/src/object.cc @@ -54,6 +54,15 @@ Object::set_origin(Vector3 v) origin = v; } + +std::ostream & +operator<<(std::ostream &os, const Object &o) +{ + // Stream objects like this: [Object origin] + os << "[Object " << o.origin << "]"; + return os; +} + #pragma mark - Shapes /* diff --git a/src/object.h b/src/object.h index af36e28..f143fbc 100644 --- a/src/object.h +++ b/src/object.h @@ -9,6 +9,8 @@ #ifndef __OBJECT_H__ #define __OBJECT_H__ +#include + #include "basics.h" #include "material.h" #include "texture.h" @@ -23,10 +25,14 @@ public: Vector3 get_origin() const; void set_origin(Vector3 v); + friend std::ostream &operator<<(std::ostream &os, const Object &o); + private: Vector3 origin; }; +std::ostream &operator<<(std::ostream &os, const Object &o); + class Shape : public Object