Log the camera before rendering

Implement an operator<< for Cameras. Log the scene's camera.
This commit is contained in:
Eryn Wells 2014-08-03 19:10:31 -07:00
parent bcf93bb4ce
commit f99608085e
4 changed files with 62 additions and 0 deletions

View file

@ -123,6 +123,14 @@ Camera::LookAt(const Vector3& pt)
mUp *= upLength;
}
void
Camera::WriteType(std::ostream& ost)
const
{
ost << "UNKNOWN";
}
#pragma mark - Perspective Camera
PerspectiveCamera::PerspectiveCamera()
@ -155,6 +163,14 @@ PerspectiveCamera::compute_primary_ray(const int x,
return Ray(GetOrigin(), direction.normalize());
}
void
PerspectiveCamera::WriteType(std::ostream& ost)
const
{
ost << "perspective";
}
#pragma mark - Orthographic Camera
OrthographicCamera::OrthographicCamera()
@ -195,3 +211,26 @@ OrthographicCamera::compute_primary_ray(const int x,
y0, GetUp());
return Ray(origin, get_direction());
}
void
OrthographicCamera::WriteType(std::ostream& ost)
const
{
ost << "orthographic";
}
std::ostream&
operator<<(std::ostream& ost,
const Camera& camera)
{
ost << "[Camera ";
camera.WriteType(ost);
ost << " origin=" << camera.mOrigin
<< " direction=" << camera.mDirection
<< " right=" << camera.mRight
<< " up=" << camera.mUp
<< "]";
return ost;
}