aboutsummaryrefslogtreecommitdiff
path: root/src/render.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.hpp')
-rw-r--r--src/render.hpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/render.hpp b/src/render.hpp
index 1274bb5..7557fce 100644
--- a/src/render.hpp
+++ b/src/render.hpp
@@ -5,18 +5,25 @@
#include "ray.hpp"
#include "scene.hpp"
+class Random {
+ public:
+ void seed(unsigned seed);
+ double operator()();
+
+ private:
+ unsigned m_seed;
+};
+
// Samples a random direction in a hemisphere, cosine weighed
// https://blog.thomaspoulet.fr/uniform-sampling-on-unit-hemisphere/
class Sampler {
public:
- Sampler();
- void seed(unsigned seed);
+ Sampler(Random &src);
Vec3d sample(const Vec3d &norm);
private:
- double random();
- unsigned m_seed;
+ Random &m_src;
};
class Renderer {
@@ -40,6 +47,8 @@ class Renderer {
const Scene &m_scn;
+ Random m_random;
+
// User options
Vec3d m_eye, m_target;
unsigned m_maxhops;