Faster random implementation

This commit is contained in:
David 2021-08-29 16:17:13 +02:00
commit 742ef283e4
7 changed files with 49 additions and 10 deletions

View file

@ -2,9 +2,7 @@
#include <stdint.h>
#include <stdlib.h>
// Disable profiling
#define RMT_ENABLED 1
#define RMT_ENABLED 0
// Lib includes
#pragma GCC diagnostic push
@ -21,9 +19,15 @@
#include "sphere.hpp"
#include "camera.hpp"
#ifdef DEBUG
#define print_timers() print_timers_()
#else
#define print_timers()
#endif
color ray_color(const ray& r, const hittable& world, int32_t depth);
float hit_sphere(const point3& center, float radius, const ray& r);
void print_timers();
hittable_list<sphere> random_scene();
hittable_list<sphere> random_scene() {
@ -188,10 +192,10 @@ int32_t main()
rmt_DestroyGlobalInstance(rmt);
}
#ifdef DEBUG
debug_record debug_record_array[__COUNTER__];
void print_timers()
void print_timers_()
{
for (uint32_t i = 0;
i < sizeof(debug_record_array) / sizeof(debug_record_array[0]);
@ -211,3 +215,5 @@ void print_timers()
(double)record->cycles / CLOCKS_PER_SEC);
}
}
#endif