blob: cd52421286701bcfb40199e7e2cd870326609018 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef SAMPLER_H
#define SAMPLER_H
#include <core/vector.hpp>
#include <memory>
static const double LargestBelowOne = 0x1.fffffffffffffp-1;
class Sampler {
public:
Sampler(long sampleCount) : m_sampleCount(sampleCount) {}
/** @brief Start a new pixel sample
*
* Some samplers might find it usefull to get the position
*/
void startPixel(const Vec2d &p);
/** @brief Called by renderers when a new sample begins
*
* @return Whether this is the last sample
*/
bool startNextSample();
/** @brief Get a single sample */
virtual double getSample() = 0;
/** @brief Get a 2d sample
*
* Algorithms can optimize for getting 2d samples
*/
virtual Vec2d get2dSample() = 0;
/** @brief Clones the sampler
*
* Usefull when multiple threads need a sampler.
*
* @param seed Seed to set in cloned sampler
*/
virtual std::unique_ptr<Sampler> clone(int seed) = 0;
const long m_sampleCount;
protected:
Vec2d m_curPixel;
long m_curPixelSampleIndex;
};
#endif
|