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 // lowdiscrepancy.cpp* 00024 #include "sampling.h" 00025 #include "paramset.h" 00026 #include "film.h" 00027 00028 namespace lux 00029 { 00030 00031 // LDSampler Declarations 00032 class LDSampler : public Sampler { 00033 public: 00034 // LDSampler Public Methods 00035 LDSampler(int xstart, int xend, 00036 int ystart, int yend, 00037 int nsamp, string pixelsampler); 00038 ~LDSampler(); 00039 00040 int RoundSize(int size) const { 00041 return RoundUpPow2(size); 00042 } 00043 u_int GetTotalSamplePos(); 00044 bool GetNextSample(Sample *sample, u_int *use_pos); 00045 float *GetLazyValues(Sample *sample, u_int num, u_int pos); 00046 virtual LDSampler* clone() const; // Lux (copy) constructor for multithreading 00047 00048 static Sampler *CreateSampler(const ParamSet ¶ms, const Film *film); 00049 private: 00050 // LDSampler Private Data 00051 int xPos, yPos, pixelSamples; 00052 int samplePos; 00053 float *imageSamples, *lensSamples, *timeSamples, *wavelengthsSamples, 00054 *singleWavelengthSamples; 00055 float **oneDSamples, **twoDSamples, **xDSamples; 00056 int n1D, n2D, nxD; 00057 u_int TotalPixels; 00058 PixelSampler* pixelSampler; 00059 }; 00060 00061 }//namespace lux 00062