Rename Scene::camera -> mCamera
This commit is contained in:
parent
6f04526d36
commit
3ec5b20f16
2 changed files with 26 additions and 6 deletions
25
src/scene.cc
25
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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue