Add operator<< overload for Object
This commit is contained in:
parent
c6b8b167ca
commit
c405302613
2 changed files with 15 additions and 0 deletions
|
@ -54,6 +54,15 @@ Object::set_origin(Vector3 v)
|
||||||
origin = 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
|
#pragma mark - Shapes
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#ifndef __OBJECT_H__
|
#ifndef __OBJECT_H__
|
||||||
#define __OBJECT_H__
|
#define __OBJECT_H__
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "basics.h"
|
#include "basics.h"
|
||||||
#include "material.h"
|
#include "material.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
@ -23,10 +25,14 @@ public:
|
||||||
Vector3 get_origin() const;
|
Vector3 get_origin() const;
|
||||||
void set_origin(Vector3 v);
|
void set_origin(Vector3 v);
|
||||||
|
|
||||||
|
friend std::ostream &operator<<(std::ostream &os, const Object &o);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector3 origin;
|
Vector3 origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &os, const Object &o);
|
||||||
|
|
||||||
|
|
||||||
class Shape
|
class Shape
|
||||||
: public Object
|
: public Object
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue