00001 00002 /* 00003 pbrt source code Copyright(c) 1998-2007 Matt Pharr and Greg Humphreys. 00004 00005 This file is part of pbrt. 00006 00007 pbrt is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. Note that the text contents of 00011 the book "Physically Based Rendering" are *not* licensed under the 00012 GNU GPL. 00013 00014 pbrt is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 // box.cpp* 00025 #include "sampling.h" 00026 #include "paramset.h" 00027 // Box Filter Declarations 00028 class BoxFilter : public Filter { 00029 public: 00030 BoxFilter(float xw, float yw) : Filter(xw, yw) { } 00031 float Evaluate(float x, float y) const; 00032 }; 00033 // Box Filter Method Definitions 00034 float BoxFilter::Evaluate(float x, float y) const { 00035 return 1.; 00036 } 00037 extern "C" DLLEXPORT Filter *CreateFilter(const ParamSet &ps) { 00038 float xw = ps.FindOneFloat("xwidth", .5f); 00039 float yw = ps.FindOneFloat("ywidth", .5f); 00040 return new BoxFilter(xw, yw); 00041 }