33 lines
No EOL
870 B
C++
33 lines
No EOL
870 B
C++
#ifndef DEPTHOFFIELDSHADER_H
|
|
#define DEPTHOFFIELDSHADER_H
|
|
|
|
#include "shader/shader.h"
|
|
#include "light/light.h"
|
|
#include "camera/perspectivecamera.h"
|
|
#include <random>
|
|
#include "scene/simplescene.h"
|
|
|
|
class DOFShader : public Shader {
|
|
|
|
public:
|
|
// Constructor / Desctructor
|
|
DOFShader(SimpleScene& _scene, Color const &_diffuseColor, int _numSamples, float _aperture, float _focalDistance, float _focalLength, PerspectiveCamera& _camera);
|
|
virtual ~DOFShader() = default;
|
|
|
|
// Shader functions
|
|
virtual Color shade(Scene const &scene, Ray const &ray) const;
|
|
|
|
private:
|
|
float aperture, focalDistance, focalLength;
|
|
int numSamples;
|
|
PerspectiveCamera& camera;
|
|
SimpleScene& scene;
|
|
Color diffuseColor;
|
|
static std::random_device rd;
|
|
static std::mt19937 gen;
|
|
|
|
|
|
Color sample(Ray ray, Light::Illumination const &illum) const;
|
|
};
|
|
|
|
#endif |