00001 /*************************************************************************** 00002 * Copyright (C) 1998-2008 by authors (see AUTHORS.txt ) * 00003 * * 00004 * This file is part of LuxRender. * 00005 * * 00006 * Lux Renderer is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 3 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * Lux Renderer is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00018 * * 00019 * This project is based on PBRT ; see http://www.pbrt.org * 00020 * Lux Renderer website : http://www.luxrender.net * 00021 ***************************************************************************/ 00022 00023 // random.cpp* 00024 #include "sampling.h" 00025 #include "paramset.h" 00026 #include "film.h" 00027 00028 namespace lux 00029 { 00030 00031 class RandomSampler : public Sampler 00032 { 00033 public: 00034 RandomSampler(int xstart, int xend, int ystart, int yend, 00035 int xs, int ys, string pixelsampler); 00036 ~RandomSampler(); 00037 00038 u_int GetTotalSamplePos(); 00039 bool GetNextSample(Sample *sample, u_int *use_pos); 00040 float *GetLazyValues(Sample *sample, u_int num, u_int pos); 00041 int RoundSize(int sz) const 00042 { 00043 return sz; 00044 } 00045 virtual RandomSampler* clone() const; // Lux (copy) constructor for multithreading 00046 00047 static Sampler *CreateSampler(const ParamSet ¶ms, const Film *film); 00048 private: 00049 // RandomSampler Private Data 00050 bool jitterSamples; 00051 int xPos, yPos, xPixelSamples, yPixelSamples; 00052 float *imageSamples, *lensSamples, *timeSamples, *wavelengthsSamples, 00053 *singleWavelengthSamples; 00054 int samplePos; 00055 u_int TotalPixels; 00056 PixelSampler* pixelSampler; 00057 }; 00058 00059 }//namespace lux