From 08bd04d8daf5d4b69217bc107adee8bc82aef4d3 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 3 Aug 2014 20:12:00 -0700 Subject: [PATCH] Fancier way of logging the camera's parameters --- src/camera.cc | 22 +++++++++++++++------- src/scene.cc | 12 +++++++++++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/camera.cc b/src/camera.cc index 44f13d1..0910426 100644 --- a/src/camera.cc +++ b/src/camera.cc @@ -150,11 +150,19 @@ Camera::LookAt(const Vector3& pt) } +std::string +Camera::GetTypeString() + const +{ + return "GENERIC"; +} + + void Camera::WriteType(std::ostream& ost) const { - ost << "UNKNOWN"; + ost << GetTypeString(); } #pragma mark - Perspective Camera @@ -190,11 +198,11 @@ PerspectiveCamera::compute_primary_ray(const int x, } -void -PerspectiveCamera::WriteType(std::ostream& ost) +std::string +PerspectiveCamera::GetTypeString() const { - ost << "perspective"; + return "perspective"; } #pragma mark - Orthographic Camera @@ -239,11 +247,11 @@ OrthographicCamera::compute_primary_ray(const int x, } -void -OrthographicCamera::WriteType(std::ostream& ost) +std::string +OrthographicCamera::GetTypeString() const { - ost << "orthographic"; + return "orthographic"; } diff --git a/src/scene.cc b/src/scene.cc index aee639a..fc8f741 100644 --- a/src/scene.cc +++ b/src/scene.cc @@ -336,7 +336,17 @@ void Scene::LogCamera() const { - LOG_DEBUG << *mCamera; + const Camera& c = *mCamera; + + LOG_DEBUG << "BEGIN CAMERA"; + LOG_DEBUG << " type = " << c.GetTypeString(); + LOG_DEBUG << " origin = " << c.GetOrigin(); + LOG_DEBUG << " direction = " << c.get_direction(); + LOG_DEBUG << " right = " << c.GetRight(); + LOG_DEBUG << " up = " << c.GetUp(); + LOG_DEBUG << " coordinate system is " + << (c.IsLeftHanded() ? "left-handed" : "right-handed"); + LOG_DEBUG << "END CAMERA"; }