Added indirect illumination.
This commit is contained in:
10
tracer.hpp
10
tracer.hpp
@@ -21,15 +21,21 @@ public:
|
||||
int m_w;
|
||||
float m_fov;
|
||||
float m_a_ratio;
|
||||
bool indirect_l;
|
||||
|
||||
Tracer(): m_h(480), m_w(640), m_fov(90.0f), m_a_ratio(640.0f / 480.0f) { }
|
||||
Tracer(): m_h(480), m_w(640), m_fov(90.0f), m_a_ratio(640.0f / 480.0f), indirect_l(false) { }
|
||||
|
||||
Tracer(int h, int w, float fov): m_h(h), m_w(w), m_fov(fov) {
|
||||
Tracer(int h, int w, float fov, bool il): m_h(h), m_w(w), m_fov(fov), indirect_l(il) {
|
||||
m_a_ratio = static_cast<float>(w) / static_cast<float>(h);
|
||||
};
|
||||
|
||||
vec2 sample_pixel(int i, int j) const;
|
||||
vec3 trace_ray(Ray & r, vector<Figure *> & v_figures, vector<Light *> & v_lights, unsigned int rec_level) const;
|
||||
|
||||
private:
|
||||
void create_coords_system(const vec3 &n, vec3 &nt, vec3 &nb) const;
|
||||
vec3 sample_hemisphere(const float r1, const float r2) const;
|
||||
void rotate_sample(vec3 & sample, const vec3 & n) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user