-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractive.cpp
More file actions
123 lines (114 loc) · 3.59 KB
/
interactive.cpp
File metadata and controls
123 lines (114 loc) · 3.59 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
// Created by Andrew Yang on 3/27/21.
//
#include <thread>
#include "scenes.hpp"
#include "raytracer.hpp"
#include "parallel/params.hpp"
#include "hittable/rectangles.hpp"
#include "render.hpp"
float params::ASPECT_RATIO = 16.f/9.f;
unsigned params::WIDTH = 200;
unsigned params::HEIGHT = int(params::WIDTH / params::ASPECT_RATIO);
unsigned params::N = 16;//16;
unsigned params::N_samples = 10;
unsigned params::MAX_DEPTH = 16;//50
unsigned params::W_CNT = (params::WIDTH + params::N - 1) / params::N;
unsigned params::H_CNT = (params::HEIGHT + params::N - 1) / params::N;
int main() {
hittable_list world;
point3 lookfrom;
point3 lookat;
auto vfov = 40.0f;
auto aperture = .0f;
color background(0, 0, 0);
auto time0 = .0f;
auto time1 = 1.0f;
switch(0) {
default:
case 1:
world = random_scene();
background = color(.7f, .8f, 1.0f);
lookfrom = point3(13, 2, 3);
lookat = point3(0, 0, 0);
vfov = 20.0f;
aperture = .1f;
break;
case 2:
world = gold_coin();
lookfrom = point3(0, 4, -3);
lookat = point3(0,0,0);
params::ASPECT_RATIO = 16.f/9.f;
params::HEIGHT = int(params::WIDTH / params::ASPECT_RATIO);
break;
case 3:
world = mesh_test();
lookfrom = point3(0, 1, -7);
lookat = point3(0,1,0);
background = color(.7f, .8f, 1.0f);
params::ASPECT_RATIO = 16.f/9.f;
params::HEIGHT = int(params::WIDTH / params::ASPECT_RATIO);
break;
case 4:
world = moving_spheres();
lookfrom = point3(378, 300, 50);
lookat = point3(-150, -150, -150);
params::ASPECT_RATIO = 3.0f/2.0f;
params::HEIGHT = int(params::WIDTH / params::ASPECT_RATIO);
break;
case 6:
world = cornell_box();
background = color(0, 0, 0);
lookfrom = point3(278, 278, -800);
lookat = point3(278, 278, 0);
vfov = 40.0f;
break;
case 7:
world = cornell_smoke();
lookfrom = point3(278, 278, -800);
lookat = point3(278, 278, 0);
vfov = 40.0f;
break;
case 8:
world = final_scene();
background = color(0,0,0);
lookfrom = point3(478, 278, -600);
lookat = point3(278, 278, 0);
vfov = 40.0f;
break;
case 9:
world = single_cylinder();
background = color(.7f, .8f, 1.0f);
lookfrom = point3(0, 2, -15);
lookat = point3(0, 0, 0);
vfov = 20.0f;
aperture = .1f;
break;
case 10:
params::N_samples = 10;
world = single_cone();
background = color(.7f, .8f, 1.0f);
lookfrom = point3(13, 2, 3);
lookat = point3(0, 0, 0);
vfov = 20.0f;
aperture = .1f;
break;
case 11:
world = mapped_box();
background = color(1,1,1);
lookfrom = point3(9, -1, 0);
lookat = point3(0, -1, 0);
vfov = 40.0f;
aperture = .02f;
break;
case 12:
world = cornell_glass();
background = color(0, 0, 0);
lookfrom = point3(278, 278, -800);
lookat = point3(278, 278, 0);
vfov = 40.0f;
break;
}
render_window(lookfrom, lookat, vfov, aperture, world, background);
return 0;
}