-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
64 lines (43 loc) · 1.89 KB
/
main.cpp
File metadata and controls
64 lines (43 loc) · 1.89 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "rtweekend.h"
#include "camera.h"
#include "hittable.h"
#include "hittable_list.h"
#include "sphere.h"
#include "material.h"
using namespace std;
int main(){
hittable_list world;
camera cam;
auto material_ground = make_shared<lambertian>(color(0.8, 0.8, 0.4));
auto material_center = make_shared<lambertian>(color(0.1, 0.1, 0.5));
auto material_left = make_shared<dielectric>(1.50);
auto material_bubble = make_shared<dielectric>(1.00/1.50);
auto material_right = make_shared<metal>(color(0.8, 0.6, 0.2), 0.1);
// world.add(make_shared<sphere>(point3(0.0, -100.5, -1.0), 100.0, material_ground));
// world.add(make_shared<sphere>(point3(0.0, 0.0, -1.2), 0.5, material_center));
// world.add(make_shared<sphere>(point3(-1.0, 0.0, -1.0), 0.5, material_left));
// world.add(make_shared<sphere>(point3(-1.0, 0.0, -1.0), 0.4, material_bubble));
// world.add(make_shared<sphere>(point3(1.0, 0.0, -1.0), 0.5, material_right));
cam.world.add(make_shared<sphere>(point3(0.0, -100.5, -1.0), 100.0, material_ground));
cam.world.add(make_shared<sphere>(point3(0.0, 0.0, -1.2), 0.5, material_center));
cam.world.add(make_shared<sphere>(point3(-1.0, 0.0, -1.0), 0.5, material_left));
cam.world.add(make_shared<sphere>(point3(-1.0, 0.0, -1.0), 0.4, material_bubble));
cam.world.add(make_shared<sphere>(point3(1.0, 0.0, -1.0), 0.5, material_right));
cam.aspect_ratio = 16.0/9.0;
cam.image_width = 720;
cam.image_height= cam.image_width / cam.aspect_ratio;
cam.samples_per_pixel = 150;
cam.max_depth = 50;
// camera controls
cam.vfov = 25;// the lower the value the greater the zoom.
cam.lookfrom = point3(-2,2,1);
cam.lookat = point3(0,0,-1);
cam.vup = vec3(0,1,0);
cam.defocus_angle = 1.0;
cam.focus_dist = 3.4;
// cam.world = world;
cam.initialize();
cam.render(cam.world);
// cam.render_to_window();
return 0;
}