[ADD] Add measurement for chapters
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
|
||||
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
|
||||
#include <raytracing.h>
|
||||
@@ -33,6 +34,7 @@
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
using namespace Raytracer;
|
||||
using namespace std;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -43,6 +45,8 @@ int main(void)
|
||||
Canvas the_canvas;
|
||||
Sphere *the_floor, *the_left_wall, *the_right_wall;
|
||||
Sphere *the_middle, *the_right, *the_left;
|
||||
chrono::time_point<chrono::high_resolution_clock> the_start, the_end;
|
||||
|
||||
printf("Chapter 07 example.\n");
|
||||
|
||||
// Floor is an extremely flattened sphere with a matte texture.
|
||||
@@ -100,9 +104,14 @@ int main(void)
|
||||
the_camera.set_transform(
|
||||
Matrix::view_transform(Tuple::Point(0, 1.5, -5), Tuple::Point(0, 1, 0), Tuple::Vector(0, 1, 0)));
|
||||
|
||||
the_start = chrono::high_resolution_clock::now();
|
||||
the_canvas = the_camera.render(the_world);
|
||||
the_end = chrono::high_resolution_clock::now();
|
||||
|
||||
the_canvas.save_to_file("chapter07.ppm");
|
||||
|
||||
chrono::duration<double> the_elapsed_time = the_end - the_start;
|
||||
printf("Execution Time: %f secondes\n", the_elapsed_time.count());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user