include/sampler.h
branchpyrit
changeset 50 14a727b70d07
parent 49 558fde7da82a
child 53 228cb8bfdd54
equal deleted inserted replaced
49:558fde7da82a 50:14a727b70d07
    60 	Sampler(Float *abuffer, int &aw, int &ah): buffer(abuffer), w(aw), h(ah) {};
    60 	Sampler(Float *abuffer, int &aw, int &ah): buffer(abuffer), w(aw), h(ah) {};
    61 	virtual ~Sampler() {};
    61 	virtual ~Sampler() {};
    62 	void resetBuffer(Float *abuffer, int &aw, int &ah) { buffer = abuffer; w = aw; h = ah; };
    62 	void resetBuffer(Float *abuffer, int &aw, int &ah) { buffer = abuffer; w = aw; h = ah; };
    63 	virtual void init() = 0;
    63 	virtual void init() = 0;
    64 	virtual int initSampleSet() = 0;
    64 	virtual int initSampleSet() = 0;
    65 	virtual Sample *nextSample(Sample *prev) = 0;
    65 	virtual Sample *nextSample() = 0;
    66 	virtual void saveSample(Sample *samp, Colour &col) = 0;
    66 	virtual void saveSample(Sample *samp, Colour &col) = 0;
    67 };
    67 };
    68 
    68 
    69 /**
    69 /**
    70  * default sample
    70  * default sample
    82 class DefaultSampler: public Sampler
    82 class DefaultSampler: public Sampler
    83 {
    83 {
    84 	int phase;
    84 	int phase;
    85 	int subsample;
    85 	int subsample;
    86 	int oversample; // 0 = no, 1 = 5x, 2 = 9x, 3 = 16x
    86 	int oversample; // 0 = no, 1 = 5x, 2 = 9x, 3 = 16x
       
    87 	int sx,sy,osa_samp; // current sample properties
    87 public:
    88 public:
    88 	DefaultSampler(Float *abuffer, int &aw, int &ah):
    89 	DefaultSampler(Float *abuffer, int &aw, int &ah):
    89 		Sampler(abuffer, aw, ah), phase(-1), subsample(8), oversample(0) {};
    90 		Sampler(abuffer, aw, ah), phase(-1), subsample(8), oversample(0) {};
    90 	void init();
    91 	void init();
    91 	int initSampleSet();
    92 	int initSampleSet();
    92 	Sample *nextSample(Sample *prev);
    93 	Sample *nextSample();
    93 	void saveSample(Sample *samp, Colour &col);
    94 	void saveSample(Sample *samp, Colour &col);
    94 
    95 
    95 	void setSubsample(int sub) { subsample = sub; };
    96 	void setSubsample(int sub) { subsample = sub; };
    96 	int getSubsample() { return subsample; };
    97 	int getSubsample() { return subsample; };
    97 	void setOversample(int osa) { oversample = osa; };
    98 	void setOversample(int osa) { oversample = osa; };