-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (28 loc) · 819 Bytes
/
main.cpp
File metadata and controls
38 lines (28 loc) · 819 Bytes
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
#include <iostream>
#include "Framebuffer.h"
#include <raylib.h>
#include "camera.h"
#include "hittable.h"
#include "hittable_list.h"
#include "rtweekend.h"
#include "sphere.h"
int main() {
hittable_list world;
world.add(make_shared<sphere>(point3(0, 0, -1), 0.5));
world.add(make_shared<sphere>(point3(0, -100.5, -1), 100));
world.add(make_shared<sphere>(point3(1, 0, -1), 0.5));
camera cam;
cam.aspect_ratio = 16.0 / 9.0;
cam.image_width = 1200;
cam.samples_per_pixel = 20;
cam.initialize();
Framebuffer framebuffer(cam.image_width, cam.image_width/cam.aspect_ratio);
std::thread render_thread([&cam, &world] ()
{
cam.render(world);
});
framebuffer.Run(cam.pixels, cam.pixel_mutex);
render_thread.join();
free(cam.pixels);
return 0;
}