equal
deleted
inserted
replaced
35 /** |
35 /** |
36 * sample |
36 * sample |
37 */ |
37 */ |
38 class Sample |
38 class Sample |
39 { |
39 { |
|
40 friend class Sampler; |
40 public: |
41 public: |
41 Float x,y; |
42 Float x,y; |
|
43 int sx,sy,osa_samp; |
42 }; |
44 }; |
43 |
45 |
44 /** |
46 /** |
45 * A abstract sampler. |
47 * A abstract sampler. |
46 * It generates screen samples in coordinates between [-1..1] for height |
48 * It generates screen samples in coordinates between [-1..1] for height |
60 Sampler(Float *abuffer, int &aw, int &ah): buffer(abuffer), w(aw), h(ah) {}; |
62 Sampler(Float *abuffer, int &aw, int &ah): buffer(abuffer), w(aw), h(ah) {}; |
61 virtual ~Sampler() {}; |
63 virtual ~Sampler() {}; |
62 void resetBuffer(Float *abuffer, int &aw, int &ah) { buffer = abuffer; w = aw; h = ah; }; |
64 void resetBuffer(Float *abuffer, int &aw, int &ah) { buffer = abuffer; w = aw; h = ah; }; |
63 virtual void init() = 0; |
65 virtual void init() = 0; |
64 virtual int initSampleSet() = 0; |
66 virtual int initSampleSet() = 0; |
65 virtual Sample *nextSample() = 0; |
67 virtual bool nextSample(Sample *s) = 0; |
66 virtual void saveSample(Sample *samp, Colour &col) = 0; |
68 virtual void saveSample(Sample &samp, Colour &col) = 0; |
67 }; |
|
68 |
|
69 /** |
|
70 * default sample |
|
71 */ |
|
72 class DefaultSample: public Sample |
|
73 { |
|
74 friend class DefaultSampler; |
|
75 int sx,sy,osa_samp; |
|
76 }; |
69 }; |
77 |
70 |
78 /** |
71 /** |
79 * Default sampler. |
72 * Default sampler. |
80 * Implements basic adaptive subsampling and oversampling. |
73 * Implements basic adaptive subsampling and oversampling. |
88 public: |
81 public: |
89 DefaultSampler(Float *abuffer, int &aw, int &ah): |
82 DefaultSampler(Float *abuffer, int &aw, int &ah): |
90 Sampler(abuffer, aw, ah), phase(-1), subsample(8), oversample(0) {}; |
83 Sampler(abuffer, aw, ah), phase(-1), subsample(8), oversample(0) {}; |
91 void init(); |
84 void init(); |
92 int initSampleSet(); |
85 int initSampleSet(); |
93 Sample *nextSample(); |
86 bool nextSample(Sample *s); |
94 void saveSample(Sample *samp, Colour &col); |
87 void saveSample(Sample &samp, Colour &col); |
95 |
88 |
96 void setSubsample(int sub) { subsample = sub; }; |
89 void setSubsample(int sub) { subsample = sub; }; |
97 int getSubsample() { return subsample; }; |
90 int getSubsample() { return subsample; }; |
98 void setOversample(int osa) { oversample = osa; }; |
91 void setOversample(int osa) { oversample = osa; }; |
99 int getOversample() { return oversample; }; |
92 int getOversample() { return oversample; }; |