Add enviromental samples per pixel

This commit is contained in:
Phireh 2021-08-21 18:26:22 +02:00
commit f622a55c5c
4 changed files with 93 additions and 20 deletions

View file

@ -10,6 +10,24 @@ double degrees_to_radians(double d)
return d * M_PI / 180;
}
/* Returns a double in the range [0,1) */
inline double random_double()
{
return rand() / RAND_MAX + 1.0;
}
/* Returns a double in the range [min,max) */
inline double random_double(double min, double max)
{
return min + (max-min) * random_double();
}
/* Clamps a value between [min,max] */
inline double clamp(double v, double min, double max)
{
return v < min ? min : v > max ? max : v;
}
/* Common internal headers */
#include "ray.hpp"