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 // orthographic.cpp* 00024 #include "camera.h" 00025 00026 namespace lux 00027 { 00028 00029 // OrthographicCamera Declarations 00030 class OrthoCamera : public ProjectiveCamera { 00031 public: 00032 // OrthoCamera Public Methods 00033 OrthoCamera(const Transform &world2cam, 00034 const float Screen[4], 00035 float hither, float yon, 00036 float sopen, float sclose, 00037 float lensr, float focald, bool autofocus, Film *film); 00038 float GenerateRay(const Sample &sample, Ray *) const; 00039 bool IsVisibleFromEyes(const Scene *scene, const Point &lenP, const Point &worldP, Sample* sample_gen, Ray *ray_gen) const; 00040 float GetConnectingFactor(const Point &lenP, const Point &worldP, const Vector &wo, const Normal &n) const; 00041 void GetFlux2RadianceFactors(Film *film, float *factors, int xPixelCount, int yPixelCount) const; 00042 bool IsDelta() const 00043 { 00044 return true; 00045 } 00046 void SamplePosition(float u1, float u2, Point *p, float *pdf) const; 00047 float EvalPositionPdf() const; 00048 void AutoFocus(Scene* scene); 00049 00050 //float SampleDirection(const Sample &sample, Ray *ray) 00051 //{ 00052 // Point Pras(sample.imageX, sample.imageY, 0); 00053 // RasterToCamera(Pras, &(ray->o)); 00054 // ray->d = Vector(0,0,1); 00055 // ray->mint = 0.; 00056 // ray->maxt = ClipYon - ClipHither; 00057 // CameraToWorld(*ray, ray); 00058 // return 1.0f; 00059 //} 00060 //float EvalDirectionPdf(Film *film, const Vector& wo, const Sample &sample, const Point& p) 00061 //{ 00062 // return 1.0f; 00063 //} 00064 //SWCSpectrum EvalValue() 00065 //{ 00066 // return SWCSpectrum(1.0f); 00067 //} 00068 00069 static Camera *CreateCamera(const ParamSet ¶ms, const Transform &world2cam, Film *film); 00070 00071 private: 00072 // Dade - field used for autofocus feature 00073 bool autoFocus; 00074 00075 float screenDx,screenDy; 00076 }; 00077 00078 }//namespace lux