Added presentations from EVI 2017

This commit is contained in:
Miguel Angel Astor Romero
2017-10-23 15:25:36 -04:00
parent 68ae52b86a
commit d60fc66a77
52 changed files with 3409 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#pragma once
#ifndef TRACER_HPP
#define TRACER_HPP
#include <vector>
#include <glm/glm.hpp>
#include "ray.hpp"
#include "scene.hpp"
using std::vector;
using glm::vec2;
using glm::vec3;
// Intersection displacement bias.
extern const float BIAS;
// Default background color.
extern const vec3 BCKG_COLOR;
/**
* Base class for ray tracers.
*/
class Tracer {
public:
unsigned int m_max_depth; // Max recursion depth.
Tracer(unsigned int max_depth = 5): m_max_depth(max_depth) { }
virtual ~Tracer() { }
/**
* Recursively trace a ray into a scene, up until the max recursion depth.
*/
virtual vec3 trace_ray(Ray & r, Scene * s, unsigned int rec_level) const = 0;
protected:
/**
* Fresnel law for refractions.
*/
float fresnel(const vec3 & i, const vec3 & n, const float ir1, const float ir2) const;
};
#endif