aboutsummaryrefslogtreecommitdiff
path: root/src/render.hpp
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-01-24 18:13:44 +0100
committerJulian T <julian@jtle.dk>2021-01-24 18:22:11 +0100
commit41ea2d8f94043d49fc26aaaa8030a73dcfdc2da9 (patch)
treefcc07052425c65b38c1724f4fc30299a1cb48716 /src/render.hpp
parenta38e6014ea5441e9d29fcb3b5607cd94e4061cff (diff)
Create rust project
Diffstat (limited to 'src/render.hpp')
-rw-r--r--src/render.hpp61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/render.hpp b/src/render.hpp
deleted file mode 100644
index 7557fce..0000000
--- a/src/render.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef RENDER_H
-#define RENDER_H
-
-#include "vector.hpp"
-#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(Random &src);
-
- Vec3d sample(const Vec3d &norm);
-
- private:
- Random &m_src;
-};
-
-class Renderer {
- public:
- Renderer(const Scene &scn, Vec3d eye, Vec3d target, unsigned width, unsigned height, unsigned maxhops);
-
- Color render(unsigned x, unsigned y, unsigned samples);
-
- unsigned m_width, m_height;
- Sampler m_sampler;
-
- private:
- void recalculate();
- Ray findray(double x, double y) const ;
-
- Color pathtrace_sample(const Ray &r, unsigned hop);
- // Will return first result less than chk_dist.
- // This is ignored if chk_dist is 0.
- // If dist is non-null the resulting distance is written here.
- const Shape* cast_ray(const Ray &r, double chk_dist, double *dist);
-
- const Scene &m_scn;
-
- Random m_random;
-
- // User options
- Vec3d m_eye, m_target;
- unsigned m_maxhops;
-
- // Calculated values
- Vec3d m_qx, m_qy, m_blc;
-
-};
-
-#endif