-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
56 lines (44 loc) · 1.67 KB
/
main.cpp
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
46
47
48
49
50
51
52
53
54
55
56
#include "vec3.h"
#include "ray.h"
#include "hittable.h"
#include "sphere.h"
#include "hittable_list.h"
#include "color.h"
#include "camera.h"
#include "material.h"
#include "utils.h"
#include <iostream>
#include <fstream>
#include <vector>
#define infinity std::numeric_limits<double>::infinity()
int main(){
// World
// Materials
auto material_left = make_shared<metal>(color(0.1, 0.7, 0.2), 0);
auto material_right = make_shared<lambertian>(color(0.2, 0.1, 0.7));
//auto material_right = make_shared<dielectic>(1.05);
auto material_ground = make_shared<lambertian>(color(0.5, 0.5, 0.5));
auto material_center = make_shared<lambertian>(color(0.7, 0.2, 0.1));
// Creating objects
/*sphere s1(vec3(-1, 0, -1), 0.5, color(0.4, 0.9, 0.3), true);
sphere s2(vec3(0, 0, -1), 0.5, material_center);
sphere s3(vec3(1, 0, -1), 0.5, color(0.9, 0.3, 0.4), true);
sphere s4(vec3(0, -100.5, -1), 100, material_ground);*/
hittable_list world;
world.add(make_shared<sphere>(vec3(-2, 0.5, -2), 1, material_left));
world.add(make_shared<sphere>(vec3(0, 0.5, -3), 1, material_center));
world.add(make_shared<sphere>(vec3(-0.55, 0, -1), 0.25, material_right));
world.add(make_shared<sphere>(vec3(0, -100.5, -1), 100, material_ground));
auto light_material = make_shared<lambertian>(color(1,1,1));
hittable_list lights;
//lights.add(make_shared<sphere>(vec3(0, 120, 0), 60, light_material));
lights.add(make_shared<sphere>(vec3(1.55, 0, -1), 0.25, light_material));
camera cam;
cam.screen_width = 1200;
cam.aspect_ratio = 16.0 / 9.0;
cam.max_depth = 6;
cam.render(world, lights);
return 0;
}
/*xmmintrin
union, */