From 3ec5b20f16a552333ea7b1451380b784aa96b392 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 19 Jul 2014 20:57:12 -0700 Subject: [PATCH] Rename Scene::camera -> mCamera --- src/scene.cc | 25 ++++++++++++++++++++----- src/scene.h | 7 ++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/scene.cc b/src/scene.cc index 1ce68f8..92a7da6 100644 --- a/src/scene.cc +++ b/src/scene.cc @@ -18,7 +18,7 @@ Scene::Scene() : width(640), height(480), - camera(new PerspectiveCamera()), + mCamera(new PerspectiveCamera()), max_depth(5), min_weight(1e-4), ambient(new AmbientLight()), @@ -31,9 +31,9 @@ Scene::Scene() Scene::~Scene() { - if (camera) { - delete camera; - camera = NULL; + if (mCamera) { + delete mCamera; + mCamera = NULL; } if (ambient != NULL) { @@ -81,6 +81,21 @@ Scene::get_height() } +Camera* +Scene::GetCamera() + const +{ + return mCamera; +} + + +void +Scene::SetCamera(Camera* camera) +{ + mCamera = camera; +} + + AmbientLight & Scene::get_ambient() const @@ -136,7 +151,7 @@ Scene::render() Vector3 o, d; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - primary_ray = camera->compute_primary_ray(x, width, y, height); + primary_ray = mCamera->compute_primary_ray(x, width, y, height); Color c = trace_ray(primary_ray); pixels[y * width + x] = c; } diff --git a/src/scene.h b/src/scene.h index ca580f7..ec0d18a 100644 --- a/src/scene.h +++ b/src/scene.h @@ -30,10 +30,15 @@ public: ~Scene(); bool is_rendered() const; + int get_width() const; void set_width(int w) { width = w; } int get_height() const; void set_height(int h) { height = h; } + + Camera* GetCamera() const; + void SetCamera(Camera* camera); + AmbientLight &get_ambient() const; const Color *get_pixels() const; @@ -50,7 +55,7 @@ private: // Pixel dimensions of the image. int width, height; - Camera *camera; + Camera *mCamera; /* * Ray tracing parameters. max_depth indicates the maximum depth of the ray tree. min_weight indicates the minimum