From 0e1106aa41661421ba6f92732ca9be771a480bdc Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 16 Jul 2014 23:29:54 -0700 Subject: [PATCH] Update the call signature of compute_primary_ray It takes the current X and Y coordinates and the height and width of the image. --- src/camera.cc | 6 ++++-- src/camera.h | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/camera.cc b/src/camera.cc index 2c5f122..1e65de9 100644 --- a/src/camera.cc +++ b/src/camera.cc @@ -120,8 +120,10 @@ Camera::SetUp(const Vector3& up) * the view into the scene. */ Ray -OrthographicCamera::compute_primary_ray(const int &x, - const int &y) +OrthographicCamera::compute_primary_ray(const int x, + const int width, + const int y, + const int height) const { // Calculate the point on the image plane that the given (x,y) coordinate pair corresponds to. diff --git a/src/camera.h b/src/camera.h index b6e3551..9ee0008 100644 --- a/src/camera.h +++ b/src/camera.h @@ -28,12 +28,13 @@ public: void set_direction(const Vector3 &d); float get_angle() const; - virtual Ray compute_primary_ray(const int &x, const int &y) const = 0; const Vector3& GetRight() const; void SetRight(const Vector3& right); const Vector3& GetUp() const; void SetUp(const Vector3& up); + virtual Ray compute_primary_ray(const int x, const int width, + const int y, const int height) const = 0; private: // Size of the image plane. @@ -51,7 +52,8 @@ class OrthographicCamera : public Camera { public: - Ray compute_primary_ray(const int &x, const int &y) const; + Ray compute_primary_ray(const int x, const int width, + const int y, const int height) const; };