-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (33 loc) · 1.62 KB
/
Copy pathmain.cpp
File metadata and controls
45 lines (33 loc) · 1.62 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <QApplication>
#include <iostream>
#include "Sphere.h"
#include "Triangle.h"
#include "TriangleMesh.h"
#include "camera.h"
#include "gui.h"
int main(int argc, char** argv) {
QApplication app(argc, argv);
Camera camera({0, 0, 20});
std::vector<Light*> lights;
lights.push_back(new Light(glm::dvec3(-2, 5, -20), 1.0));
lights.push_back(new Light(glm::dvec3(0, 10, 20), 1.0));
RayTracer raytracer(camera, lights);
Material ivory(glm::dvec3(0.4, 0.4, 0.3), 1.0, glm::dvec4(0.6, 0.3, 0.1, 0.0), 50., MaterialType::Refractive);
Material glass(glm::dvec3(0.6, 0.7, 0.8), 1.5, glm::dvec4(0.0, 0.5, 0.1, 0.8), 125., MaterialType::Dielec);
Material red_rubber(glm::dvec3(0.3, 0.1, 0.1), 1.0, glm::dvec4(0.9, 0.1, 0.0, 0.0), 10., MaterialType::Diffuse);
Material mirror(glm::dvec3(1.0, 1.0, 1.0), 1.0, glm::dvec4(0.0, 10.0, 0.8, 0.0), 1425., MaterialType::Specular);
Material light(glm::dvec3(1.0), 0, glm::dvec4(0), 0, MaterialType::Diffuse, glm::dvec3(4.0));
// Set up scene
Octree scene({-20, -20, -20}, {20, 20, 20});
scene.push_back(new Sphere({-1, -8, -10}, 2, ivory));
scene.push_back(new Sphere({-7, -8, -20}, 2, glass));
scene.push_back(new Sphere({7, -8, -10}, 2, red_rubber));
scene.push_back(new Sphere({4, -8, -20}, 2, mirror));
scene.push_back(new Sphere({0, 10, -15}, 2, light));
scene.push_back(new Triangle({-8, -10, -6}, {-4, -10, -6}, {-6, -6, -6}, glass));
//scene.push_back(new Triangle({2, -10, -6}, {6, -10, -6}, {4, -6, -6}, glass));
raytracer.setScene(&scene);
Gui window(500, 500, raytracer);
window.show();
return app.exec();
}