Nori  23
sampler.h
1 /*
2  This file is part of Nori, a simple educational ray tracer
3 
4  Copyright (c) 2015 by Wenzel Jakob
5 
6  Nori is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Nori is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #if !defined(__NORI_SAMPLER_H)
20 #define __NORI_SAMPLER_H
21 
22 #include <nori/object.h>
23 #include <memory>
24 
25 NORI_NAMESPACE_BEGIN
26 
27 class ImageBlock;
28 
63 class Sampler : public NoriObject {
64 public:
66  virtual ~Sampler() { }
67 
69  virtual std::unique_ptr<Sampler> clone() const = 0;
70 
79  virtual void prepare(const ImageBlock &block) = 0;
80 
87  virtual void generate() = 0;
88 
90  virtual void advance() = 0;
91 
93  virtual float next1D() = 0;
94 
96  virtual Point2f next2D() = 0;
97 
99  virtual size_t getSampleCount() const { return m_sampleCount; }
100 
105  virtual EClassType getClassType() const override { return ESampler; }
106 protected:
107  size_t m_sampleCount;
108 };
109 
110 NORI_NAMESPACE_END
111 
112 #endif /* __NORI_SAMPLER_H */
Weighted pixel storage for a rectangular subregion of an image.
Definition: block.h:48
Base class of all objects.
Definition: object.h:32
Abstract sample generator.
Definition: sampler.h:63
virtual void prepare(const ImageBlock &block)=0
Prepare to render a new image block.
virtual std::unique_ptr< Sampler > clone() const =0
Create an exact clone of the current instance.
virtual float next1D()=0
Retrieve the next component value from the current sample.
virtual EClassType getClassType() const override
Return the type of object (i.e. Mesh/Sampler/etc.) provided by this instance.
Definition: sampler.h:105
virtual void advance()=0
Advance to the next sample.
virtual Point2f next2D()=0
Retrieve the next two component values from the current sample.
virtual size_t getSampleCount() const
Return the number of configured pixel samples.
Definition: sampler.h:99
virtual void generate()=0
Prepare to generate new samples.
virtual ~Sampler()
Release all memory.
Definition: sampler.h:66