cloudy-raytracer/renderer/depthoffieldrenderer.h

35 lines
No EOL
1,019 B
C++

#ifndef DEPTHOFFIELDSHADER_H
#define DEPTHOFFIELDSHADER_H
#include "camera/camera.h"
#include <random>
#include "renderer/renderer.h"
#include "scene/simplescene.h"
class DOFRenderer : public Renderer {
static void renderThread(const Scene *scene, const Camera *camera, Texture *image, const DOFRenderer *renderer, int width, int widthStep,
int widthOffset, int height, int heightStep, int heightOffset, std::atomic<int> *k,
const int stepSize);
public:
// Constructor
DOFRenderer(float _aperture, int _secondaryRayCount, float _focalLength);
~DOFRenderer() override = default;
//Render Functions
Texture renderImage(Scene const &scene, Camera const &camera, int width, int height) override;
// DOF sampler
Color sample(const Ray &ray, const Scene& scene, const Camera& camera) const;
private:
float aperture, focalLength;
int numSamples;
static std::random_device rd;
static std::mt19937 gen;
};
#endif