Add Write methods to scene objects
Write methods are polymorphic, overridden by subclasses. There is a single operator<< for Objects that calls the right Write() method for the object. Neat.
This commit is contained in:
parent
b56bbf4ced
commit
4828cb313f
8 changed files with 64 additions and 1 deletions
|
@ -14,7 +14,7 @@
|
|||
#include "object.h"
|
||||
|
||||
namespace charles {
|
||||
|
||||
|
||||
#pragma mark - Objects
|
||||
|
||||
/*
|
||||
|
@ -70,4 +70,21 @@ Object::SetMaterial(const Material& material)
|
|||
mMaterial = material;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Object::Write(std::ostream& ost)
|
||||
const
|
||||
{
|
||||
ost << "[Object]";
|
||||
}
|
||||
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& ost,
|
||||
const Object& object)
|
||||
{
|
||||
object.Write(ost);
|
||||
return ost;
|
||||
}
|
||||
|
||||
} /* namespace charles */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue