-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScene.cpp
More file actions
27 lines (22 loc) · 697 Bytes
/
Copy pathScene.cpp
File metadata and controls
27 lines (22 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "Scene.h"
#include <iostream>
#include <stdexcept>
#include <memory>
void Scene::addCamera(vec3 eye, vec3 center, vec3 up, float fovy) {
Scene::eye = eye;
Scene::center = center;
Scene::up = up;
Scene::fieldOfViewY = glm::radians(fovy);
// Computer fovx using fovy and the aspect ratio of the image
Scene::fieldOfViewX = (2 * atan( tan(fieldOfViewY / 2) * ((float) width/ height)));
}
void Scene::setImageResolution(int w, int h) {
Scene::width = w;
Scene::height = h;
}
void Scene::addLight(std::shared_ptr<LightSource> light) {
lights.push_back(light);
}
void Scene::addObjectToScene(std::shared_ptr<SceneObject> sceneObj) {
sceneObjects.push_back(sceneObj);
}