-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
55 lines (46 loc) · 1.88 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
#include "main.h"
int main( void )
{
unsigned int x_resolution = 1280;
unsigned int y_resolution = 720;
/*OrthographicCamera camera{ -1.25f,
1.25f,
-1.25f,
1.25f,
glm::ivec2{ x_resolution, y_resolution },
glm::vec3{ 0.0f, 0.0f, 1.0f }, // position
glm::vec3{ 0.0f, 1.0f, 0.0f }, // up
glm::vec3{ 0.0f, 0.0f, -1.0f } }; // look at
*/
PerspectiveCamera camera{ -4.00f,
4.00f,
-2.25f,
2.25f,
4.00f, // distance
glm::ivec2{ x_resolution, y_resolution },
glm::vec3{ -1.8f, 1.6f, 1.0f }, // position
glm::vec3{ 0.0f, 1.0f, 0.0f }, // up
glm::vec3{ 0.0f, 1.0f, 0.0f } }; // look at
Scene scene{};
scene.load();
scene.loadObject("drag.obj");
scene.loadObjectdiff("table.obj");
scene.loadObjectglass("glass.obj");
scene.acceleration_structure_ = scene.BVH_SAH;
scene.buildAccelerationStructure();
glm::vec3 background_color{ 0.0f, 0.0f, 0.0f };
size_t samples = 10; //samples per pixel
size_t maximum_depth = 5;
Buffer rendering_buffer{ x_resolution, y_resolution };
// Set up the renderer.
RayTracer rt( camera,
scene,
background_color,
samples,
maximum_depth,
rendering_buffer );
rt.integrate(); // Renders the final image.
// Save the rendered image to a .ppm file.
rendering_buffer.save( "output_image.ppm" );
return EXIT_SUCCESS;
}