blob: bb4e9c5d7e1647d90adf81ef26b2e62e9f9a46b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef RENDER_H
#define RENDER_H
#include "vector.hpp"
#include "ray.hpp"
#include "scene.hpp"
class Renderer {
public:
Renderer(const Scene &scn, Vec3d eye, Vec3d target, unsigned width, unsigned height);
Color render(unsigned x, unsigned y);
unsigned m_width, m_height;
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;
// User options
Vec3d m_eye, m_target;
// Calculated values
Vec3d m_qx, m_qy, m_blc;
};
#endif
|