diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-03-29 22:25:29 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-03-29 22:25:29 +0200 |
| commit | be5f1133bff5d4c551e2702211acb155d8819fd0 (patch) | |
| tree | bfd575657188b3ceb3b70dd0225c740035c98e99 /include/utils.hpp | |
| parent | bc1073a020c99ed89967a6b00a9eeb4ab2e160dc (diff) | |
BVH simple implementation
Diffstat (limited to 'include/utils.hpp')
| -rw-r--r-- | include/utils.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/utils.hpp b/include/utils.hpp index 3821d20..8d46821 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -8,6 +8,7 @@ #include "vec3.hpp" #include "sphere.hpp" #include "camera.hpp" +#include "bvh-node.hpp" struct input_data { color sky_color; @@ -20,6 +21,7 @@ struct input_data { vec3 random_in_sphere[1000]; sphere spheres[512]; + bvh_node nodes[1024]; uint32_t max_bounce; uint32_t samples_per_pixel; @@ -49,6 +51,11 @@ inline float randd() { inline float randd(float min, float max) { return min + randd() * (max - min); } + +inline int32_t randi(int32_t min, int32_t max) { + return static_cast<int32_t>(randd(min, max + 1)); +} + inline float clamp(float x, float min, float max) { if (x < min) return min; if (x > max) return max; |
