-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (40 loc) · 1.47 KB
/
Copy pathmain.cpp
File metadata and controls
48 lines (40 loc) · 1.47 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
#include "ray_tracing.h"
#include "hittable.h"
#include "hittable_list.h"
#include "sphere.h"
#include "camera.h"
#include <thread>
#include <omp.h>
#ifndef WRITE_IMG
#define WRITE_IMG true
#endif
#ifndef IMAGE_WIDTH
#define IMAGE_WIDTH 1280
#endif
#ifndef SAMPLES_PER_PIXEL
#define SAMPLES_PER_PIXEL 50
#endif
#ifndef MAX_BOUNCING_DEPTH
#define MAX_BOUNCING_DEPTH 50
#endif
int main()
{
hittable_list world;
auto material_ground = std::make_shared<lambertian>(color(0.8, 0.8, 0.0));
auto material_center = std::make_shared<lambertian>(color(0.1, 0.2, 0.5));
auto material_center_2 = std::make_shared<lambertian>(color(0.8, 0.3, 0.4));
auto material_left = std::make_shared<metal>(color(0.8, 0.8, 0.8));
auto material_right = std::make_shared<metal>(color(0.8, 0.6, 0.2));
world.add(std::make_shared<sphere>(point3(0.0, -100.5, -1.0), 100.0, material_ground.get()));
world.add(std::make_shared<sphere>(point3(0.0, 0.0, -1.2), 0.5, material_center.get()));
world.add(std::make_shared<sphere>(point3(-1, 0.0, -1.0), 0.4, material_left.get()));
world.add(std::make_shared<sphere>(point3(1.0, 0.0, -1.0), 0.5, material_right.get()));
world.add(std::make_shared<sphere>(point3(0.1, -0.2, -0.6), 0.1, material_center_2.get()));
camera cam;
cam.aspect_ratio = 16.0 / 9.0;
cam.image_width = IMAGE_WIDTH;
cam.samples_per_pixel = SAMPLES_PER_PIXEL;
cam.max_bouncing_depth = MAX_BOUNCING_DEPTH;
cam.render(world, WRITE_IMG);
return 0;
}